Newer
Older
mi->func_gen_sub = feh_menu_func_gen_info;
Birte Kristina Friesel
committed
feh_menu_add_entry(menu_main, NULL, NULL, NULL, 0, NULL, NULL);
}
Birte Kristina Friesel
committed
mi = feh_menu_add_entry(menu_main, "Options", NULL, "OPTIONS", 0, NULL, NULL);
mi->func_gen_sub = feh_menu_func_gen_options;
if (!opt.full_screen)
Birte Kristina Friesel
committed
feh_menu_add_entry(menu_main, "About " PACKAGE, NULL, NULL, CB_ABOUT, NULL, NULL);
if (opt.multiwindow)
Birte Kristina Friesel
committed
feh_menu_add_entry(menu_main, "Close", NULL, NULL, CB_CLOSE, NULL, NULL);
feh_menu_add_entry(menu_main, "Exit", NULL, NULL, CB_EXIT, NULL, NULL);
m = feh_menu_new();
m->name = estrdup("FILE");
Birte Kristina Friesel
committed
feh_menu_add_entry(m, "Reset", NULL, NULL, CB_RESET, NULL, NULL);
feh_menu_add_entry(m, "Resize Window", NULL, NULL, CB_FIT, NULL, NULL);
feh_menu_add_entry(m, "Reload", NULL, NULL, CB_RELOAD, NULL, NULL);
feh_menu_add_entry(m, "Save Image", NULL, NULL, CB_SAVE_IMAGE, NULL, NULL);
feh_menu_add_entry(m, "Save List", NULL, NULL, CB_SAVE_FILELIST, NULL, NULL);
feh_menu_add_entry(m, "Edit in Place", NULL, "EDIT", 0, NULL, NULL);
feh_menu_add_entry(m, "Background", NULL, "BACKGROUND", 0, NULL, NULL);
feh_menu_add_entry(m, NULL, NULL, NULL, 0, NULL, NULL);
feh_menu_add_entry(m, "Hide", NULL, NULL, CB_REMOVE, NULL, NULL);
feh_menu_add_entry(m, "Delete", NULL, "CONFIRM", 0, NULL, NULL);
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
D_RETURN_(4);
}
void feh_menu_init_common()
{
int num_desks, i;
char buf[30];
feh_menu *m;
D_ENTER(4);
if (!opt.menu_fn) {
opt.menu_fn = gib_imlib_load_font(opt.menu_font);
if (!opt.menu_fn)
eprintf
("couldn't load menu font %s, did you make install?\nAre you specifying a nonexistant font?\nDid you tell feh where to find it with --fontpath?",
opt.menu_font);
}
if (!opt.menu_style_l) {
opt.menu_style_l = gib_style_new_from_ascii(opt.menu_style);
if (!opt.menu_style_l) {
weprintf
("couldn't load style file for menu fonts, (%s).\nDid you make install? Menus will look boring without the style file.",
opt.menu_style);
}
}
m = feh_menu_new();
m->name = estrdup("SORT");
Birte Kristina Friesel
committed
feh_menu_add_entry(m, "By File Name", NULL, NULL, CB_SORT_FILENAME, NULL, NULL);
feh_menu_add_entry(m, "By Image Name", NULL, NULL, CB_SORT_IMAGENAME, NULL, NULL);
if (opt.preload || (opt.sort > SORT_FILENAME))
Birte Kristina Friesel
committed
feh_menu_add_entry(m, "By File Size", NULL, NULL, CB_SORT_FILESIZE, NULL, NULL);
feh_menu_add_entry(m, "Randomize", NULL, NULL, CB_SORT_RANDOMIZE, NULL, NULL);
m = feh_menu_new();
m->name = estrdup("CONFIRM");
Birte Kristina Friesel
committed
feh_menu_add_entry(m, "Confirm", NULL, NULL, CB_DELETE, NULL, NULL);
m = feh_menu_new();
m->name = estrdup("EDIT");
Birte Kristina Friesel
committed
feh_menu_add_entry(m, "Rotate 90 CW", NULL, NULL, CB_EDIT_ROTATE, (void *) 1, NULL);
feh_menu_add_entry(m, "Rotate 180", NULL, NULL, CB_EDIT_ROTATE, (void *) 2, NULL);
feh_menu_add_entry(m, "Rotate 90 CCW", NULL, NULL, CB_EDIT_ROTATE, (void *) 3, NULL);
menu_bg = feh_menu_new();
menu_bg->name = estrdup("BACKGROUND");
num_desks = feh_wm_get_num_desks();
if (num_desks > 1) {
Birte Kristina Friesel
committed
feh_menu_add_entry(menu_bg, "Set Tiled", NULL, "TILED", 0, NULL, NULL);
feh_menu_add_entry(menu_bg, "Set Seamless", NULL, "SEAMLESS", 0, NULL, NULL);
feh_menu_add_entry(menu_bg, "Set Scaled", NULL, "SCALED", 0, NULL, NULL);
feh_menu_add_entry(menu_bg, "Set Centered", NULL, "CENTERED", 0, NULL, NULL);
feh_menu_add_entry(menu_bg, "Set Filled", NULL, "FILLED", 0, NULL, NULL);
m = feh_menu_new();
m->name = estrdup("TILED");
for (i = 0; i < num_desks; i++) {
snprintf(buf, sizeof(buf), "Desktop %d", i + 1);
if (opt.slideshow || opt.multiwindow)
Birte Kristina Friesel
committed
feh_menu_add_entry(m, buf, NULL, NULL, CB_BG_TILED,
(void *) i, NULL);
else
Birte Kristina Friesel
committed
feh_menu_add_entry(m, buf, NULL, NULL, CB_BG_TILED_NOFILE,
(void *) i, NULL);
}
m = feh_menu_new();
m->name = estrdup("SEAMLESS");
for (i = 0; i < num_desks; i++) {
snprintf(buf, sizeof(buf), "Desktop %d", i + 1);
Birte Kristina Friesel
committed
feh_menu_add_entry(m, buf, NULL, NULL, CB_BG_SEAMLESS,
(void *) i, NULL);
}
m = feh_menu_new();
m->name = estrdup("SCALED");
for (i = 0; i < num_desks; i++) {
snprintf(buf, sizeof(buf), "Desktop %d", i + 1);
if (opt.slideshow || opt.multiwindow)
Birte Kristina Friesel
committed
feh_menu_add_entry(m, buf, NULL, NULL, CB_BG_SCALED,
(void *) i, NULL);
else
Birte Kristina Friesel
committed
feh_menu_add_entry(m, buf, NULL, NULL, CB_BG_SCALED_NOFILE,
(void *) i, NULL);
}
m = feh_menu_new();
m->name = estrdup("CENTERED");
for (i = 0; i < num_desks; i++) {
snprintf(buf, sizeof(buf), "Desktop %d", i + 1);
if (opt.slideshow || opt.multiwindow)
feh_menu_add_entry(m, buf, NULL, NULL,
Birte Kristina Friesel
committed
CB_BG_CENTERED, (void *) i, NULL);
else
feh_menu_add_entry(m, buf, NULL, NULL,
Birte Kristina Friesel
committed
CB_BG_CENTERED_NOFILE, (void *) i, NULL);
Birte Kristina Friesel
committed
}
m = feh_menu_new();
m->name = estrdup("FILLED");
for (i = 0; i < num_desks; i++) {
snprintf(buf, sizeof(buf), "Desktop %d", i + 1);
if (opt.slideshow || opt.multiwindow)
feh_menu_add_entry(m, buf, NULL, NULL,
Birte Kristina Friesel
committed
CB_BG_FILLED,
Birte Kristina Friesel
committed
(void *) i, NULL);
else
feh_menu_add_entry(m, buf, NULL, NULL,
Birte Kristina Friesel
committed
CB_BG_FILLED_NOFILE,
Birte Kristina Friesel
committed
(void *) i, NULL);
}
} else {
if (opt.slideshow || opt.multiwindow) {
feh_menu_add_entry(menu_bg, "Set Tiled", NULL,
Birte Kristina Friesel
committed
NULL, CB_BG_TILED, NULL, NULL);
feh_menu_add_entry(menu_bg, "Set Seamless", NULL,
Birte Kristina Friesel
committed
NULL, CB_BG_SEAMLESS, NULL, NULL);
feh_menu_add_entry(menu_bg, "Set Scaled", NULL,
Birte Kristina Friesel
committed
NULL, CB_BG_SCALED, NULL, NULL);
feh_menu_add_entry(menu_bg, "Set Centered", NULL,
Birte Kristina Friesel
committed
NULL, CB_BG_CENTERED, NULL, NULL);
Birte Kristina Friesel
committed
feh_menu_add_entry(menu_bg, "Set Filled", NULL,
Birte Kristina Friesel
committed
NULL, CB_BG_FILLED, NULL, NULL);
} else {
feh_menu_add_entry(menu_bg, "Set Tiled", NULL,
Birte Kristina Friesel
committed
NULL, CB_BG_TILED_NOFILE, NULL, NULL);
feh_menu_add_entry(menu_bg, "Set Seamless", NULL,
Birte Kristina Friesel
committed
NULL, CB_BG_SEAMLESS, NULL, NULL);
feh_menu_add_entry(menu_bg, "Set Scaled", NULL,
Birte Kristina Friesel
committed
NULL, CB_BG_SCALED_NOFILE, NULL, NULL);
feh_menu_add_entry(menu_bg, "Set Centered", NULL,
Birte Kristina Friesel
committed
NULL, CB_BG_CENTERED_NOFILE, NULL, NULL);
Birte Kristina Friesel
committed
feh_menu_add_entry(menu_bg, "Set Filled", NULL,
Birte Kristina Friesel
committed
NULL, CB_BG_FILLED_NOFILE, NULL, NULL);
}
}
common_menus = 1;
D_RETURN_(4);
}
void feh_menu_init_about_win(void)
{
D_ENTER(4);
menu_about_win = feh_menu_new();
menu_about_win->name = estrdup("ABOUTWIN");
Birte Kristina Friesel
committed
feh_menu_add_entry(menu_about_win, "Close", NULL, NULL, CB_CLOSE, NULL, NULL);
feh_menu_add_entry(menu_about_win, "Exit", NULL, NULL, CB_EXIT, NULL, NULL);
D_RETURN_(4);
}
void feh_menu_init_single_win(void)
{
feh_menu *m;
feh_menu_item *mi;
D_ENTER(4);
if (!common_menus)
feh_menu_init_common();
menu_single_win = feh_menu_new();
menu_single_win->name = estrdup("SINGLEWIN");
Birte Kristina Friesel
committed
feh_menu_add_entry(menu_single_win, "File", NULL, "SINGLEWIN_FILE", 0, NULL, NULL);
m = feh_menu_new();
m->name = estrdup("SINGLEWIN_FILE");
Birte Kristina Friesel
committed
feh_menu_add_entry(m, "Reset", NULL, NULL, CB_RESET, NULL, NULL);
feh_menu_add_entry(m, "Resize Window", NULL, NULL, CB_FIT, NULL, NULL);
feh_menu_add_entry(m, "Reload", NULL, NULL, CB_RELOAD, NULL, NULL);
feh_menu_add_entry(m, "Save Image", NULL, NULL, CB_SAVE_IMAGE, NULL, NULL);
feh_menu_add_entry(m, "Save List", NULL, NULL, CB_SAVE_FILELIST, NULL, NULL);
feh_menu_add_entry(m, "Edit in Place", NULL, "EDIT", 0, NULL, NULL);
feh_menu_add_entry(m, "Background", NULL, "BACKGROUND", 0, NULL, NULL);
if (opt.multiwindow || opt.slideshow) {
Birte Kristina Friesel
committed
feh_menu_add_entry(m, NULL, NULL, NULL, 0, NULL, NULL);
feh_menu_add_entry(m, "Hide", NULL, NULL, CB_REMOVE, NULL, NULL);
feh_menu_add_entry(m, "Delete", NULL, "CONFIRM", 0, NULL, NULL);
}
Birte Kristina Friesel
committed
mi = feh_menu_add_entry(menu_single_win, "Image Info", NULL, "INFO", 0, NULL, NULL);
mi->func_gen_sub = feh_menu_func_gen_info;
Birte Kristina Friesel
committed
feh_menu_add_entry(menu_single_win, NULL, NULL, NULL, 0, NULL, NULL);
mi = feh_menu_add_entry(menu_single_win, "Options", NULL, "OPTIONS", 0, NULL, NULL);
mi->func_gen_sub = feh_menu_func_gen_options;
Birte Kristina Friesel
committed
feh_menu_add_entry(menu_single_win, "About " PACKAGE, NULL, NULL,
CB_ABOUT, NULL, NULL);
feh_menu_add_entry(menu_single_win, "Close", NULL, NULL, CB_CLOSE, NULL, NULL);
feh_menu_add_entry(menu_single_win, "Exit", NULL, NULL, CB_EXIT, NULL, NULL);
D_RETURN_(4);
}
void feh_menu_init_thumbnail_win(void)
{
feh_menu *m;
feh_menu_item *mi;
D_ENTER(4);
if (!common_menus)
feh_menu_init_common();
menu_thumbnail_win = feh_menu_new();
menu_thumbnail_win->name = estrdup("THUMBWIN");
Birte Kristina Friesel
committed
feh_menu_add_entry(menu_thumbnail_win, "File", NULL, "THUMBWIN_FILE", 0, NULL, NULL);
m = feh_menu_new();
m->name = estrdup("THUMBWIN_FILE");
Birte Kristina Friesel
committed
feh_menu_add_entry(m, "Reset", NULL, NULL, CB_RESET, NULL, NULL);
feh_menu_add_entry(m, "Resize Window", NULL, NULL, CB_FIT, NULL, NULL);
feh_menu_add_entry(m, "Save Image", NULL, NULL, CB_SAVE_IMAGE, NULL, NULL);
feh_menu_add_entry(m, "Save List", NULL, NULL, CB_SAVE_FILELIST, NULL, NULL);
feh_menu_add_entry(m, "Background", NULL, "BACKGROUND", 0, NULL, NULL);
feh_menu_add_entry(menu_thumbnail_win, NULL, NULL, NULL, 0, NULL, NULL);
mi = feh_menu_add_entry(menu_thumbnail_win, "Options", NULL, "OPTIONS", 0, NULL, NULL);
mi->func_gen_sub = feh_menu_func_gen_options;
Birte Kristina Friesel
committed
feh_menu_add_entry(menu_thumbnail_win, "About " PACKAGE, NULL, NULL,
CB_ABOUT, NULL, NULL);
feh_menu_add_entry(menu_thumbnail_win, "Close", NULL, NULL, CB_CLOSE, NULL, NULL);
feh_menu_add_entry(menu_thumbnail_win, "Exit", NULL, NULL, CB_EXIT, NULL, NULL);
D_RETURN_(4);
}
void feh_menu_init_thumbnail_viewer(void)
{
feh_menu *m;
feh_menu_item *mi;
D_ENTER(4);
if (!common_menus)
feh_menu_init_common();
menu_thumbnail_viewer = feh_menu_new();
menu_thumbnail_viewer->name = estrdup("THUMBVIEW");
Birte Kristina Friesel
committed
feh_menu_add_entry(menu_thumbnail_viewer, "File", NULL, "THUMBVIEW_FILE",
0, NULL, NULL);
m = feh_menu_new();
m->name = estrdup("THUMBVIEW_FILE");
Birte Kristina Friesel
committed
feh_menu_add_entry(m, "Reset", NULL, NULL, CB_RESET, NULL, NULL);
feh_menu_add_entry(m, "Resize Window", NULL, NULL, CB_FIT, NULL, NULL);
feh_menu_add_entry(m, "Reload", NULL, NULL, CB_RELOAD, NULL, NULL);
feh_menu_add_entry(m, "Save Image", NULL, NULL, CB_SAVE_IMAGE, NULL, NULL);
feh_menu_add_entry(m, "Save List", NULL, NULL, CB_SAVE_FILELIST, NULL, NULL);
feh_menu_add_entry(m, "Edit in Place", NULL, "EDIT", 0, NULL, NULL);
feh_menu_add_entry(m, "Background", NULL, "BACKGROUND", 0, NULL, NULL);
feh_menu_add_entry(m, NULL, NULL, NULL, 0, NULL, NULL);
feh_menu_add_entry(m, "Hide", NULL, NULL, CB_REMOVE_THUMB, NULL, NULL);
feh_menu_add_entry(m, "Delete", NULL, "THUMBVIEW_CONFIRM", 0, NULL, NULL);
mi = feh_menu_add_entry(menu_thumbnail_viewer, "Image Info", NULL,
"INFO", 0, NULL, NULL);
mi->func_gen_sub = feh_menu_func_gen_info;
Birte Kristina Friesel
committed
feh_menu_add_entry(menu_thumbnail_viewer, NULL, NULL, NULL, 0, NULL, NULL);
mi = feh_menu_add_entry(menu_thumbnail_viewer, "Options", NULL,
"OPTIONS", 0, NULL, NULL);
mi->func_gen_sub = feh_menu_func_gen_options;
Birte Kristina Friesel
committed
feh_menu_add_entry(menu_thumbnail_viewer, "About " PACKAGE, NULL, NULL,
CB_ABOUT, NULL, NULL);
feh_menu_add_entry(menu_thumbnail_viewer, "Close", NULL, NULL, CB_CLOSE, NULL, NULL);
feh_menu_add_entry(menu_thumbnail_viewer, "Exit", NULL, NULL, CB_EXIT, NULL, NULL);
m = feh_menu_new();
m->name = estrdup("THUMBVIEW_CONFIRM");
Birte Kristina Friesel
committed
feh_menu_add_entry(m, "Confirm", NULL, NULL, CB_DELETE_THUMB, NULL, NULL);
D_RETURN_(4);
}
Birte Kristina Friesel
committed
void feh_menu_cb_opt_fullscreen(feh_menu * m, feh_menu_item * i)
{
Birte Kristina Friesel
committed
int curr_screen = 0;
Birte Kristina Friesel
committed
MENU_ITEM_TOGGLE(i);
if (MENU_ITEM_IS_ON(i))
m->fehwin->full_screen = TRUE;
else
m->fehwin->full_screen = FALSE;
Birte Kristina Friesel
committed
#ifdef HAVE_LIBXINERAMA
if (opt.xinerama && xinerama_screens) {
int i, rect[4];
Birte Kristina Friesel
committed
winwidget_get_geometry(m->fehwin, rect);
/* printf("window: (%d, %d)\n", rect[0], rect[1]);
printf("found %d screens.\n", num_xinerama_screens); */
for (i = 0; i < num_xinerama_screens; i++) {
xinerama_screen = 0;
/* printf("%d: [%d, %d, %d, %d] (%d, %d)\n",
i,
xinerama_screens[i].x_org, xinerama_screens[i].y_org,
xinerama_screens[i].width, xinerama_screens[i].height,
rect[0], rect[1]); */
if (XY_IN_RECT(rect[0], rect[1],
xinerama_screens[i].x_org,
xinerama_screens[i].y_org,
xinerama_screens[i].width, xinerama_screens[i].height)) {
curr_screen = xinerama_screen = i;
break;
}
Birte Kristina Friesel
committed
}
}
#endif /* HAVE_LIBXINERAMA */
Birte Kristina Friesel
committed
winwidget_destroy_xwin(m->fehwin);
winwidget_create_window(m->fehwin, m->fehwin->im_w, m->fehwin->im_h);
Birte Kristina Friesel
committed
winwidget_render_image(m->fehwin, 1, 1);
winwidget_show(m->fehwin);
Birte Kristina Friesel
committed
#ifdef HAVE_LIBXINERAMA
/* if we have xinerama and we're using it, then full screen the window
* on the head that the window was active on */
if (m->fehwin->full_screen == TRUE && opt.xinerama && xinerama_screens) {
xinerama_screen = curr_screen;
winwidget_move(m->fehwin, xinerama_screens[curr_screen].x_org, xinerama_screens[curr_screen].y_org);
}
#endif /* HAVE_LIBXINERAMA */
Birte Kristina Friesel
committed
}
Birte Kristina Friesel
committed
void feh_menu_cb(feh_menu * m, feh_menu_item * i, int action, void *data)
Birte Kristina Friesel
committed
{
char *path;
Imlib_Image im;
winwidget winwid;
D_ENTER(4);
Birte Kristina Friesel
committed
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
switch (action) {
case CB_BG_TILED:
path = feh_absolute_path(FEH_FILE(m->fehwin->file->data)->filename);
feh_wm_set_bg(path, m->fehwin->im, 0, 0, 0, (int) data, 1);
free(path);
break;
case CB_BG_SEAMLESS:
im = gib_imlib_clone_image(m->fehwin->im);
gib_imlib_image_tile(im);
feh_wm_set_bg(NULL, im, 0, 0, 0, (int) data, 1);
gib_imlib_free_image_and_decache(im);
break;
case CB_BG_SCALED:
path = feh_absolute_path(FEH_FILE(m->fehwin->file->data)->filename);
feh_wm_set_bg(path, m->fehwin->im, 0, 1, 0, (int) data, 1);
free(path);
break;
case CB_BG_CENTERED:
path = feh_absolute_path(FEH_FILE(m->fehwin->file->data)->filename);
feh_wm_set_bg(path, m->fehwin->im, 1, 0, 0, (int) data, 1);
free(path);
break;
case CB_BG_FILLED:
path = feh_absolute_path(FEH_FILE(m->fehwin->file->data)->filename);
feh_wm_set_bg(path, m->fehwin->im, 0, 0, 1, (int) data, 1);
free(path);
break;
case CB_BG_TILED_NOFILE:
feh_wm_set_bg(NULL, m->fehwin->im, 0, 0, 0, (int) data, 1);
break;
case CB_BG_SCALED_NOFILE:
feh_wm_set_bg(NULL, m->fehwin->im, 0, 1, 0, (int) data, 1);
break;
case CB_BG_CENTERED_NOFILE:
feh_wm_set_bg(NULL, m->fehwin->im, 1, 0, 0, (int) data, 1);
break;
case CB_BG_FILLED_NOFILE:
feh_wm_set_bg(NULL, m->fehwin->im, 0, 0, 1, (int) data, 1);
break;
case CB_ABOUT:
if (feh_load_image_char(&im, PREFIX "/share/feh/images/about.png")
!= 0) {
winwid = winwidget_create_from_image(im, "About " PACKAGE,
WIN_TYPE_ABOUT);
winwid->file = gib_list_add_front(NULL,
feh_file_new(PREFIX "/share/feh/images/about.png"));
winwidget_show(winwid);
}
break;
case CB_CLOSE:
winwidget_destroy(m->fehwin);
break;
case CB_EXIT:
winwidget_destroy_all();
break;
case CB_RESET:
if (m->fehwin->has_rotated) {
m->fehwin->im_w = gib_imlib_image_get_width(m->fehwin->im);
m->fehwin->im_h = gib_imlib_image_get_height(m->fehwin->im);
winwidget_resize(m->fehwin, m->fehwin->im_w, m->fehwin->im_h);
}
winwidget_reset_image(m->fehwin);
winwidget_render_image(m->fehwin, 1, 1);
break;
case CB_RELOAD:
feh_reload_image(m->fehwin, 0, 0);
break;
case CB_REMOVE:
feh_filelist_image_remove(m->fehwin, 0);
break;
case CB_DELETE:
feh_filelist_image_remove(m->fehwin, 1);
break;
case CB_REMOVE_THUMB:
feh_thumbnail_mark_removed(FEH_FILE(m->fehwin->file->data), 0);
feh_filelist_image_remove(m->fehwin, 0);
break;
case CB_DELETE_THUMB:
feh_thumbnail_mark_removed(FEH_FILE(m->fehwin->file->data), 1);
feh_filelist_image_remove(m->fehwin, 1);
break;
case CB_SORT_FILENAME:
filelist = gib_list_sort(filelist, feh_cmp_filename);
if (!opt.no_jump_on_resort) {
slideshow_change_image(m->fehwin, SLIDE_FIRST);
}
break;
case CB_SORT_IMAGENAME:
filelist = gib_list_sort(filelist, feh_cmp_name);
if (!opt.no_jump_on_resort) {
slideshow_change_image(m->fehwin, SLIDE_FIRST);
}
break;
case CB_SORT_FILESIZE:
filelist = gib_list_sort(filelist, feh_cmp_size);
if (!opt.no_jump_on_resort) {
slideshow_change_image(m->fehwin, SLIDE_FIRST);
}
break;
case CB_SORT_RANDOMIZE:
filelist = gib_list_randomize(filelist);
if (!opt.no_jump_on_resort) {
slideshow_change_image(m->fehwin, SLIDE_FIRST);
}
break;
case CB_FIT:
winwidget_size_to_image(m->fehwin);
break;
case CB_EDIT_ROTATE:
feh_edit_inplace_orient(m->fehwin, (int) data);
break;
case CB_SAVE_IMAGE:
slideshow_save_image(m->fehwin);
break;
case CB_SAVE_FILELIST:
feh_save_filelist();
break;
case CB_OPT_DRAW_FILENAME:
MENU_ITEM_TOGGLE(i);
if (MENU_ITEM_IS_ON(i))
opt.draw_filename = TRUE;
else
opt.draw_filename = FALSE;
winwidget_rerender_all(0, 1);
break;
case CB_OPT_KEEP_HTTP:
MENU_ITEM_TOGGLE(i);
if (MENU_ITEM_IS_ON(i))
opt.keep_http = TRUE;
else
opt.keep_http = FALSE;
break;
case CB_OPT_FREEZE_WINDOW:
MENU_ITEM_TOGGLE(i);
if (MENU_ITEM_IS_ON(i)) {
opt.geom_flags = (WidthValue | HeightValue);
opt.geom_w = m->fehwin->w;
opt.geom_h = m->fehwin->h;
} else {
opt.geom_flags = 0;
}
break;
case CB_OPT_FULLSCREEN:
feh_menu_cb_opt_fullscreen(m, i);
break;
case CB_OPT_AUTO_ZOOM:
MENU_ITEM_TOGGLE(i);
opt.auto_zoom = MENU_ITEM_IS_ON(i) ? 1 : 0;
winwidget_rerender_all(1, 1);
break;
case CB_OPT_XINERAMA:
#ifdef HAVE_LIBXINERAMA
MENU_ITEM_TOGGLE(i);
opt.xinerama = MENU_ITEM_IS_ON(i) ? 1 : 0;
if (opt.xinerama) {
init_xinerama();
} else {
XFree(xinerama_screens);
xinerama_screens = NULL;
}
winwidget_rerender_all(1, 1);
#endif /* HAVE_LIBXINERAMA */
break;
}
D_RETURN_(4);
}
Birte Kristina Friesel
committed
static feh_menu *feh_menu_func_gen_info(feh_menu * m)
{
Imlib_Image im;
feh_menu *mm;
feh_file *file;
char buffer[400];
D_ENTER(4);
if (!m->fehwin->file)
D_RETURN(4, NULL);
file = FEH_FILE(m->fehwin->file->data);
im = m->fehwin->im;
if (!im)
D_RETURN(4, NULL);
mm = feh_menu_new();
mm->name = estrdup("INFO");
snprintf(buffer, sizeof(buffer), "Filename: %s", file->name);
Birte Kristina Friesel
committed
feh_menu_add_entry(mm, buffer, NULL, NULL, 0, NULL, NULL);
if (!file->info)
feh_file_info_load(file, im);
if (file->info) {
snprintf(buffer, sizeof(buffer), "Size: %dKb", file->info->size / 1024);
Birte Kristina Friesel
committed
feh_menu_add_entry(mm, buffer, NULL, NULL, 0, NULL, NULL);
snprintf(buffer, sizeof(buffer), "Dimensions: %dx%d", file->info->width, file->info->height);
Birte Kristina Friesel
committed
feh_menu_add_entry(mm, buffer, NULL, NULL, 0, NULL, NULL);
snprintf(buffer, sizeof(buffer), "Type: %s", file->info->format);
Birte Kristina Friesel
committed
feh_menu_add_entry(mm, buffer, NULL, NULL, 0, NULL, NULL);
}
mm->func_free = feh_menu_func_free_info;
D_RETURN(4, mm);
}
Birte Kristina Friesel
committed
static void feh_menu_func_free_info(feh_menu * m)
{
D_ENTER(4);
feh_menu_free(m);
D_RETURN_(4);
}
Birte Kristina Friesel
committed
static feh_menu *feh_menu_func_gen_options(feh_menu * m)
{
feh_menu *mm;
D_ENTER(4);
mm = feh_menu_new();
mm->name = estrdup("OPTIONS");
mm->fehwin = m->fehwin;
Birte Kristina Friesel
committed
feh_menu_add_toggle_entry(mm, "Auto-Zoom", NULL, NULL, CB_OPT_AUTO_ZOOM, NULL, NULL, opt.auto_zoom);
feh_menu_add_toggle_entry(mm, "Freeze Window Size", NULL, NULL,
Birte Kristina Friesel
committed
CB_OPT_FREEZE_WINDOW, NULL, NULL, opt.geom_flags);
feh_menu_add_toggle_entry(mm, "Fullscreen", NULL, NULL,
Birte Kristina Friesel
committed
CB_OPT_FULLSCREEN, NULL, NULL, m->fehwin->full_screen);
Birte Kristina Friesel
committed
feh_menu_add_toggle_entry(mm, "Use Xinerama", NULL, NULL, CB_OPT_XINERAMA, NULL, NULL, opt.xinerama);
#endif /* HAVE_LIBXINERAMA */
Birte Kristina Friesel
committed
feh_menu_add_entry(mm, NULL, NULL, NULL, 0, NULL, NULL);
feh_menu_add_toggle_entry(mm, "Draw Filename", NULL, NULL,
Birte Kristina Friesel
committed
CB_OPT_DRAW_FILENAME, NULL, NULL, opt.draw_filename);
feh_menu_add_toggle_entry(mm, "Keep HTTP Files", NULL, NULL,
Birte Kristina Friesel
committed
CB_OPT_KEEP_HTTP, NULL, NULL, opt.keep_http);
mm->func_free = feh_menu_func_free_options;
D_RETURN(4, mm);
Birte Kristina Friesel
committed
static void feh_menu_func_free_options(feh_menu * m)
{
D_ENTER(4);
feh_menu_free(m);
D_RETURN_(4);