1
// Preferences dialog box
12
#include "FileDialog.h"
13
#include "FontDialog.h"
14
#include "XFileExplorer.h"
15
#include "MessageBox.h"
16
#include "Keybindings.h"
17
#include "Preferences.h"
20
FXbool Theme::operator != (const Theme& t)
22
for(int i=0;i<NUM_COLORS;i++)
23
if(color[i] != t.color[i])
30
extern FXMainWindow *mainWindow;
32
// Single click navigation
33
extern FXbool single_click;
36
extern FXbool file_tooltips;
38
// Relative resizing of the panels and columns in detailed mode
39
extern FXbool relative_resize;
41
// Save window position
42
extern FXbool save_win_pos;
45
// Create hilite color from given color for gradient controls
46
FXColor makeHiliteColorGradient(FXColor color)
54
r=(FXuint)(FXMIN(1.2*r,255));
55
g=(FXuint)(FXMIN(1.2*g,255));
56
b=(FXuint)(FXMIN(1.2*b,255));
62
// Create shadow color from given color for gradient controls
63
FXColor makeShadowColorGradient(FXColor color)
80
FXDEFMAP(PreferencesBox) PreferencesMap[]=
82
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_ACCEPT,PreferencesBox::onCmdAccept),
83
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_CANCEL,PreferencesBox::onCmdCancel),
84
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_BROWSE_TXTEDIT,PreferencesBox::onCmdBrowse),
85
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_BROWSE_TXTVIEW,PreferencesBox::onCmdBrowse),
86
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_BROWSE_IMGVIEW,PreferencesBox::onCmdBrowse),
87
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_BROWSE_ARCHIVER,PreferencesBox::onCmdBrowse),
88
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_BROWSE_PDFVIEW,PreferencesBox::onCmdBrowse),
89
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_BROWSE_VIDEOVIEW,PreferencesBox::onCmdBrowse),
90
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_BROWSE_AUDIOVIEW,PreferencesBox::onCmdBrowse),
91
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_BROWSE_XTERM,PreferencesBox::onCmdBrowse),
92
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_COLOR,PreferencesBox::onCmdColor),
93
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_NORMALFONT,PreferencesBox::onCmdNormalFont),
94
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_TEXTFONT,PreferencesBox::onCmdTextFont),
95
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_THEME,PreferencesBox::onCmdTheme),
96
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_BROWSE_ICON_PATH,PreferencesBox::onCmdBrowsePath),
97
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_SU_CMD,PreferencesBox::onCmdSuMode),
98
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_SUDO_CMD,PreferencesBox::onCmdSuMode),
99
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_STANDARD_CONTROLS,PreferencesBox::onCmdControls),
100
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_CLEARLOOKS_CONTROLS,PreferencesBox::onCmdControls),
101
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_WHEELADJUST,PreferencesBox::onCmdWheelAdjust),
102
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_CHANGE_KEYBINDINGS,PreferencesBox::onCmdChangeKeyBindings),
103
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_RESTORE_KEYBINDINGS,PreferencesBox::onCmdRestoreKeyBindings),
104
FXMAPFUNC(SEL_UPDATE,PreferencesBox::ID_STANDARD_CONTROLS,PreferencesBox::onUpdControls),
105
FXMAPFUNC(SEL_UPDATE,PreferencesBox::ID_CLEARLOOKS_CONTROLS,PreferencesBox::onUpdControls),
106
FXMAPFUNC(SEL_UPDATE,PreferencesBox::ID_COLOR,PreferencesBox::onUpdColor),
107
FXMAPFUNC(SEL_UPDATE,PreferencesBox::ID_WHEELADJUST,PreferencesBox::onUpdWheelAdjust),
108
FXMAPFUNC(SEL_UPDATE,PreferencesBox::ID_SINGLE_CLICK_FILEOPEN,PreferencesBox::onUpdSingleClickFileopen),
109
FXMAPFUNC(SEL_UPDATE,PreferencesBox::ID_CONFIRM_TRASH,PreferencesBox::onUpdTrash),
110
FXMAPFUNC(SEL_UPDATE,PreferencesBox::ID_TRASH_BYPASS,PreferencesBox::onUpdTrash),
111
FXMAPFUNC(SEL_UPDATE,PreferencesBox::ID_CONFIRM_DEL_EMPTYDIR,PreferencesBox::onUpdConfirmDelEmptyDir),
112
FXMAPFUNC(SEL_UPDATE,PreferencesBox::ID_SU_CMD,PreferencesBox::onUpdSuMode),
113
FXMAPFUNC(SEL_UPDATE,PreferencesBox::ID_SUDO_CMD,PreferencesBox::onUpdSuMode),
116
// Object implementation
117
FXIMPLEMENT(PreferencesBox,DialogBox,PreferencesMap,ARRAYNUMBER(PreferencesMap))
120
PreferencesBox::PreferencesBox(FXWindow *win, FXColor listbackcolor, FXColor listforecolor, FXColor highlightcolor, FXColor pbarcolor, FXColor attentioncolor): DialogBox(win,_("Preferences"), DECOR_TITLE|DECOR_BORDER)
122
currTheme.name = _("Current Theme");
123
currTheme.color[0] = getApp()->getBaseColor();
124
currTheme.color[1] = getApp()->getBorderColor();
125
currTheme.color[2] = getApp()->getBackColor();
126
currTheme.color[3] = getApp()->getForeColor();
127
currTheme.color[4] = getApp()->getSelbackColor();
128
currTheme.color[5] = getApp()->getSelforeColor();
129
currTheme.color[6] = listbackcolor;
130
currTheme.color[7] = listforecolor;
131
currTheme.color[8] = highlightcolor;
132
currTheme.color[9] = pbarcolor;
133
currTheme.color[10] = attentioncolor;
135
Themes[0] = currTheme;
136
Themes[1] = Theme("FOX",FXRGB(212,208,200),FXRGB(0,0,0),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(10,36,106),FXRGB(255,255,255),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(238,238,238),FXRGB(10,36,106),FXRGB(255,0,0));
137
Themes[2] = Theme("GNOME2",FXRGB(220,218,213),FXRGB(0,0,0),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(75,105,131),FXRGB(255,255,255),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(238,238,238),FXRGB(75,105,131),FXRGB(255,0,0));
138
Themes[3] = Theme("KDE3",FXRGB(238,238,230),FXRGB(0,0,0),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(255,222,118),FXRGB(0,0,0),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(238,238,238),FXRGB(255,222,118),FXRGB(255,0,0));
139
Themes[4] = Theme("XFCE4",FXRGB(238,238,238),FXRGB(0,0,0),FXRGB(238,238,238),FXRGB(0,0,0),FXRGB(99,119,146),FXRGB(255,255,255),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(238,238,238),FXRGB(99,119,146),FXRGB(255,0,0));
140
Themes[5] = Theme("CDE",FXRGB(156,153,156),FXRGB(0,0,0),FXRGB(131,129,131),FXRGB(255,255,255),FXRGB(49,97,131),FXRGB(255,255,255),FXRGB(131,129,131),FXRGB(255,255,255),FXRGB(165,162,165),FXRGB(49,97,131),FXRGB(255,0,0));
141
Themes[6] = Theme("Digital CDE",FXRGB(74,121,131),FXRGB(0,0,0),FXRGB(49,76,74),FXRGB(255,255,255),FXRGB(82,101,113),FXRGB(255,255,255),FXRGB(49,76,74),FXRGB(255,255,255),FXRGB(69,107,104),FXRGB(82,101,113),FXRGB(255,0,0));
142
Themes[7] = Theme("Sea Sky",FXRGB(165,178,198),FXRGB(0,0,0),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(49,101,156),FXRGB(255,255,255),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(238,238,238),FXRGB(49,101,156),FXRGB(255,0,0));
143
Themes[8] = Theme("Blue Slate",FXRGB(156,186,205),FXRGB(0,0,0),FXRGB(197,194,197),FXRGB(0,0,0),FXRGB(82,129,148),FXRGB(255,255,255),FXRGB(197,194,197),FXRGB(0,0,0),FXRGB(238,238,238),FXRGB(82,129,148),FXRGB(255,0,0));
144
Themes[9] = Theme("Human",FXRGB(0xEF,0xEB,0xE7),FXRGB(0,0,0),FXRGB(0xEE,0xEE,0xEE),FXRGB(0,0,0),FXRGB(0xB3,0x91,0x69),FXRGB(0xFF,0xFF,0xFF),FXRGB(0xEE,0xEE,0xEE),FXRGB(0,0,0),FXRGB(255,255,255),FXRGB(0xB3,0x91,0x69),FXRGB(255,0,0));
145
Themes[10] = Theme("iMac",FXRGB(205,206,205),FXRGB(0,0,0),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(0,0,128),FXRGB(255,255,255),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(238,238,238),FXRGB(0,0,128),FXRGB(255,0,0));
146
Themes[11] = Theme("BeOS",FXRGB(222,218,222),FXRGB(0,0,0),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(172,170,172),FXRGB(255,255,255),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(238,238,238),FXRGB(172,170,172),FXRGB(255,0,0));
147
Themes[12] = Theme("Windows 95",FXRGB(192,192,192),FXRGB(0,0,0),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(0,0,128),FXRGB(255,255,255),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(238,238,238),FXRGB(0,0,128),FXRGB(255,0,0));
150
FXHorizontalFrame *buttons=new FXHorizontalFrame(this,LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X,0,0,0,0,10,10,5,5);
153
FXHorizontalFrame *contents=new FXHorizontalFrame(this,LAYOUT_SIDE_TOP|FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y|PACK_UNIFORM_WIDTH);
156
FXButton *ok = new FXButton(buttons,_("&Accept"),NULL,this,PreferencesBox::ID_ACCEPT,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y,0,0,0,0,20,20);
157
ok->addHotKey(KEY_Return);
160
new FXButton(buttons,_("&Cancel"),NULL,this,PreferencesBox::ID_CANCEL,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y,0,0,0,0,20,20);
163
FXTabBook *tabbook = new FXTabBook(contents,NULL,0,LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_RIGHT);
166
// First tab - General options
167
new FXTabItem(tabbook,_("&General"),NULL);
168
FXVerticalFrame *options=new FXVerticalFrame(tabbook,FRAME_THICK|FRAME_RAISED);
170
FXGroupBox *group=new FXGroupBox(options,_("Options"),GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
171
trashcan=new FXCheckButton(group,_("Use trash can for file deletion (safe delete)"));
172
trashbypass=new FXCheckButton(group,_("Include a command to bypass the trash can (permanent delete)"),this,ID_TRASH_BYPASS);
173
autosave=new FXCheckButton(group,_("Auto save layout"));
174
savewinpos=new FXCheckButton(group,_("Save window position"));
175
diropen=new FXCheckButton(group,_("Single click directory open"));
176
fileopen=new FXCheckButton(group,_("Single click file open"),this,ID_SINGLE_CLICK_FILEOPEN);
177
filetooltips=new FXCheckButton(group,_("Display tooltips in file and directory lists"),this,ID_FILE_TOOLTIPS);
178
relativeresize=new FXCheckButton(group,_("Relative resizing of file lists"),this,ID_RELATIVE_RESIZE);
179
showpathlink=new FXCheckButton(group,_("Display a path linker above file lists"),this,ID_SHOW_PATHLINK);
180
#ifdef STARTUP_NOTIFICATION
181
usesn=new FXCheckButton(group,_("Notify when applications start up"));
183
group=new FXGroupBox(options,_("Mouse"),GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
184
scroll=new FXCheckButton(group,_("Smooth scrolling in file lists and text windows"));
185
FXMatrix *matrix = new FXMatrix(group,2,MATRIX_BY_COLUMNS|LAYOUT_SIDE_TOP|LAYOUT_FILL_Y);
186
new FXLabel(matrix,_("Mouse scrolling speed:"),NULL,JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
187
FXSpinner* spinner=new FXSpinner(matrix,3,this,PreferencesBox::ID_WHEELADJUST,JUSTIFY_RIGHT|LAYOUT_FILL_X|LAYOUT_FILL_ROW,0,0,0,0, 2,2,1,1);
188
spinner->setRange(1,100);
189
FXbool smoothscroll=getApp()->reg().readUnsignedEntry("SETTINGS","smooth_scroll",TRUE);
190
scroll->setCheck(smoothscroll);
192
group=new FXGroupBox(options,_("Root mode"),GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
193
rootmode=new FXCheckButton(group,_("Allow root mode"));
194
FXRadioButton* subutton=new FXRadioButton(group,_("Authentication using su (uses root password)"),this,ID_SU_CMD);
195
FXRadioButton* sudobutton=new FXRadioButton(group,_("Authentication using sudo (uses user password)"),this,ID_SUDO_CMD);
197
FXbool root_mode=getApp()->reg().readUnsignedEntry("OPTIONS","root_mode",TRUE);
198
rootmode->setCheck(root_mode);
200
if (getuid()==0) // Super user
204
sudobutton->disable();
206
use_sudo=getApp()->reg().readUnsignedEntry("OPTIONS","use_sudo",FALSE);
208
FXbool use_trash_can=getApp()->reg().readUnsignedEntry("OPTIONS","use_trash_can",TRUE);
209
trashcan->setCheck(use_trash_can);
211
if (trashcan->getCheck())
213
FXbool use_trash_bypass=getApp()->reg().readUnsignedEntry("OPTIONS","use_trash_bypass",FALSE);
214
trashbypass->setCheck(use_trash_bypass);
217
trashbypass->disable();
219
FXbool auto_save_layout=getApp()->reg().readUnsignedEntry("OPTIONS","auto_save_layout",TRUE);
220
autosave->setCheck(auto_save_layout);
222
FXbool save_win_pos=getApp()->reg().readUnsignedEntry("SETTINGS","save_win_pos",FALSE);
223
savewinpos->setCheck(save_win_pos);
225
// Single click navigation
226
single_click=getApp()->reg().readUnsignedEntry("SETTINGS","single_click",SINGLE_CLICK_NONE);
227
single_click=getApp()->reg().readUnsignedEntry("SETTINGS","single_click",SINGLE_CLICK_NONE);
228
if (single_click==SINGLE_CLICK_DIR)
230
diropen->setCheck(TRUE);
231
fileopen->setCheck(FALSE);
233
else if (single_click==SINGLE_CLICK_DIR_FILE)
235
diropen->setCheck(TRUE);
236
fileopen->setCheck(TRUE);
240
diropen->setCheck(FALSE);
241
fileopen->setCheck(FALSE);
245
if (file_tooltips==FALSE)
246
filetooltips->setCheck(FALSE);
248
filetooltips->setCheck(TRUE);
251
if (relative_resize==FALSE)
252
relativeresize->setCheck(FALSE);
254
relativeresize->setCheck(TRUE);
256
// Display path linker
257
show_pathlink=getApp()->reg().readUnsignedEntry("SETTINGS","show_pathlinker",TRUE);
258
if (show_pathlink==FALSE)
259
showpathlink->setCheck(FALSE);
261
showpathlink->setCheck(TRUE);
263
#ifdef STARTUP_NOTIFICATION
264
FXbool use_sn=getApp()->reg().readUnsignedEntry("OPTIONS","use_startup_notification",TRUE);
265
usesn->setCheck(use_sn);
268
// Second tab - Dialogs
269
new FXTabItem(tabbook,_("&Dialogs"),NULL);
270
FXVerticalFrame *dialogs=new FXVerticalFrame(tabbook,FRAME_THICK|FRAME_RAISED);
271
group=new FXGroupBox(dialogs,_("Confirmations"),GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
272
ask=new FXCheckButton(group,_("Confirm copy/move/rename/symlink"));
273
dnd=new FXCheckButton(group,_("Confirm drag and drop"));
274
trashmv=new FXCheckButton(group,_("Confirm move to trash/restore from trash"),this,ID_CONFIRM_TRASH);
275
del=new FXCheckButton(group,_("Confirm delete"));
276
del_emptydir=new FXCheckButton(group,_("Confirm delete non empty directories"),this,ID_CONFIRM_DEL_EMPTYDIR);
277
overwrite=new FXCheckButton(group,_("Confirm overwrite"));
278
quit=new FXCheckButton(group,_("Confirm quit"));
280
group=new FXGroupBox(dialogs,_("Warnings"),GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
282
mount=new FXCheckButton (group,_("Warn when mount points are not responding"));
283
show_mount=new FXCheckButton(group, _("Display mount/umount success messages"));
285
root_warning=new FXCheckButton (group,_("Warn if running as root"));
287
FXbool confirm_quit=getApp()->reg().readUnsignedEntry("OPTIONS","confirm_quit",TRUE);
288
quit->setCheck(confirm_quit);
289
FXbool confirm_trash=getApp()->reg().readUnsignedEntry("OPTIONS","confirm_trash",TRUE);
290
trashmv->setCheck(confirm_trash);
291
FXbool confirm_del=getApp()->reg().readUnsignedEntry("OPTIONS","confirm_delete",TRUE);
292
del->setCheck(confirm_del);
293
FXbool confirm_del_emptydir=getApp()->reg().readUnsignedEntry("OPTIONS","confirm_delete_emptydir",TRUE);
294
del_emptydir->setCheck(confirm_del_emptydir);
295
FXbool confirm_overwrite=getApp()->reg().readUnsignedEntry("OPTIONS","confirm_overwrite",TRUE);
296
overwrite->setCheck(confirm_overwrite);
297
FXbool ask_before_copy=getApp()->reg().readUnsignedEntry("OPTIONS","ask_before_copy",TRUE);
298
ask->setCheck(ask_before_copy);
299
FXbool confirm_dnd=getApp()->reg().readUnsignedEntry("OPTIONS","confirm_drag_and_drop",TRUE);
300
dnd->setCheck(confirm_dnd);
303
FXbool mount_warn=getApp()->reg().readUnsignedEntry("OPTIONS","mount_warn",FALSE);
304
FXbool mount_messages=getApp()->reg().readUnsignedEntry("OPTIONS","mount_messages",TRUE);
305
mount->setCheck(mount_warn);
306
show_mount->setCheck(mount_messages);
309
FXbool root_warn=getApp()->reg().readUnsignedEntry("OPTIONS","root_warn",TRUE);
310
if(getuid()) // Simple user
311
root_warning->disable();
313
root_warning->setCheck(root_warn);
315
// Third tab - Programs
316
new FXTabItem(tabbook,_("&Programs"),NULL);
317
FXVerticalFrame *programs=new FXVerticalFrame(tabbook,FRAME_THICK|FRAME_RAISED);
318
group=new FXGroupBox(programs,_("Default programs"),GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
319
matrix = new FXMatrix(group,3,MATRIX_BY_COLUMNS|LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y);
321
new FXLabel(matrix,_("Text editor:"),NULL,JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
322
txteditor = new FXTextField(matrix,30,NULL,0,FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X);
323
new FXButton(matrix,_("\tSelect file..."),filedialogicon,this,ID_BROWSE_TXTEDIT,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y,0,0,0,0,20,20);
324
oldtxteditor=getApp()->reg().readStringEntry("PROGS","txteditor",DEFAULT_TXTEDITOR);
325
txteditor->setText(oldtxteditor);
327
new FXLabel(matrix,_("Text viewer:"),NULL,JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
328
txtviewer = new FXTextField(matrix,30,NULL,0,FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X);
329
new FXButton(matrix,_("\tSelect file..."),filedialogicon,this,ID_BROWSE_TXTVIEW,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y,0,0,0,0,20,20);
330
oldtxtviewer=getApp()->reg().readStringEntry("PROGS","txtviewer",DEFAULT_TXTVIEWER);
331
txtviewer->setText(oldtxtviewer);
333
new FXLabel(matrix,_("Image editor:"),NULL,JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
334
imgeditor = new FXTextField(matrix,30,NULL,0,FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X);
335
new FXButton(matrix,_("\tSelect file..."),filedialogicon,this,ID_BROWSE_IMGVIEW,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y,0,0,0,0,20,20);
336
oldimgeditor=getApp()->reg().readStringEntry("PROGS","imgeditor",DEFAULT_IMGEDITOR);
337
imgeditor->setText(oldimgeditor);
339
new FXLabel(matrix,_("Image viewer:"),NULL,JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
340
imgviewer = new FXTextField(matrix,30,NULL,0,FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X);
341
new FXButton(matrix,_("\tSelect file..."),filedialogicon,this,ID_BROWSE_IMGVIEW,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y,0,0,0,0,20,20);
342
oldimgviewer=getApp()->reg().readStringEntry("PROGS","imgviewer",DEFAULT_IMGVIEWER);
343
imgviewer->setText(oldimgviewer);
345
new FXLabel(matrix,_("Archiver:"),NULL,JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
346
archiver = new FXTextField(matrix,30,NULL,0,FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X);
347
new FXButton(matrix,_("\tSelect file..."),filedialogicon,this,ID_BROWSE_ARCHIVER,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y,0,0,0,0,20,20);
348
oldarchiver=getApp()->reg().readStringEntry("PROGS","archiver",DEFAULT_ARCHIVER);
349
archiver->setText(oldarchiver);
351
new FXLabel(matrix,_("Pdf viewer:"),NULL,JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
352
pdfviewer = new FXTextField(matrix,30,NULL,0,FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X);
353
new FXButton(matrix,_("\tSelect file..."),filedialogicon,this,ID_BROWSE_PDFVIEW,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y,0,0,0,0,20,20);
354
oldpdfviewer=getApp()->reg().readStringEntry("PROGS","pdfviewer",DEFAULT_PDFVIEWER);
355
pdfviewer->setText(oldpdfviewer);
357
new FXLabel(matrix,_("Audio player:"),NULL,JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
358
audioviewer = new FXTextField(matrix,30,NULL,0,FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X);
359
new FXButton(matrix,_("\tSelect file..."),filedialogicon,this,ID_BROWSE_AUDIOVIEW,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y,0,0,0,0,20,20);
360
oldaudioviewer=getApp()->reg().readStringEntry("PROGS","audioviewer",DEFAULT_AUDIOVIEWER);
361
audioviewer->setText(oldaudioviewer);
363
new FXLabel(matrix,_("Video player:"),NULL,JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
364
videoviewer = new FXTextField(matrix,30,NULL,0,FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X);
365
new FXButton(matrix,_("\tSelect file..."),filedialogicon,this,ID_BROWSE_VIDEOVIEW,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y,0,0,0,0,20,20);
366
oldvideoviewer=getApp()->reg().readStringEntry("PROGS","videoviewer",DEFAULT_VIDEOVIEWER);
367
videoviewer->setText(oldvideoviewer);
369
new FXLabel(matrix,_("Terminal:"),NULL,JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
370
xterm = new FXTextField(matrix,30,NULL,0,FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X);
371
new FXButton(matrix,_("\tSelect file..."),filedialogicon,this,ID_BROWSE_XTERM,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y,0,0,0,0,20,20);
372
oldxterm=getApp()->reg().readStringEntry("PROGS","xterm",DEFAULT_TERMINAL);
373
xterm->setText(oldxterm);
375
// Fourth tab - Visual
376
new FXTabItem(tabbook,_("&Themes"),NULL);
377
FXVerticalFrame *visual=new FXVerticalFrame(tabbook,FRAME_THICK|FRAME_RAISED);
378
FXGroupBox *themes=new FXGroupBox(visual,_("Color theme"),GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
379
FXPacker *pack = new FXPacker(themes,FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_Y|LAYOUT_FILL_X,0,0,0,0, 0,0,0,0);
380
themesList = new FXList(pack,this,ID_THEME,LIST_BROWSESELECT|FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y);
381
themesList->setNumVisible(7);
382
for(int i=0;i<NUM_THEMES;i++)
383
themesList->appendItem(Themes[i].name);
384
themesList->setCurrentItem(0);
386
FXGroupBox *colors=new FXGroupBox(visual,_("Custom colors"),GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X);
387
FXMatrix *matrix3 = new FXMatrix(colors,2,MATRIX_BY_COLUMNS|LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y);
388
colorsBox = new FXComboBox(matrix3,NUM_COLORS,NULL,0,COMBOBOX_STATIC|FRAME_SUNKEN|LAYOUT_FILL_X|LAYOUT_SIDE_RIGHT|LAYOUT_CENTER_Y);
389
colorsBox->setNumVisible(NUM_COLORS);
390
cwell=new FXColorWell(matrix3,FXRGB(0,0,0),this,ID_COLOR,LAYOUT_FILL_X|LAYOUT_FILL_COLUMN|LAYOUT_FILL_Y,0,0,0,0, 10,10,0,0);
391
cwell->setTipText(_("Double click to customize the color"));
393
colorsBox->appendItem(_("Base color"));
394
colorsBox->appendItem(_("Border color"));
395
colorsBox->appendItem(_("Background color"));
396
colorsBox->appendItem(_("Text color"));
397
colorsBox->appendItem(_("Selection background color"));
398
colorsBox->appendItem(_("Selection text color"));
399
colorsBox->appendItem(_("File list background color"));
400
colorsBox->appendItem(_("File list text color"));
401
colorsBox->appendItem(_("File list highlight color"));
402
colorsBox->appendItem(_("Progress bar color"));
403
colorsBox->appendItem(_("Attention color"));
404
colorsBox->setCurrentItem(0);
407
FXGroupBox *button=new FXGroupBox(visual,_("Controls"),GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
408
use_clearlooks=getApp()->reg().readUnsignedEntry("SETTINGS","use_clearlooks",TRUE);
409
new FXRadioButton(button,_("Standard (classic controls)"),this,ID_STANDARD_CONTROLS);
410
new FXRadioButton(button,_("Clearlooks (modern looking controls)"),this,ID_CLEARLOOKS_CONTROLS);
412
// Find iconpath from the Xfe registry settings or set it to DEFAULTICONPATH
413
FXGroupBox *group2=new FXGroupBox(visual,_("Icon theme path"),GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X);
414
FXMatrix *matrix2 = new FXMatrix(group2,2,MATRIX_BY_COLUMNS|LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y);
415
iconpath = new FXTextField(matrix2,40,NULL,0,FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X);
416
new FXButton(matrix2,_("\tSelect path..."),filedialogicon,this,ID_BROWSE_ICON_PATH,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y,0,0,0,0,20,20);
417
oldiconpath=getApp()->reg().readStringEntry("SETTINGS","iconpath",DEFAULTICONPATH);
418
iconpath->setText(oldiconpath);
421
new FXTabItem(tabbook,_("&Fonts"),NULL);
422
FXVerticalFrame *fonts=new FXVerticalFrame(tabbook,FRAME_THICK|FRAME_RAISED);
423
FXGroupBox *fgroup=new FXGroupBox(fonts,_("Fonts"),GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
425
FXMatrix *fmatrix = new FXMatrix(fgroup,3,MATRIX_BY_COLUMNS|LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y);
426
new FXLabel(fmatrix,_("Normal font:"),NULL,JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
427
normalfont = new FXTextField(fmatrix,30,NULL,0,FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X);
428
new FXButton(fmatrix,_(" Select..."),NULL,this,ID_NORMALFONT,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y);//,0,0,0,0,20,20);
429
oldnormalfont=getApp()->reg().readStringEntry("SETTINGS","font","Helvetica,100,normal,regular");
430
normalfont->setText(oldnormalfont);
432
new FXLabel(fmatrix,_("Text font:"),NULL,JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
433
textfont = new FXTextField(fmatrix,30,NULL,0,FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X);
434
new FXButton(fmatrix,_(" Select..."),NULL,this,ID_TEXTFONT,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y);//0,0,0,0,20,20);
435
oldtextfont=getApp()->reg().readStringEntry("SETTINGS","textfont","Helvetica,100,normal,regular");
436
textfont->setText(oldtextfont);
438
// Sixth tab - Key bindings
439
new FXTabItem(tabbook,_("&Key Bindings"),NULL);
440
FXVerticalFrame *keybindings=new FXVerticalFrame(tabbook,FRAME_THICK|FRAME_RAISED);
441
FXGroupBox *kbgroup=new FXGroupBox(keybindings,_("Key Bindings"),GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
443
FXPacker *kbpack = new FXPacker(kbgroup,LAYOUT_FILL_X);
444
new FXButton(kbpack,_("Modify key bindings..."),minikeybindingsicon,this,ID_CHANGE_KEYBINDINGS,FRAME_RAISED|FRAME_THICK|ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP|LAYOUT_FILL_X);//,0,0,0,0,20,20);
445
new FXButton(kbpack,_("Restore default key bindings..."),reloadicon,this,ID_RESTORE_KEYBINDINGS,FRAME_RAISED|FRAME_THICK|ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP|LAYOUT_FILL_X);//,0,0,0,0,20,20);
449
glbBindingsDict=NULL;
450
xfeBindingsDict=NULL;
451
xfiBindingsDict=NULL;
452
xfwBindingsDict=NULL;
456
long PreferencesBox::onUpdColor(FXObject* o,FXSelector s,void* p)
458
FXColorWell *cwell = (FXColorWell*)o;
459
int i = colorsBox->getCurrentItem();
460
cwell->setRGBA(currTheme.color[i]);
466
long PreferencesBox::onCmdColor(FXObject* o,FXSelector s,void* p)
468
FXColorWell *cwell = (FXColorWell*)o;
469
int i = colorsBox->getCurrentItem();
470
currTheme.color[i] = cwell->getRGBA();
476
long PreferencesBox::onCmdTheme(FXObject* o,FXSelector s,void* p)
478
currTheme = Themes[themesList->getCurrentItem()];
483
long PreferencesBox::onCmdBrowsePath(FXObject* o,FXSelector s,void* p)
485
FileDialog browse(this,_("Select an icon theme folder or an icon file"));
486
browse.setSelectMode(SELECT_FILE_MIXED);
487
browse.setDirectory(iconpath->getText());
490
FXString path=browse.getFilename();
492
iconpath->setText(FXPath::directory(path).text());
494
iconpath->setText(path);
500
long PreferencesBox::onCmdBrowse(FXObject* o,FXSelector s,void* p)
502
FileDialog browse(this,_("Select an executable file"));
503
const FXchar *patterns[]=
505
_("All files"), "*",NULL
507
browse.setFilename(ROOTDIR);
508
browse.setPatternList(patterns);
509
browse.setSelectMode(SELECT_FILE_EXISTING);
512
FXString path=browse.getFilename();
516
case ID_BROWSE_TXTEDIT:
517
txteditor->setText(FXPath::name(path));
519
case ID_BROWSE_TXTVIEW:
520
txtviewer->setText(FXPath::name(path));
522
case ID_BROWSE_IMGVIEW:
523
imgviewer->setText(FXPath::name(path));
525
case ID_BROWSE_ARCHIVER:
526
archiver->setText(FXPath::name(path));
528
case ID_BROWSE_PDFVIEW:
529
pdfviewer->setText(FXPath::name(path));
531
case ID_BROWSE_AUDIOVIEW:
532
audioviewer->setText(FXPath::name(path));
534
case ID_BROWSE_VIDEOVIEW:
535
videoviewer->setText(FXPath::name(path));
537
case ID_BROWSE_XTERM:
538
xterm->setText(FXPath::name(path));
545
// Change normal font
546
long PreferencesBox::onCmdNormalFont(FXObject*,FXSelector,void*)
548
FontDialog fontdlg(this,_("Change Normal Font"),DECOR_BORDER|DECOR_TITLE);
552
fontspec=getApp()->reg().readStringEntry("SETTINGS","font","Helvetica,100,normal,regular");
553
FXFont* nfont=new FXFont(getApp(),fontspec);
555
nfont->getFontDesc(fontdesc);
557
fontdlg.setFontSelection(fontdesc);
558
if(fontdlg.execute())
560
fontdlg.getFontSelection(fontdesc);
561
nfont->setFontDesc(fontdesc);
562
fontspec=nfont->getFont();
563
normalfont->setText(fontspec);
569
long PreferencesBox::onCmdTextFont(FXObject*,FXSelector,void*)
571
FontDialog fontdlg(this,_("Change Text Font"),DECOR_BORDER|DECOR_TITLE);
574
fontspec=getApp()->reg().readStringEntry("SETTINGS","textfont","Helvetica,100,normal,regular");
575
FXFont* tfont=new FXFont(getApp(),fontspec);
577
tfont->getFontDesc(fontdesc);
578
fontdlg.setFontSelection(fontdesc);
579
if(fontdlg.execute())
581
fontdlg.getFontSelection(fontdesc);
582
tfont->setFontDesc(fontdesc);
583
fontspec=tfont->getFont();
584
textfont->setText(fontspec);
590
// Change key bindings
591
long PreferencesBox::onCmdChangeKeyBindings(FXObject*,FXSelector,void*)
595
// String dictionary used to store global key bindings
596
if (glbBindingsDict==NULL)
597
glbBindingsDict=new FXStringDict();
599
key=getApp()->reg().readStringEntry("KEYBINDINGS","go_back","Ctrl-Backspace");
600
str=_("Go to previous directory")+TAB+key;
601
glbBindingsDict->insert("go_back",str.text());
603
key=getApp()->reg().readStringEntry("KEYBINDINGS","go_forward","Shift-Backspace");
604
str=_("Go to next directory")+TAB+key;
605
glbBindingsDict->insert("go_forward",str.text());
607
key=getApp()->reg().readStringEntry("KEYBINDINGS","go_up","Backspace");
608
str=_("Go to parent directory")+TAB+key;
609
glbBindingsDict->insert("go_up",str.text());
611
key=getApp()->reg().readStringEntry("KEYBINDINGS","go_home","Ctrl-H");
612
str=_("Go to home directory")+TAB+key;
613
glbBindingsDict->insert("go_home",str.text());
615
key=getApp()->reg().readStringEntry("KEYBINDINGS","new_file","F2");
616
str=_("Create new file")+TAB+key;
617
glbBindingsDict->insert("new_file",str.text());
619
key=getApp()->reg().readStringEntry("KEYBINDINGS","new_folder","F7");
620
str=_("Create new folder")+TAB+key;
621
glbBindingsDict->insert("new_folder",str.text());
623
key=getApp()->reg().readStringEntry("KEYBINDINGS","copy","Ctrl-C");
624
str=_("Copy to clipboard")+TAB+key;
625
glbBindingsDict->insert("copy",str.text());
627
key=getApp()->reg().readStringEntry("KEYBINDINGS","cut","Ctrl-X");
628
str=_("Cut to clipboard")+TAB+key;
629
glbBindingsDict->insert("cut",str.text());
631
key=getApp()->reg().readStringEntry("KEYBINDINGS","paste","Ctrl-V");
632
str=_("Paste from clipboard")+TAB+key;
633
glbBindingsDict->insert("paste",str.text());
635
key=getApp()->reg().readStringEntry("KEYBINDINGS","big_icons","F10");
636
str=_("Big icon list")+TAB+key;
637
glbBindingsDict->insert("big_icons",str.text());
639
key=getApp()->reg().readStringEntry("KEYBINDINGS","small_icons","F11");
640
str=_("Small icon list")+TAB+key;
641
glbBindingsDict->insert("small_icons",str.text());
643
key=getApp()->reg().readStringEntry("KEYBINDINGS","detailed_file_list","F12");
644
str=_("Detailed file list")+TAB+key;
645
glbBindingsDict->insert("detailed_file_list",str.text());
647
key=getApp()->reg().readStringEntry("KEYBINDINGS","open","Ctrl-O");
648
str=_("Open file")+TAB+key;
649
glbBindingsDict->insert("open",str.text());
651
key=getApp()->reg().readStringEntry("KEYBINDINGS","quit","Ctrl-Q");
652
str=_("Quit application")+TAB+key;
653
glbBindingsDict->insert("quit",str.text());
655
key=getApp()->reg().readStringEntry("KEYBINDINGS","select_all","Ctrl-A");
656
str=_("Select all")+TAB+key;
657
glbBindingsDict->insert("select_all",str.text());
659
key=getApp()->reg().readStringEntry("KEYBINDINGS","deselect_all","Ctrl-Z");
660
str=_("Deselect all")+TAB+key;
661
glbBindingsDict->insert("deselect_all",str.text());
663
key=getApp()->reg().readStringEntry("KEYBINDINGS","invert_selection","Ctrl-I");
664
str=_("Invert selection")+TAB+key;
665
glbBindingsDict->insert("invert_selection",str.text());
667
key=getApp()->reg().readStringEntry("KEYBINDINGS","help","F1");
668
str=_("Display help")+TAB+key;
669
glbBindingsDict->insert("help",str.text());
671
key=getApp()->reg().readStringEntry("KEYBINDINGS","hidden_files","Ctrl-F6");
672
str=_("Toggle display hidden files")+TAB+key;
673
glbBindingsDict->insert("hidden_files",str.text());
675
key=getApp()->reg().readStringEntry("KEYBINDINGS","thumbnails","Ctrl-F7");
676
str=_("Toggle display thumbnails")+TAB+key;
677
glbBindingsDict->insert("thumbnails",str.text());
679
key=getApp()->reg().readStringEntry("KEYBINDINGS","go_work","Shift-F2");
680
str=_("Go to working directory")+TAB+key;
681
glbBindingsDict->insert("go_work",str.text());
683
key=getApp()->reg().readStringEntry("KEYBINDINGS","close","Ctrl-W");
684
str=_("Close window")+TAB+key;
685
glbBindingsDict->insert("close",str.text());
687
key=getApp()->reg().readStringEntry("KEYBINDINGS","print","Ctrl-P");
688
str=_("Print file")+TAB+key;
689
glbBindingsDict->insert("print",str.text());
691
key=getApp()->reg().readStringEntry("KEYBINDINGS","search","Ctrl-F");
692
str=_("Search")+TAB+key;
693
glbBindingsDict->insert("search",str.text());
695
key=getApp()->reg().readStringEntry("KEYBINDINGS","search_prev","Shift-Ctrl-G");
696
str=_("Search previous")+TAB+key;
697
glbBindingsDict->insert("search_prev",str.text());
699
key=getApp()->reg().readStringEntry("KEYBINDINGS","search_next","Ctrl-G");
700
str=_("Search next")+TAB+key;
701
glbBindingsDict->insert("search_next",str.text());
704
// Key bindings specific to X File Explorer (Xfe)
705
if (xfeBindingsDict==NULL)
706
xfeBindingsDict=new FXStringDict();
708
key=getApp()->reg().readStringEntry("KEYBINDINGS","refresh","Ctrl-R");
709
str=_("Refresh panels")+TAB+key;
710
xfeBindingsDict->insert("refresh",str.text());
712
key=getApp()->reg().readStringEntry("KEYBINDINGS","new_symlink","Ctrl-J");
713
str=_("Create new symbolic link")+TAB+key;
714
xfeBindingsDict->insert("new_symlink",str.text());
716
key=getApp()->reg().readStringEntry("KEYBINDINGS","properties","F9");
717
str=_("File properties")+TAB+key;
718
xfeBindingsDict->insert("properties",str.text());
720
key=getApp()->reg().readStringEntry("KEYBINDINGS","move_to_trash","Del");
721
str=_("Move files to trash")+TAB+key;
722
xfeBindingsDict->insert("move_to_trash",str.text());
724
key=getApp()->reg().readStringEntry("KEYBINDINGS","restore_from_trash","Alt-Del");
725
str=_("Restore files from trash")+TAB+key;
726
xfeBindingsDict->insert("restore_from_trash",str.text());
728
key=getApp()->reg().readStringEntry("KEYBINDINGS","delete","Shift-Del");
729
str=_("Delete files")+TAB+key;
730
xfeBindingsDict->insert("delete",str.text());
732
key=getApp()->reg().readStringEntry("KEYBINDINGS","new_window","F3");
733
str=_("Create new window")+TAB+key;
734
xfeBindingsDict->insert("new_window",str.text());
736
key=getApp()->reg().readStringEntry("KEYBINDINGS","new_root_window","Shift-F3");
737
str=_("Create new root window")+TAB+key;
738
xfeBindingsDict->insert("new_root_window",str.text());
740
key=getApp()->reg().readStringEntry("KEYBINDINGS","execute_command","Ctrl-E");
741
str=_("Execute command")+TAB+key;
742
xfeBindingsDict->insert("execute_command",str.text());
744
key=getApp()->reg().readStringEntry("KEYBINDINGS","terminal","Ctrl-T");
745
str=_("Launch terminal")+TAB+key;
746
xfeBindingsDict->insert("terminal",str.text());
749
key=getApp()->reg().readStringEntry("KEYBINDINGS","mount","Ctrl-M");
750
str=_("Mount file system (Linux only)")+TAB+key;
751
xfeBindingsDict->insert("mount",str.text());
753
key=getApp()->reg().readStringEntry("KEYBINDINGS","unmount","Ctrl-U");
754
str=_("Unmount file system (Linux only)")+TAB+key;
755
xfeBindingsDict->insert("unmount",str.text());
758
key=getApp()->reg().readStringEntry("KEYBINDINGS","one_panel","Ctrl-F1");
759
str=_("One panel mode")+TAB+key;
760
xfeBindingsDict->insert("one_panel",str.text());
762
key=getApp()->reg().readStringEntry("KEYBINDINGS","tree_panel","Ctrl-F2");
763
str=_("Tree and panel mode")+TAB+key;
764
xfeBindingsDict->insert("tree_panel",str.text());
766
key=getApp()->reg().readStringEntry("KEYBINDINGS","two_panels","Ctrl-F3");
767
str=_("Two panels mode")+TAB+key;
768
xfeBindingsDict->insert("two_panels",str.text());
770
key=getApp()->reg().readStringEntry("KEYBINDINGS","tree_two_panels","Ctrl-F4");
771
str=_("Tree and two panels mode")+TAB+key;
772
xfeBindingsDict->insert("tree_two_panels",str.text());
774
key=getApp()->reg().readStringEntry("KEYBINDINGS","clear_location","Ctrl-L");
775
str=_("Clear location bar")+TAB+key;
776
xfeBindingsDict->insert("clear_location",str.text());
778
key=getApp()->reg().readStringEntry("KEYBINDINGS","rename","Ctrl-N");
779
str=_("Rename file")+TAB+key;
780
xfeBindingsDict->insert("rename",str.text());
782
key=getApp()->reg().readStringEntry("KEYBINDINGS","copy_to","F5");
783
str=_("Copy files to location")+TAB+key;
784
xfeBindingsDict->insert("copy_to",str.text());
786
key=getApp()->reg().readStringEntry("KEYBINDINGS","move_to","F6");
787
str=_("Move files to location")+TAB+key;
788
xfeBindingsDict->insert("move_to",str.text());
790
key=getApp()->reg().readStringEntry("KEYBINDINGS","symlink_to","Ctrl-S");
791
str=_("Symlink files to location")+TAB+key;
792
xfeBindingsDict->insert("symlink_to",str.text());
794
key=getApp()->reg().readStringEntry("KEYBINDINGS","add_bookmark","Ctrl-B");
795
str=_("Add bookmark")+TAB+key;
796
xfeBindingsDict->insert("add_bookmark",str.text());
798
key=getApp()->reg().readStringEntry("KEYBINDINGS","synchronize_panels","Ctrl-Y");
799
str=_("Synchronize panels")+TAB+key;
800
xfeBindingsDict->insert("synchronize_panels",str.text());
802
key=getApp()->reg().readStringEntry("KEYBINDINGS","switch_panels","Ctrl-K");
803
str=_("Switch panels")+TAB+key;
804
xfeBindingsDict->insert("switch_panels",str.text());
806
key=getApp()->reg().readStringEntry("KEYBINDINGS","go_to_trash","Ctrl-F8");
807
str=_("Go to trash can")+TAB+key;
808
xfeBindingsDict->insert("go_to_trash",str.text());
810
key=getApp()->reg().readStringEntry("KEYBINDINGS","empty_trash_can","Ctrl-Del");
811
str=_("Empty trash can")+TAB+key;
812
xfeBindingsDict->insert("empty_trash_can",str.text());
814
key=getApp()->reg().readStringEntry("KEYBINDINGS","view","Shift-F4");
815
str=_("View")+TAB+key;
816
xfeBindingsDict->insert("view",str.text());
818
key=getApp()->reg().readStringEntry("KEYBINDINGS","edit","F4");
819
str=_("Edit")+TAB+key;
820
xfeBindingsDict->insert("edit",str.text());
822
key=getApp()->reg().readStringEntry("KEYBINDINGS","hidden_dirs","Ctrl-F5");
823
str=_("Toggle display hidden directories")+TAB+key;
824
xfeBindingsDict->insert("hidden_dirs",str.text());
826
key=getApp()->reg().readStringEntry("KEYBINDINGS","filter","Ctrl-D");
827
str=_("Filter files")+TAB+key;
828
xfeBindingsDict->insert("filter",str.text());
831
// Key bindings specific to X File Image (Xfi)
832
if (xfiBindingsDict==NULL)
833
xfiBindingsDict=new FXStringDict();
835
key=getApp()->reg().readStringEntry("KEYBINDINGS","zoom_100","Ctrl-I");
836
str=_("Zoom image to 100%")+TAB+key;
837
xfiBindingsDict->insert("zoom_100",str.text());
839
key=getApp()->reg().readStringEntry("KEYBINDINGS","zoom_win","Ctrl-F");
840
str=_("Zoom to fit window")+TAB+key;
841
xfiBindingsDict->insert("zoom_win",str.text());
843
key=getApp()->reg().readStringEntry("KEYBINDINGS","rotate_left","Ctrl-L");
844
str=_("Rotate image to left")+TAB+key;
845
xfiBindingsDict->insert("rotate_left",str.text());
847
key=getApp()->reg().readStringEntry("KEYBINDINGS","rotate_right","Ctrl-R");
848
str=_("Rotate image to right")+TAB+key;
849
xfiBindingsDict->insert("rotate_right",str.text());
851
key=getApp()->reg().readStringEntry("KEYBINDINGS","mirror_horizontally","Ctrl-H");
852
str=_("Mirror image horizontally")+TAB+key;
853
xfiBindingsDict->insert("mirror_horizontally",str.text());
855
key=getApp()->reg().readStringEntry("KEYBINDINGS","mirror_vertically","Ctrl-V");
856
str=_("Mirror image vertically")+TAB+key;
857
xfiBindingsDict->insert("mirror_vertically",str.text());
860
// Key bindings specific to X File Write (Xfw)
861
if (xfwBindingsDict==NULL)
862
xfwBindingsDict=new FXStringDict();
864
key=getApp()->reg().readStringEntry("KEYBINDINGS","new","Ctrl-N");
865
str=_("Create new document")+TAB+key;
866
xfwBindingsDict->insert("new",str.text());
868
key=getApp()->reg().readStringEntry("KEYBINDINGS","save","Ctrl-S");
869
str=_("Save changes to file")+TAB+key;
870
xfwBindingsDict->insert("save",str.text());
872
key=getApp()->reg().readStringEntry("KEYBINDINGS","goto_line","Ctrl-L");
873
str=_("Goto line")+TAB+key;
874
xfwBindingsDict->insert("goto_line",str.text());
876
key=getApp()->reg().readStringEntry("KEYBINDINGS","undo","Ctrl-Z");
877
str=_("Undo last change")+TAB+key;
878
xfwBindingsDict->insert("undo",str.text());
880
key=getApp()->reg().readStringEntry("KEYBINDINGS","redo","Ctrl-Y");
881
str=_("Redo last change")+TAB+key;
882
xfwBindingsDict->insert("redo",str.text());
884
key=getApp()->reg().readStringEntry("KEYBINDINGS","replace","Ctrl-R");
885
str=_("Replace string")+TAB+key;
886
xfwBindingsDict->insert("replace",str.text());
888
key=getApp()->reg().readStringEntry("KEYBINDINGS","word_wrap","Ctrl-K");
889
str=_("Toggle word wrap mode")+TAB+key;
890
xfwBindingsDict->insert("word_wrap",str.text());
892
key=getApp()->reg().readStringEntry("KEYBINDINGS","line_numbers","Ctrl-T");
893
str=_("Toggle line numbers mode")+TAB+key;
894
xfwBindingsDict->insert("line_numbers",str.text());
896
key=getApp()->reg().readStringEntry("KEYBINDINGS","lower_case","Ctrl-U");
897
str=_("Toggle lower case mode")+TAB+key;
898
xfwBindingsDict->insert("lower_case",str.text());
900
key=getApp()->reg().readStringEntry("KEYBINDINGS","upper_case","Shift-Ctrl-U");
901
str=_("Toggle upper case mode")+TAB+key;
902
xfwBindingsDict->insert("upper_case",str.text());
904
// Display the key bindings dialog box
905
if (bindingsbox==NULL)
906
bindingsbox=new KeybindingsBox(this,glbBindingsDict,xfeBindingsDict,xfiBindingsDict,xfwBindingsDict);
908
bindingsbox->execute(PLACEMENT_SCREEN);
914
// Restore default key bindings
915
long PreferencesBox::onCmdRestoreKeyBindings(FXObject*,FXSelector,void*)
917
// Confirmation message
918
FXString message=_("Do you really want to restore the default key bindings?\n\nAll your customizations will be lost!");
919
MessageBox box(this,_("Restore default key bindings"),message,keybindingsicon,BOX_OK_CANCEL|DECOR_TITLE|DECOR_BORDER);
920
if(box.execute(PLACEMENT_CURSOR) != BOX_CLICKED_OK)
923
// Write default key bindings to the registry
925
// Global key bindings
926
getApp()->reg().writeStringEntry("KEYBINDINGS","go_back","Ctrl-Backspace");
927
getApp()->reg().writeStringEntry("KEYBINDINGS","go_forward","Shift-Backspace");
928
getApp()->reg().writeStringEntry("KEYBINDINGS","go_up","Backspace");
929
getApp()->reg().writeStringEntry("KEYBINDINGS","go_home","Ctrl-H");
930
getApp()->reg().writeStringEntry("KEYBINDINGS","new_file","F2");
931
getApp()->reg().writeStringEntry("KEYBINDINGS","new_folder","F7");
932
getApp()->reg().writeStringEntry("KEYBINDINGS","copy","Ctrl-C");
933
getApp()->reg().writeStringEntry("KEYBINDINGS","cut","Ctrl-X");
934
getApp()->reg().writeStringEntry("KEYBINDINGS","paste","Ctrl-V");
935
getApp()->reg().writeStringEntry("KEYBINDINGS","big_icons","F10");
936
getApp()->reg().writeStringEntry("KEYBINDINGS","small_icons","F11");
937
getApp()->reg().writeStringEntry("KEYBINDINGS","detailed_file_list","F12");
938
getApp()->reg().writeStringEntry("KEYBINDINGS","open","Ctrl-O");
939
getApp()->reg().writeStringEntry("KEYBINDINGS","quit","Ctrl-Q");
940
getApp()->reg().writeStringEntry("KEYBINDINGS","select_all","Ctrl-A");
941
getApp()->reg().writeStringEntry("KEYBINDINGS","deselect_all","Ctrl-Z");
942
getApp()->reg().writeStringEntry("KEYBINDINGS","invert_selection","Ctrl-I");
943
getApp()->reg().writeStringEntry("KEYBINDINGS","help","F1");
944
getApp()->reg().writeStringEntry("KEYBINDINGS","hidden_files","Ctrl-F6");
945
getApp()->reg().writeStringEntry("KEYBINDINGS","thumbnails","Ctrl-F7");
946
getApp()->reg().writeStringEntry("KEYBINDINGS","go_work","Shift-F2");
947
getApp()->reg().writeStringEntry("KEYBINDINGS","close","Ctrl-W");
948
getApp()->reg().writeStringEntry("KEYBINDINGS","print","Ctrl-P");
949
getApp()->reg().writeStringEntry("KEYBINDINGS","search","Ctrl-F");
950
getApp()->reg().writeStringEntry("KEYBINDINGS","search_prev","Shift-Ctrl-G");
951
getApp()->reg().writeStringEntry("KEYBINDINGS","search_next","Ctrl-G");
953
// Key bindings specific to X File Explorer (Xfe)
954
getApp()->reg().writeStringEntry("KEYBINDINGS","refresh","Ctrl-R");
955
getApp()->reg().writeStringEntry("KEYBINDINGS","new_symlink","Ctrl-J");
956
getApp()->reg().writeStringEntry("KEYBINDINGS","properties","F9");
957
getApp()->reg().writeStringEntry("KEYBINDINGS","move_to_trash","Del");
958
getApp()->reg().writeStringEntry("KEYBINDINGS","restore_from_trash","Alt-Del");
959
getApp()->reg().writeStringEntry("KEYBINDINGS","delete","Shift-Del");
960
getApp()->reg().writeStringEntry("KEYBINDINGS","new_window","F3");
961
getApp()->reg().writeStringEntry("KEYBINDINGS","new_root_window","Shift-F3");
962
getApp()->reg().writeStringEntry("KEYBINDINGS","execute_command","Ctrl-E");
963
getApp()->reg().writeStringEntry("KEYBINDINGS","terminal","Ctrl-T");
965
getApp()->reg().writeStringEntry("KEYBINDINGS","mount","Ctrl-M");
966
getApp()->reg().writeStringEntry("KEYBINDINGS","unmount","Ctrl-U");
968
getApp()->reg().writeStringEntry("KEYBINDINGS","one_panel","Ctrl-F1");
969
getApp()->reg().writeStringEntry("KEYBINDINGS","tree_panel","Ctrl-F2");
970
getApp()->reg().writeStringEntry("KEYBINDINGS","two_panels","Ctrl-F3");
971
getApp()->reg().writeStringEntry("KEYBINDINGS","tree_two_panels","Ctrl-F4");
972
getApp()->reg().writeStringEntry("KEYBINDINGS","clear_location","Ctrl-L");
973
getApp()->reg().writeStringEntry("KEYBINDINGS","rename","Ctrl-N");
974
getApp()->reg().writeStringEntry("KEYBINDINGS","copy_to","F5");
975
getApp()->reg().writeStringEntry("KEYBINDINGS","move_to","F6");
976
getApp()->reg().writeStringEntry("KEYBINDINGS","symlink_to","Ctrl-S");
977
getApp()->reg().writeStringEntry("KEYBINDINGS","add_bookmark","Ctrl-B");
978
getApp()->reg().writeStringEntry("KEYBINDINGS","synchronize_panels","Ctrl-Y");
979
getApp()->reg().writeStringEntry("KEYBINDINGS","switch_panels","Ctrl-K");
980
getApp()->reg().writeStringEntry("KEYBINDINGS","go_to_trash","Ctrl-F8");
981
getApp()->reg().writeStringEntry("KEYBINDINGS","empty_trash_can","Ctrl-Del");
982
getApp()->reg().writeStringEntry("KEYBINDINGS","view","Shift-F4");
983
getApp()->reg().writeStringEntry("KEYBINDINGS","edit","F4");
984
getApp()->reg().writeStringEntry("KEYBINDINGS","hidden_dirs","Ctrl-F5");
985
getApp()->reg().writeStringEntry("KEYBINDINGS","filter","Ctrl-D");
987
// Key bindings specific to X File Image (Xfi)
988
getApp()->reg().writeStringEntry("KEYBINDINGS","zoom_100","Ctrl-I");
989
getApp()->reg().writeStringEntry("KEYBINDINGS","zoom_win","Ctrl-F");
990
getApp()->reg().writeStringEntry("KEYBINDINGS","rotate_left","Ctrl-L");
991
getApp()->reg().writeStringEntry("KEYBINDINGS","rotate_right","Ctrl-R");
992
getApp()->reg().writeStringEntry("KEYBINDINGS","mirror_horizontally","Ctrl-H");
993
getApp()->reg().writeStringEntry("KEYBINDINGS","mirror_vertically","Ctrl-V");
995
// Key bindings specific to X File Write (Xfw)
996
getApp()->reg().writeStringEntry("KEYBINDINGS","new","Ctrl-N");
997
getApp()->reg().writeStringEntry("KEYBINDINGS","save","Ctrl-S");
998
getApp()->reg().writeStringEntry("KEYBINDINGS","goto_line","Ctrl-L");
999
getApp()->reg().writeStringEntry("KEYBINDINGS","undo","Ctrl-Z");
1000
getApp()->reg().writeStringEntry("KEYBINDINGS","redo","Ctrl-Y");
1001
getApp()->reg().writeStringEntry("KEYBINDINGS","replace","Ctrl-R");
1002
getApp()->reg().writeStringEntry("KEYBINDINGS","word_wrap","Ctrl-K");
1003
getApp()->reg().writeStringEntry("KEYBINDINGS","line_numbers","Ctrl-T");
1004
getApp()->reg().writeStringEntry("KEYBINDINGS","lower_case","Ctrl-U");
1005
getApp()->reg().writeStringEntry("KEYBINDINGS","upper_case","Shift-Ctrl-U");
1007
// Finally, update the registry
1008
getApp()->reg().write();
1010
// Ask the user if he wants to restart Xfe
1011
if(BOX_CLICKED_CANCEL!=MessageBox::question(this,BOX_OK_CANCEL,_("Restart"),_("Key bindings will be changed after restart.\nRestart X File Explorer now?")))
1012
mainWindow->handle(this,FXSEL(SEL_COMMAND,XFileExplorer::ID_RESTART),NULL);
1018
long PreferencesBox::onCmdAccept(FXObject* o,FXSelector s,void* p)
1020
FXbool restart_theme=FALSE;
1021
FXbool restart_scroll=FALSE;
1022
FXbool restart_pathlink=FALSE;
1023
FXbool restart_controls=FALSE;
1024
FXbool restart_normalfont=FALSE;
1025
FXbool restart_textfont=FALSE;
1027
if (iconpath->getText()=="")
1028
iconpath->setText(oldiconpath);
1030
// Icon path has changed
1031
if(oldiconpath != iconpath->getText())
1033
getApp()->reg().writeStringEntry("SETTINGS","iconpath",iconpath->getText().text());
1034
getApp()->reg().write();
1038
// Normal font has changed
1039
if (oldnormalfont != normalfont->getText())
1041
getApp()->reg().writeStringEntry("SETTINGS","font",normalfont->getText().text());
1042
getApp()->reg().write();
1043
restart_normalfont=TRUE;
1046
// Text font has changed
1047
if (oldtextfont != textfont->getText())
1049
getApp()->reg().writeStringEntry("SETTINGS","textfont",textfont->getText().text());
1050
getApp()->reg().write();
1051
restart_textfont=TRUE;
1054
// Text editor has changed
1055
if(oldtxteditor != txteditor->getText())
1057
// Update the txteditor string
1058
FXString newtxteditor=txteditor->getText().text();
1059
getApp()->reg().writeStringEntry("PROGS","txteditor",newtxteditor.text());
1061
// Update each filetype where the old txteditor was used
1062
FXStringDict *strdict = getApp()->reg().find("FILETYPES");
1063
FileDict *assoc=new FileDict(getApp());
1066
FXString key, value, newvalue;
1067
FXString strtmp, open, view, edit, command;
1068
for (i=strdict->first(); i<strdict->size(); i=strdict->next(i))
1070
// Read key and value of each filetype
1071
key=strdict->key(i);
1072
value=strdict->data(i);
1074
// Replace the old txteditor string with the new one
1075
if (value.contains(oldtxteditor))
1077
// Obtain the open, view, edit and command strings
1078
strtmp=value.before(';',1);
1079
command=value.after(';',1);
1080
open=strtmp.section(',',0);
1081
view=strtmp.section(',',1);
1082
edit=strtmp.section(',',2);
1084
// Replace only the open and edit strings, if needed
1085
if (open==oldtxteditor)
1087
if (edit==oldtxteditor)
1090
// Replace with the new value
1091
value=open + "," + view + "," + edit + ";" + command;
1092
assoc->replace(key.text(),value.text());
1097
// Text viewer has changed
1098
if(oldtxtviewer != txtviewer->getText())
1100
// Update the txtviewer string
1101
FXString newtxtviewer=txtviewer->getText().text();
1102
getApp()->reg().writeStringEntry("PROGS","txtviewer",newtxtviewer.text());
1104
// Update each filetype where the old txtviewer was used
1105
FXStringDict *strdict = getApp()->reg().find("FILETYPES");
1106
FileDict *assoc=new FileDict(getApp());
1109
FXString key, value, newvalue;
1110
FXString strtmp, open, view, edit, command;
1111
for (i=strdict->first(); i<strdict->size(); i=strdict->next(i))
1113
// Read key and value of each filetype
1114
key=strdict->key(i);
1115
value=strdict->data(i);
1117
// Replace the old txtviewer string with the new one
1118
if (value.contains(oldtxtviewer))
1120
// Obtain the open, view, edit and command strings
1121
strtmp=value.before(';',1);
1122
command=value.after(';',1);
1123
open=strtmp.section(',',0);
1124
view=strtmp.section(',',1);
1125
edit=strtmp.section(',',2);
1127
// Replace only the view string, if needed
1128
if (view==oldtxtviewer)
1131
// Replace with the new value
1132
value=open + "," + view + "," + edit + ";" + command;
1133
assoc->replace(key.text(),value.text());
1138
// Image editor has changed
1139
if(oldimgeditor != imgeditor->getText())
1141
// Update the imgeditor string
1142
FXString newimgeditor=imgeditor->getText().text();
1143
getApp()->reg().writeStringEntry("PROGS","imgeditor",newimgeditor.text());
1145
// Update each filetype where the old imgeditor was used
1146
FXStringDict *strdict = getApp()->reg().find("FILETYPES");
1147
FileDict *assoc=new FileDict(getApp());
1150
FXString key, value, newvalue;
1151
FXString strtmp, open, view, edit, command;
1152
for (i=strdict->first(); i<strdict->size(); i=strdict->next(i))
1154
// Read key and value of each filetype
1155
key=strdict->key(i);
1156
value=strdict->data(i);
1158
// Replace the old imgeditor string with the new one
1159
if (value.contains(oldimgeditor))
1161
// Obtain the open, view, edit and command strings
1162
strtmp=value.before(';',1);
1163
command=value.after(';',1);
1164
open=strtmp.section(',',0);
1165
view=strtmp.section(',',1);
1166
edit=strtmp.section(',',2);
1168
// Replace only the open and edit strings, if needed
1169
if (open==oldimgeditor)
1171
if (edit==oldimgeditor)
1174
// Replace with the new value
1175
value=open + "," + view + "," + edit + ";" + command;
1176
assoc->replace(key.text(),value.text());
1181
// Image viewer has changed
1182
if(oldimgviewer != imgviewer->getText())
1184
// Update the imgviewer string
1185
FXString newimgviewer=imgviewer->getText().text();
1186
getApp()->reg().writeStringEntry("PROGS","imgviewer",newimgviewer.text());
1188
// Update each filetype where the old imgviewer was used
1189
FXStringDict *strdict = getApp()->reg().find("FILETYPES");
1190
FileDict *assoc=new FileDict(getApp());
1193
FXString key, value, newvalue;
1194
FXString strtmp, open, view, edit, command;
1195
for (i=strdict->first(); i<strdict->size(); i=strdict->next(i))
1197
// Read key and value of each filetype
1198
key=strdict->key(i);
1199
value=strdict->data(i);
1201
// Replace the old imgviewer string with the new one
1202
if (value.contains(oldimgviewer))
1204
// Obtain the open, view, edit and command strings
1205
strtmp=value.before(';',1);
1206
command=value.after(';',1);
1207
open=strtmp.section(',',0);
1208
view=strtmp.section(',',1);
1209
edit=strtmp.section(',',2);
1211
// Replace the open and view string, if needed
1212
if (open==oldimgviewer)
1214
if (view==oldimgviewer)
1217
// Replace with the new value
1218
value=open + "," + view + "," + edit + ";" + command;
1219
assoc->replace(key.text(),value.text());
1224
// Archiver has changed
1225
if(oldarchiver != archiver->getText())
1227
// Update the archiver string
1228
FXString newarchiver=archiver->getText().text();
1229
getApp()->reg().writeStringEntry("PROGS","archiver",newarchiver.text());
1231
// Update each filetype where the old archiver was used
1232
FXStringDict *strdict = getApp()->reg().find("FILETYPES");
1233
FileDict *assoc=new FileDict(getApp());
1236
FXString key, value, newvalue;
1237
FXString strtmp, open, view, edit, command;
1238
for (i=strdict->first(); i<strdict->size(); i=strdict->next(i))
1240
// Read key and value of each filetype
1241
key=strdict->key(i);
1242
value=strdict->data(i);
1244
// Replace the old archiver string with the new one
1245
if (value.contains(oldarchiver))
1247
// Obtain the open, view, edit and command strings
1248
strtmp=value.before(';',1);
1249
command=value.after(';',1);
1250
open=strtmp.section(',',0);
1251
view=strtmp.section(',',1);
1252
edit=strtmp.section(',',2);
1254
// Replace the open, view and edit strings, if needed
1255
if (open==oldarchiver)
1257
if (view==oldarchiver)
1259
if (edit==oldarchiver)
1262
// Replace with the new value
1263
value=open + "," + view + "," + edit + ";" + command;
1264
assoc->replace(key.text(),value.text());
1269
// PDF viewer has changed
1270
if(oldpdfviewer != pdfviewer->getText())
1272
// Update the PDF viewer string
1273
FXString newpdfviewer=pdfviewer->getText().text();
1274
getApp()->reg().writeStringEntry("PROGS","pdfviewer",newpdfviewer.text());
1276
// Update each filetype where the old PDF viewer was used
1277
FXStringDict *strdict = getApp()->reg().find("FILETYPES");
1278
FileDict *assoc=new FileDict(getApp());
1281
FXString key, value, newvalue;
1282
FXString strtmp, open, view, edit, command;
1283
for (i=strdict->first(); i<strdict->size(); i=strdict->next(i))
1285
// Read key and value of each filetype
1286
key=strdict->key(i);
1287
value=strdict->data(i);
1289
// Replace the old PDF viewer string with the new one
1290
if (value.contains(oldpdfviewer))
1292
// Obtain the open, view, edit and command strings
1293
strtmp=value.before(';',1);
1294
command=value.after(';',1);
1295
open=strtmp.section(',',0);
1296
view=strtmp.section(',',1);
1297
edit=strtmp.section(',',2);
1299
// Replace the open, view and edit strings, if needed
1300
if (open==oldpdfviewer)
1302
if (view==oldpdfviewer)
1304
if (edit==oldpdfviewer)
1307
// Replace with the new value
1308
value=open + "," + view + "," + edit + ";" + command;
1309
assoc->replace(key.text(),value.text());
1314
// Audio viewer has changed
1315
if(oldaudioviewer != audioviewer->getText())
1317
// Update the audio viewer string
1318
FXString newaudioviewer=audioviewer->getText().text();
1319
getApp()->reg().writeStringEntry("PROGS","audioviewer",newaudioviewer.text());
1321
// Update each filetype where the old audio viewer was used
1322
FXStringDict *strdict = getApp()->reg().find("FILETYPES");
1323
FileDict *assoc=new FileDict(getApp());
1326
FXString key, value, newvalue;
1327
FXString strtmp, open, view, edit, command;
1328
for (i=strdict->first(); i<strdict->size(); i=strdict->next(i))
1330
// Read key and value of each filetype
1331
key=strdict->key(i);
1332
value=strdict->data(i);
1334
// Replace the old audio viewer string with the new one
1335
if (value.contains(oldaudioviewer))
1337
// Obtain the open, view, edit and command strings
1338
strtmp=value.before(';',1);
1339
command=value.after(';',1);
1340
open=strtmp.section(',',0);
1341
view=strtmp.section(',',1);
1342
edit=strtmp.section(',',2);
1344
// Replace the open, view and edit strings, if needed
1345
if (open==oldaudioviewer)
1346
open=newaudioviewer;
1347
if (view==oldaudioviewer)
1348
view=newaudioviewer;
1349
if (edit==oldaudioviewer)
1350
edit=newaudioviewer;
1352
// Replace with the new value
1353
value=open + "," + view + "," + edit + ";" + command;
1354
assoc->replace(key.text(),value.text());
1359
// Video viewer has changed
1360
if(oldvideoviewer != videoviewer->getText())
1362
// Update the video viewer string
1363
FXString newvideoviewer=videoviewer->getText().text();
1364
getApp()->reg().writeStringEntry("PROGS","videoviewer",newvideoviewer.text());
1366
// Update each filetype where the old video viewer was used
1367
FXStringDict *strdict = getApp()->reg().find("FILETYPES");
1368
FileDict *assoc=new FileDict(getApp());
1371
FXString key, value, newvalue;
1372
FXString strtmp, open, view, edit, command;
1373
for (i=strdict->first(); i<strdict->size(); i=strdict->next(i))
1375
// Read key and value of each filetype
1376
key=strdict->key(i);
1377
value=strdict->data(i);
1379
// Replace the old video viewer string with the new one
1380
if (value.contains(oldvideoviewer))
1382
// Obtain the open, view, edit and command strings
1383
strtmp=value.before(';',1);
1384
command=value.after(';',1);
1385
open=strtmp.section(',',0);
1386
view=strtmp.section(',',1);
1387
edit=strtmp.section(',',2);
1389
// Replace the open, view and edit strings, if needed
1390
if (open==oldvideoviewer)
1391
open=newvideoviewer;
1392
if (view==oldvideoviewer)
1393
view=newvideoviewer;
1394
if (edit==oldvideoviewer)
1395
edit=newvideoviewer;
1397
// Replace with the new value
1398
value=open + "," + view + "," + edit + ";" + command;
1399
assoc->replace(key.text(),value.text());
1404
// Terminal has changed
1405
if(oldxterm != xterm->getText())
1406
getApp()->reg().writeStringEntry("PROGS","xterm",xterm->getText().text());
1408
getApp()->reg().writeUnsignedEntry("OPTIONS","auto_save_layout",autosave->getCheck());
1409
getApp()->reg().writeUnsignedEntry("SETTINGS","save_win_pos",savewinpos->getCheck());
1410
getApp()->reg().writeUnsignedEntry("OPTIONS","use_trash_can",trashcan->getCheck());
1411
getApp()->reg().writeUnsignedEntry("OPTIONS","use_trash_bypass",trashbypass->getCheck());
1412
getApp()->reg().writeUnsignedEntry("OPTIONS","ask_before_copy",ask->getCheck());
1413
getApp()->reg().writeUnsignedEntry("SETTINGS","single_click",single_click);
1414
getApp()->reg().writeUnsignedEntry("OPTIONS","confirm_trash",trashmv->getCheck());
1415
getApp()->reg().writeUnsignedEntry("OPTIONS","confirm_delete",del->getCheck());
1416
getApp()->reg().writeUnsignedEntry("OPTIONS","confirm_delete_emptydir",del_emptydir->getCheck());
1417
getApp()->reg().writeUnsignedEntry("OPTIONS","confirm_overwrite",overwrite->getCheck());
1418
getApp()->reg().writeUnsignedEntry("OPTIONS","confirm_quit",quit->getCheck());
1419
getApp()->reg().writeUnsignedEntry("OPTIONS","confirm_drag_and_drop",dnd->getCheck());
1420
getApp()->reg().writeUnsignedEntry("OPTIONS","root_warn",root_warning->getCheck());
1421
getApp()->reg().writeUnsignedEntry("OPTIONS","root_mode",rootmode->getCheck());
1422
#ifdef STARTUP_NOTIFICATION
1423
getApp()->reg().writeUnsignedEntry("OPTIONS","use_startup_notification",usesn->getCheck());
1426
getApp()->reg().writeUnsignedEntry("OPTIONS","mount_warn",mount->getCheck());
1427
getApp()->reg().writeUnsignedEntry("OPTIONS","mount_messages",show_mount->getCheck());
1431
getApp()->reg().writeUnsignedEntry("SETTINGS","smooth_scroll",scroll->getCheck());
1432
if (scroll->getCheck()!=smoothscroll_prev)
1434
getApp()->reg().write();
1435
restart_scroll=TRUE;
1439
getApp()->reg().writeUnsignedEntry("SETTINGS","use_clearlooks",use_clearlooks);
1441
if (use_clearlooks!=use_clearlooks_prev)
1443
FXColor hilitecolor, shadowcolor;
1445
// Change control hilite and shadow colors when the control theme has changed
1446
if (use_clearlooks) // clearlooks
1448
hilitecolor=makeHiliteColorGradient(currTheme.color[0]);
1449
shadowcolor=makeShadowColorGradient(currTheme.color[0]);
1453
hilitecolor=makeHiliteColor(currTheme.color[0]);
1454
shadowcolor=makeShadowColor(currTheme.color[0]);
1456
getApp()->reg().writeColorEntry("SETTINGS","hilitecolor",hilitecolor);
1457
getApp()->reg().writeColorEntry("SETTINGS","shadowcolor",shadowcolor);
1459
getApp()->reg().write();
1460
restart_controls=TRUE;
1463
// Update some global options
1464
if (diropen->getCheck() && fileopen->getCheck())
1465
single_click=SINGLE_CLICK_DIR_FILE;
1466
else if (diropen->getCheck() && !fileopen->getCheck())
1467
single_click=SINGLE_CLICK_DIR;
1469
single_click=SINGLE_CLICK_NONE;
1471
if (single_click==SINGLE_CLICK_DIR_FILE)
1472
((XFileExplorer*) mainWindow)->setDefaultCursor(getApp()->getDefaultCursor(DEF_HAND_CURSOR));
1474
((XFileExplorer*) mainWindow)->setDefaultCursor(getApp()->getDefaultCursor(DEF_ARROW_CURSOR));
1476
// Update the file tooltips flag
1477
if (filetooltips->getCheck())
1480
file_tooltips=FALSE;
1481
getApp()->reg().writeUnsignedEntry("SETTINGS","file_tooltips",(FXuint)file_tooltips);
1483
// Update the relative resize flag
1484
if (relativeresize->getCheck())
1485
relative_resize=TRUE;
1487
relative_resize=FALSE;
1488
getApp()->reg().writeUnsignedEntry("SETTINGS","relative_resize",(FXuint)relative_resize);
1490
// Update the display path linker flag
1491
show_pathlink=showpathlink->getCheck();
1492
getApp()->reg().writeUnsignedEntry("SETTINGS","show_pathlinker",show_pathlink);
1493
if (show_pathlink!=show_pathlink_prev)
1495
getApp()->reg().write();
1496
restart_pathlink=TRUE;
1499
// Theme has changed
1500
if(currTheme != Themes[0])
1502
getApp()->reg().writeColorEntry("SETTINGS","basecolor",currTheme.color[0]);
1503
getApp()->reg().writeColorEntry("SETTINGS","bordercolor",currTheme.color[1]);
1504
getApp()->reg().writeColorEntry("SETTINGS","backcolor",currTheme.color[2]);
1505
getApp()->reg().writeColorEntry("SETTINGS","forecolor",currTheme.color[3]);
1506
getApp()->reg().writeColorEntry("SETTINGS","selbackcolor",currTheme.color[4]);
1507
getApp()->reg().writeColorEntry("SETTINGS","selforecolor",currTheme.color[5]);
1508
getApp()->reg().writeColorEntry("SETTINGS","listbackcolor",currTheme.color[6]);
1509
getApp()->reg().writeColorEntry("SETTINGS","listforecolor",currTheme.color[7]);
1510
getApp()->reg().writeColorEntry("SETTINGS","highlightcolor",currTheme.color[8]);
1511
getApp()->reg().writeColorEntry("SETTINGS","pbarcolor",currTheme.color[9]);
1512
getApp()->reg().writeColorEntry("SETTINGS","attentioncolor",currTheme.color[10]);
1515
FXColor hilitecolor, shadowcolor;
1517
// Change control hilite and shadow colors when the control theme has changed
1518
if (use_clearlooks) // clearlooks
1520
hilitecolor=makeHiliteColorGradient(currTheme.color[0]);
1521
shadowcolor=makeShadowColorGradient(currTheme.color[0]);
1525
hilitecolor=makeHiliteColor(currTheme.color[0]);
1526
shadowcolor=makeShadowColor(currTheme.color[0]);
1528
getApp()->reg().writeColorEntry("SETTINGS","hilitecolor",hilitecolor);
1529
getApp()->reg().writeColorEntry("SETTINGS","shadowcolor",shadowcolor);
1531
getApp()->reg().write();
1535
// Restart application if necessary
1538
if(BOX_CLICKED_CANCEL!=MessageBox::question(this,BOX_OK_CANCEL,_("Restart"),_("Scrolling mode will be changed after restart.\nRestart X File Explorer now?")))
1539
mainWindow->handle(this,FXSEL(SEL_COMMAND,XFileExplorer::ID_RESTART),NULL);
1543
if(BOX_CLICKED_CANCEL!=MessageBox::question(this,BOX_OK_CANCEL,_("Restart"),_("Theme will be changed after restart.\nRestart X File Explorer now?")))
1544
mainWindow->handle(this,FXSEL(SEL_COMMAND,XFileExplorer::ID_RESTART),NULL);
1547
if (restart_pathlink)
1549
if(BOX_CLICKED_CANCEL!=MessageBox::question(this,BOX_OK_CANCEL,_("Restart"),_("Path linker will be changed after restart.\nRestart X File Explorer now?")))
1550
mainWindow->handle(this,FXSEL(SEL_COMMAND,XFileExplorer::ID_RESTART),NULL);
1553
if (restart_controls)
1555
if(BOX_CLICKED_CANCEL!=MessageBox::question(this,BOX_OK_CANCEL,_("Restart"),_("Button style will be changed after restart.\nRestart X File Explorer now?")))
1556
mainWindow->handle(this,FXSEL(SEL_COMMAND,XFileExplorer::ID_RESTART),NULL);
1559
if (restart_normalfont)
1561
if(BOX_CLICKED_CANCEL!=MessageBox::question(this,BOX_OK_CANCEL,_("Restart"),_("Normal font will be changed after restart.\nRestart X File Explorer now?")))
1562
mainWindow->handle(this,FXSEL(SEL_COMMAND,XFileExplorer::ID_RESTART),NULL);
1565
if (restart_textfont)
1567
if(BOX_CLICKED_CANCEL!=MessageBox::question(this,BOX_OK_CANCEL,_("Restart"),_("Text font will be changed after restart.\nRestart X File Explorer now?")))
1568
mainWindow->handle(this,FXSEL(SEL_COMMAND,XFileExplorer::ID_RESTART),NULL);
1571
// Finally, update the registry
1572
getApp()->reg().write();
1574
DialogBox::onCmdAccept(o,s,p);
1579
long PreferencesBox::onCmdCancel(FXObject* o,FXSelector s,void* p)
1581
// Reset preferences to their previous values
1583
// First tab - Options
1584
trashcan->setCheck(trashcan_prev);
1585
trashbypass->setCheck(trashbypass_prev);
1586
autosave->setCheck(autosave_prev);
1587
savewinpos->setCheck(savewinpos_prev);
1588
diropen->setCheck(diropen_prev);
1589
fileopen->setCheck(fileopen_prev);
1590
filetooltips->setCheck(filetooltips_prev);
1591
relativeresize->setCheck(relativeresize_prev);
1592
showpathlink->setCheck(show_pathlink_prev);
1593
getApp()->setWheelLines(value_prev);
1594
use_sudo=use_sudo_prev;
1595
getApp()->reg().writeUnsignedEntry("OPTIONS","use_sudo",use_sudo);
1596
scroll->setCheck(smoothscroll_prev);
1597
rootmode->setCheck(rootmode_prev);
1598
#ifdef STARTUP_NOTIFICATION
1599
usesn->setCheck(usesn_prev);
1602
// Second tab - Dialogs
1603
ask->setCheck(ask_prev);
1604
dnd->setCheck(dnd_prev);
1605
trashmv->setCheck(trashmv_prev);
1606
del->setCheck(del_prev);
1607
del_emptydir->setCheck(del_emptydir_prev);
1608
overwrite->setCheck(overwrite_prev);
1609
quit->setCheck(quit_prev);
1611
mount->setCheck(mount_prev);
1612
show_mount->setCheck(show_mount_prev);
1614
root_warning->setCheck(root_warning_prev);
1616
// Third tab - Programs
1617
txteditor->setText(oldtxteditor);
1618
txtviewer->setText(oldtxtviewer);
1619
imgeditor->setText(oldimgeditor);
1620
imgviewer->setText(oldimgviewer);
1621
archiver->setText(oldarchiver);
1622
pdfviewer->setText(oldpdfviewer);
1623
audioviewer->setText(oldaudioviewer);
1624
videoviewer->setText(oldvideoviewer);
1625
xterm->setText(oldxterm);
1627
// Fourth tab - Visual
1628
themesList->setCurrentItem(themelist_prev);
1629
currTheme=currTheme_prev;
1630
iconpath->setText(oldiconpath);
1631
use_clearlooks=use_clearlooks_prev;
1632
getApp()->reg().writeUnsignedEntry("SETTINGS","use_clearlooks",use_clearlooks);
1634
// Fifth tab - Fonts
1635
normalfont->setText(oldnormalfont);
1636
textfont->setText(oldtextfont);
1638
// Finally, update the registry (really necessary?)
1639
getApp()->reg().write();
1641
DialogBox::onCmdCancel(o,s,p);
1646
// Execute dialog box modally
1647
FXuint PreferencesBox::execute(FXuint placement)
1649
// Save current preferences to restore them if cancel is pressed
1651
// First tab - Options
1652
trashcan_prev=trashcan->getCheck();
1653
trashbypass_prev=trashbypass->getCheck();
1654
autosave_prev=autosave->getCheck();
1655
savewinpos_prev=savewinpos->getCheck();
1656
diropen_prev=diropen->getCheck();
1657
fileopen_prev=fileopen->getCheck();
1658
filetooltips_prev=filetooltips->getCheck();
1659
relativeresize_prev=relativeresize->getCheck();
1660
show_pathlink_prev=showpathlink->getCheck();
1661
value_prev=getApp()->getWheelLines();
1662
use_sudo_prev=use_sudo;
1663
smoothscroll_prev=scroll->getCheck();
1664
rootmode_prev=rootmode->getCheck();
1665
#ifdef STARTUP_NOTIFICATION
1666
usesn_prev=usesn->getCheck();
1669
// Second tab - Dialogs
1670
ask_prev=ask->getCheck();
1671
dnd_prev=dnd->getCheck();
1672
trashmv_prev=trashmv->getCheck();
1673
del_prev=del->getCheck();
1674
del_emptydir_prev=del_emptydir->getCheck();
1675
overwrite_prev=overwrite->getCheck();
1676
quit_prev=quit->getCheck();
1678
mount_prev=mount->getCheck();
1679
show_mount_prev=show_mount->getCheck();
1681
root_warning_prev=root_warning->getCheck();
1683
// Third tab - Programs
1684
oldtxteditor=txteditor->getText();
1685
oldtxtviewer=txtviewer->getText();
1686
oldimgeditor=imgeditor->getText();
1687
oldimgviewer=imgviewer->getText();
1688
oldarchiver=archiver->getText();
1689
oldpdfviewer=pdfviewer->getText();
1690
oldaudioviewer=audioviewer->getText();
1691
oldvideoviewer=videoviewer->getText();
1692
oldxterm=xterm->getText();
1694
// Fourth tab - Visual
1695
themelist_prev=themesList->getCurrentItem();
1696
currTheme_prev = currTheme;
1697
oldiconpath=iconpath->getText();
1698
use_clearlooks_prev=use_clearlooks;
1700
// Fifth tab - Fonts
1701
oldnormalfont=normalfont->getText();
1702
oldtextfont=textfont->getText();
1706
getApp()->refresh();
1707
return getApp()->runModalFor(this);
1711
// Update buttons related to the trash can option item
1712
long PreferencesBox::onUpdTrash(FXObject* o,FXSelector,void*)
1714
if (trashcan->getCheck())
1715
o->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_ENABLE),NULL);
1717
o->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_DISABLE),NULL);
1722
// Update the confirm delete empty directories option item
1723
long PreferencesBox::onUpdConfirmDelEmptyDir(FXObject* o,FXSelector,void*)
1725
if (del->getCheck())
1726
o->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_ENABLE),NULL);
1728
o->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_DISABLE),NULL);
1734
long PreferencesBox::onCmdSuMode(FXObject*,FXSelector sel,void*)
1736
if (FXSELID(sel)==ID_SU_CMD)
1739
else if (FXSELID(sel)==ID_SUDO_CMD)
1742
getApp()->reg().writeUnsignedEntry("OPTIONS","use_sudo",use_sudo);
1743
getApp()->reg().write();
1749
// Update root mode radio button
1750
long PreferencesBox::onUpdSuMode(FXObject* sender,FXSelector sel,void*)
1752
if (!rootmode->getCheck())
1753
sender->handle(this,FXSEL(SEL_COMMAND,ID_DISABLE),NULL);
1756
if (getuid()) // Simple user
1757
sender->handle(this,FXSEL(SEL_COMMAND,ID_ENABLE),NULL);
1759
FXSelector updatemessage=FXSEL(SEL_COMMAND,ID_UNCHECK);
1761
if (FXSELID(sel)==ID_SU_CMD)
1764
updatemessage=FXSEL(SEL_COMMAND,ID_UNCHECK);
1766
updatemessage=FXSEL(SEL_COMMAND,ID_CHECK);
1768
else if (FXSELID(sel)==ID_SUDO_CMD)
1771
updatemessage=FXSEL(SEL_COMMAND,ID_CHECK);
1773
updatemessage=FXSEL(SEL_COMMAND,ID_UNCHECK);
1776
sender->handle(this,updatemessage,NULL);
1783
long PreferencesBox::onCmdControls(FXObject*,FXSelector sel,void*)
1785
if (FXSELID(sel)==ID_STANDARD_CONTROLS)
1786
use_clearlooks=FALSE;
1788
else if (FXSELID(sel)==ID_CLEARLOOKS_CONTROLS)
1789
use_clearlooks=TRUE;
1791
getApp()->reg().writeUnsignedEntry("SETTINGS","use_clearlooks",use_clearlooks);
1792
getApp()->reg().write();
1798
// Update root mode radio button
1799
long PreferencesBox::onUpdControls(FXObject* sender,FXSelector sel,void*)
1801
FXSelector updatemessage=FXSEL(SEL_COMMAND,ID_UNCHECK);
1803
if (FXSELID(sel)==ID_STANDARD_CONTROLS)
1806
updatemessage=FXSEL(SEL_COMMAND,ID_UNCHECK);
1808
updatemessage=FXSEL(SEL_COMMAND,ID_CHECK);
1810
else if (FXSELID(sel)==ID_CLEARLOOKS_CONTROLS)
1813
updatemessage=FXSEL(SEL_COMMAND,ID_CHECK);
1815
updatemessage=FXSEL(SEL_COMMAND,ID_UNCHECK);
1818
sender->handle(this,updatemessage,NULL);
1824
// Set scroll wheel lines (Mathew Robertson <mathew@optushome.com.au>)
1825
long PreferencesBox::onCmdWheelAdjust(FXObject* sender,FXSelector,void*)
1828
sender->handle(this,FXSEL(SEL_COMMAND,ID_GETINTVALUE),(void*)&value);
1829
getApp()->setWheelLines(value);
1830
getApp()->reg().write();
1835
// Update the wheel lines button
1836
long PreferencesBox::onUpdWheelAdjust(FXObject* sender,FXSelector,void*)
1838
FXuint value=getApp()->getWheelLines();
1839
sender->handle(this,FXSEL(SEL_COMMAND,ID_SETINTVALUE),(void*)&value);
1844
// Update single click file open button
1845
long PreferencesBox::onUpdSingleClickFileopen(FXObject* o,FXSelector,void*)
1847
if (diropen->getCheck())
1848
o->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_ENABLE),NULL);
1851
fileopen->setCheck(FALSE);
1852
o->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_DISABLE),NULL);