~ubuntu-branches/ubuntu/karmic/fsviewer/karmic

« back to all changes in this revision

Viewing changes to src/editInspector.c

  • Committer: Bazaar Package Importer
  • Author(s): Francois Gurin
  • Date: 2004-08-12 16:13:27 UTC
  • mfrom: (1.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040812161327-4b2uq9v4gmxpgp9t
Tags: 0.2.5-6
* Fix ICONDIR problem  (closes: #261880)
* Fix FTBFS problems with patched api changes and dependency on libwraster-dev (closes: #280283)
* Implemented work around for BadWindow error (re: #288605)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* editInspector.c */
 
2
 
1
3
#include "FSViewer.h"
2
4
#include "FSUtils.h"
3
5
 
 
6
/* for: scr->normalFont */
 
7
#include <WINGs/WINGsP.h> 
 
8
 
4
9
#define WIDTH               272
5
10
#define HEIGHT              272
6
11
#define LABEL_HEIGHT         16
55
60
        free(exec);
56
61
}
57
62
 
 
63
 
58
64
static void
59
65
showData(_Panel *panel)
60
66
{
62
68
 
63
69
    WMClearList(panel->appList);
64
70
 
65
 
    array = WMGetUDObjectForKey(defaultsDB, "EXE");
 
71
    array = FSGetUDObjectForKey(defaultsDB, "EXE");
66
72
    if(array && WMIsPLArray(array))
67
73
    {
68
74
        int numElem, i;
70
76
        numElem = WMGetPropListItemCount(array);
71
77
        for(i = 0; i < numElem; i++)    
72
78
            WMAddListItem(panel->appList, 
73
 
                          WMGetPropListDescription(WMGetFromPLArray(array, i), True));
 
79
              WMGetPropListDescription(WMGetFromPLArray(array, i), False));
74
80
    }
 
81
    WMSortListItems(panel->appList);
75
82
 
76
83
    displayDefault(panel);
77
84
}
89
96
        WMPropList* array = NULL;
90
97
 
91
98
        FSSetStringForNameKey(panel->fileInfo->extn, "editor", exec);
92
 
        array = WMGetUDObjectForKey(defaultsDB, "EXTN");
 
99
        array = FSGetUDObjectForKey(defaultsDB, "EXTN");
93
100
        if(array && WMIsPLArray(array))
94
101
            InsertArrayElement(array, WMCreatePLString(panel->fileInfo->extn));
95
102
        free(exec);
123
130
        RColor color;
124
131
        WMPixmap *pixmap;
125
132
        
126
 
        color.red = 0xae;
 
133
        color.red   = 0xae;
127
134
        color.green = 0xaa;
128
 
        color.blue = 0xae;
 
135
        color.blue  = 0xae;
129
136
        color.alpha = 0;
130
 
        
131
 
        pixmap = FSCreateBlendedPixmapFromFile(WMWidgetScreen(panel->win),
 
137
              /* FS.. */        
 
138
        pixmap = WMCreateBlendedPixmapFromFile(WMWidgetScreen(panel->win),
132
139
                                               icon, &color);
133
140
        if(pixmap)
134
141
        {
161
168
    {
162
169
        storeData(panel);
163
170
        showData(panel);
164
 
/*      WMSetButtonEnabled(panel->okBtn, False); */
 
171
        WMSetButtonEnabled(panel->revertBtn, True);
165
172
    } 
166
173
    else if ((WMButton *)self == panel->revertBtn)
167
174
    {
168
175
        displayDefault(panel);
 
176
        WMSetButtonEnabled(panel->revertBtn, False);
169
177
    }
170
178
    else if ((WMButton *)self == panel->appBtn)
171
179
    {
199
207
{
200
208
    panel->appList = WMCreateList(panel->frame);
201
209
 
202
 
    WMMoveWidget(panel->appList, 8, 26);
 
210
    WMMoveWidget(panel->appList, 8, 36);
203
211
    WMResizeWidget(panel->appList, 180, 115);
204
212
    WMSetListAction(panel->appList, appListClick, panel);
205
213
}
210
218
    WMLabel *l;
211
219
 
212
220
    l = WMCreateLabel(panel->frame);
213
 
    WMResizeWidget(l, WIDTH-20, LABEL_HEIGHT);
214
 
    WMMoveWidget(l, 11, 0);
215
 
    WMSetLabelText(l, "Click button to edit selected document");
216
 
    WMSetLabelTextAlignment(l, WACenter);
 
221
    WMSetLabelWraps(l, True);
 
222
    WMResizeWidget(l, WIDTH-8, LABEL_HEIGHT*2);
 
223
    WMMoveWidget(l, 4, 0);
 
224
    WMSetLabelText(l, _("Click button to edit selected document"));
 
225
    /* WMSetLabelTextAlignment(l, WACenter); */
217
226
    WMSetLabelRelief(l, WRFlat);
218
227
    WMSetLabelTextColor(l, WMDarkGrayColor(WMWidgetScreen(panel->win)));
219
 
 
220
228
}    
221
229
 
222
230
 
224
232
createDefaultLabels(Panel *panel)
225
233
{
226
234
    WMLabel *l;
 
235
    WMScreen *scr;
 
236
    int tw;
227
237
 
228
238
    l = WMCreateLabel(panel->frame);
229
 
    WMResizeWidget(l, LABEL_WIDTH, LABEL_HEIGHT);
230
 
    WMMoveWidget(l, 4, 180);
231
 
    WMSetLabelText(l, "Default:");
 
239
    WMSetLabelText(l, _("Default:"));
 
240
    scr = WMWidgetScreen(panel->win);
 
241
    tw = WMWidthOfString(scr->normalFont, WMGetLabelText(l),
 
242
      strlen(WMGetLabelText(l)));
 
243
    WMResizeWidget(l, tw+4, LABEL_HEIGHT);
 
244
    WMMoveWidget(l, 4, 182);
232
245
    WMSetLabelRelief(l, WRFlat);
233
246
    WMSetLabelTextColor(l, WMDarkGrayColor(WMWidgetScreen(panel->win)));
234
247
 
235
248
    panel->defaultLabel = WMCreateLabel(panel->frame);
236
249
    WMResizeWidget(panel->defaultLabel, WIDTH, LABEL_HEIGHT);
237
 
    WMMoveWidget(panel->defaultLabel, 52, 180);
 
250
    /* x-Position should be: 4 + width("Default:") + 4 */
 
251
    WMMoveWidget(panel->defaultLabel, 8+tw, 182);
238
252
    WMSetLabelRelief(panel->defaultLabel, WRFlat);
239
253
 
240
254
}    
245
259
    WMLabel *l;
246
260
 
247
261
    l = WMCreateLabel(panel->frame);
248
 
    WMResizeWidget(l, WIDTH-20, LABEL_HEIGHT*2);
249
 
    WMMoveWidget(l, 10, 206);
250
 
    WMSetLabelText(l, "Click \"Set Default\" to set default application for "\
251
 
                   "all documents with this extension.");
252
 
    WMSetLabelTextAlignment(l, WACenter);
 
262
    WMSetLabelWraps(l, True);
 
263
    WMResizeWidget(l, WIDTH-8, LABEL_HEIGHT*2);
 
264
    WMMoveWidget(l, 4, 206);
 
265
    WMSetLabelText(l, _("Click \"Set Default\" to set default "\
 
266
      "application for all documents with this extension."));
 
267
    WMSetLabelTextAlignment(l, WALeft); 
253
268
    WMSetLabelRelief(l, WRFlat);
254
269
    WMSetLabelTextColor(l, WMDarkGrayColor(WMWidgetScreen(panel->win)));
255
270
 
259
274
createExecField(Panel *panel)
260
275
{
261
276
    panel->execField = WMCreateTextField(panel->frame);
262
 
    WMMoveWidget(panel->execField, 8, 153);
 
277
    WMMoveWidget(panel->execField, 8, 159);
263
278
    WMResizeWidget(panel->execField, 256, 18);
264
279
 
265
280
}
270
285
    panel->revertBtn = WMCreateCommandButton(panel->frame);
271
286
    WMMoveWidget(panel->revertBtn, 16, HEIGHT-24);
272
287
    WMResizeWidget(panel->revertBtn, 115, 24);
273
 
    WMSetButtonText(panel->revertBtn, "Revert");
274
 
    WMSetButtonEnabled(panel->revertBtn, True);
 
288
    WMSetButtonText(panel->revertBtn, _("Revert"));
275
289
    WMSetButtonAction(panel->revertBtn, buttonClick, panel);
276
 
    WMSetButtonEnabled(panel->revertBtn, True);
 
290
    WMSetButtonEnabled(panel->revertBtn, False);
277
291
   
278
292
    panel->okBtn = WMCreateCommandButton(panel->frame);
279
293
    WMMoveWidget(panel->okBtn, 140, HEIGHT-24);
280
294
    WMResizeWidget(panel->okBtn, 115, 24);
281
 
    WMSetButtonText(panel->okBtn, "Set Default");
 
295
    WMSetButtonText(panel->okBtn, _("Set Default"));
282
296
    WMSetButtonImage(panel->okBtn, 
283
297
                     WMGetSystemPixmap(WMWidgetScreen(panel->win), 
284
298
                                       WSIReturnArrow));
290
304
    WMSetButtonAction(panel->okBtn, buttonClick, panel);   
291
305
 
292
306
    panel->appBtn = WMCreateCommandButton(panel->frame);
293
 
    WMMoveWidget(panel->appBtn, 196, 50);
 
307
    WMMoveWidget(panel->appBtn, 196, 59); /* 36 + (115/2) - 68/2 = 59 */
294
308
    WMResizeWidget(panel->appBtn, 68, 68);
295
309
    WMSetButtonEnabled(panel->appBtn, True);
296
310
    WMSetButtonAction(panel->appBtn, buttonClick, panel);   
329
343
    panel = wmalloc(sizeof(_Panel));
330
344
    memset(panel, 0, sizeof(_Panel));
331
345
 
332
 
    panel->sectionName = (char *) wmalloc(strlen("Editor Inspector")+1);
333
 
    strcpy(panel->sectionName, "Editor Inspector");
 
346
    panel->sectionName = (char *) wmalloc(strlen(_("Editor Inspector"))+1);
 
347
    strcpy(panel->sectionName, _("Editor Inspector"));
334
348
 
335
349
    panel->win = win;
336
350