diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..582085f --- /dev/null +++ b/Makefile @@ -0,0 +1,29 @@ +# +# Makefile for cavaldos. Prety lame, needs to be improved. +# +NAME=calvados +CFLAGS=-g -Wall -o $(NAME) +GTKFLAGS=-export-dynamic `pkg-config --cflags --libs gtk+-2.0` +SRCS=calvados.c select_volume.c closing_dialog.c close_dialog.c show_about.c \ + disk_sector_viewer_popup.c create_disk_image.c new_archive.c \ + open_file.c okfunc_create_disk_image.c okfunc_select_volume.c \ + help_func_create_disk_image.c help_func_select_volume.c \ + do_open_file.c save_to_file.c preferences.c +HEADERS=calvados.h +CC=gcc +DESTDIR=/usr/local + +INCLUDE=-I/usr/include/glib-2.0/ -I/usr/lib/x86_64-linux-gnu/glib-2.0/include/ -I/usr/include/pango-1.0/ -I/usr/include/cairo/ -I/usr/include/gdk-pixbuf-2.0/ -I/usr/include/atk-1.0/ + +all: calvados + +calvados: $(SRCS) $(HEADERS) + $(CC) $(CFLAGS) $(SRCS) $(GTKFLAGS) + +install: + /usr/bin/install $(NAME) $(DESTDIR)/bin + /usr/bin/install -D images $(DESTDIR)/images + +clean: + /bin/rm -f $(NAME) + diff --git a/calvados.c b/calvados.c new file mode 100644 index 0000000..78cba49 --- /dev/null +++ b/calvados.c @@ -0,0 +1,629 @@ +/* + * + * cavaldos.c + * + * Designed to be a workalike of CiderPress. + * + * 20170310 Leeland Heins + * + */ +#include +#include + +#include "calvados.h" + +int main(int argc, char *argv[]) +{ + /* Our root window */ + GtkWidget *window; + + GtkWidget *vbox; + + GtkWidget *menubar; + + /* File menu widgets */ + GtkWidget *fileMenu; + GtkWidget *newMenu; + GtkWidget *diskImageMi; + GtkWidget *shrinkItArchiveMi; + GtkWidget *fileMi; + GtkWidget *newMi; + GtkWidget *openMi; + GtkWidget *openVolumeMi; + GtkWidget *reopenMi; + GtkWidget *saveChangesMi; + GtkWidget *closeMi; + GtkWidget *fileSep1; + GtkWidget *archiveInfoMi; + GtkWidget *printMi; + GtkWidget *fileSep2; + GtkWidget *quitMi; + + /* Edit menu widgets */ + GtkWidget *editMenu; + GtkWidget *editMi; + GtkWidget *copyMi; + GtkWidget *pasteMi; + GtkWidget *pasteSpecialMi; + GtkWidget *editSep1; + GtkWidget *findMi; + GtkWidget *editSep2; + GtkWidget *sortMenu; + GtkWidget *sortMi; + GtkWidget *byOriginalOrderMi; + GtkWidget *byPathnameMi; + GtkWidget *byFileTypeMi; + GtkWidget *byAuxtypeMi; + GtkWidget *byModificationDateMi; + GtkWidget *byFormatMi; + GtkWidget *bySizeMi; + GtkWidget *byRatioMi; + GtkWidget *byPackedSizeMi; + GtkWidget *byAccessMi; + GtkWidget *selectAllMi; + GtkWidget *invertSelectionMi; + GtkWidget *preferencesMi; + + /* Action menu widgets */ + GtkWidget *actionMenu; + GtkWidget *actionsMi; + GtkWidget *viewMi; + GtkWidget *extractMi; + GtkWidget *testMi; + GtkWidget *renameMi; + GtkWidget *deleteMi; + GtkWidget *recompressMi; + GtkWidget *actionSep1; + GtkWidget *addFilesMi; + GtkWidget *addDiskImageMi; + GtkWidget *createSubdirectoryMi; + GtkWidget *actionSep2; + GtkWidget *openAsDiskImageMi; + GtkWidget *editCommentMi; + GtkWidget *editAttributesMi; + GtkWidget *renameVolumeMi; + GtkWidget *actionSep3; + GtkWidget *convertToDiskImageMi; + GtkWidget *convertToArchiveFileMi; + GtkWidget *importFileFromWAVMi; + GtkWidget *importBASFromTextMi; + + /* Tools menu widgets */ + GtkWidget *toolsMenu; + GtkWidget *toolsMi; + GtkWidget *diskSectorViewerMi; + GtkWidget *diskImageConverterMi; + GtkWidget *bulkDiskImageConverterMi; + GtkWidget *toolsSep1; + GtkWidget *volumeCopierOpenVolumeMi; + GtkWidget *volumeCopierOpenFileMi; + GtkWidget *mergeSSTImagesMi; + GtkWidget *toolsSep2; + GtkWidget *TwoMGPropertiesEditorMi; + GtkWidget *EOLScannerMi; + + /* Help menu widgets */ + GtkWidget *helpMenu; + GtkWidget *helpMi; + GtkWidget *contentsMi; + GtkWidget *visitCalvadosWebsiteMi; + GtkWidget *helpSep1; + GtkWidget *aboutCalvadosMi; + + /* For keyboard accellerators */ + GtkAccelGroup *accel_group = NULL; + + /* For sort submenu */ + GSList *sort_radio_group = NULL; + + /* Tool bar widgets */ + GtkWidget *toolbar; + /*GtkToolItem *newTb;*/ + GtkWidget *openTbImage; + GtkToolItem *openTb; + GtkWidget *openVolumeTbImage; + GtkToolItem *openVolumeTb; + GtkWidget *newArchiveTbImage; + GtkToolItem *newArchiveTb; + /*GtkToolItem *saveTb;*/ + GtkWidget *createDiskImageTbImage; + GtkToolItem *createDiskImageTb; + GtkWidget *printTbImage; + GtkToolItem *printTb; + GtkToolItem *tbSep1; + GtkWidget *addFilesTbImage; + GtkToolItem *addFilesTb; + GtkWidget *addDiskImageTbImage; + GtkToolItem *addDiskImageTb; + GtkWidget *viewTbImage; + GtkToolItem *viewTb; + GtkWidget *extractTbImage; + GtkToolItem *extractTb; + GtkWidget *testTbImage; + GtkToolItem *testTb; + GtkWidget *renameTbImage; + GtkToolItem *renameTb; + GtkWidget *deleteTbImage; + GtkToolItem *deleteTb; + GtkWidget *recompressTbImage; + GtkToolItem *recompressTb; + GtkWidget *editCommentTbImage; + GtkToolItem *editCommentTb; + GtkToolItem *tbSep2; + GtkWidget *diskSectorViewerTbImage; + GtkToolItem *diskSectorViewerTb; + GtkWidget *diskImageConverterTbImage; + GtkToolItem *diskImageConverterTb; + GtkWidget *volumeCopierTbImage; + GtkToolItem *volumeCopierTb; + GtkWidget *mergeSSTImagesTbImage; + GtkToolItem *mergeSSTImagesTb; + GtkToolItem *tbSep3; + GtkToolItem *exitTb; + + GtkWidget *statusbar; + + /* Initialise GTK+ passing to it all command line arguments */ + gtk_init(&argc, &argv); + + /* create a new window, set values */ + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); + gtk_window_set_default_size(GTK_WINDOW(window), WINDOW_WIDTH, WINDOW_HEIGHT); + gtk_window_set_title(GTK_WINDOW(window), "Calvados"); + + /* Primary app vbox */ + vbox = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(window), vbox); + + /* Primary app menu bar */ + menubar = gtk_menu_bar_new(); + /* File menu */ + fileMenu = gtk_menu_new(); + /* Edit menu */ + editMenu = gtk_menu_new(); + /* Action menu */ + actionMenu = gtk_menu_new(); + /* Tools menu */ + toolsMenu = gtk_menu_new(); + /* Help menu */ + helpMenu = gtk_menu_new(); + + /* For keyboard accellerators */ + accel_group = gtk_accel_group_new(); + gtk_window_add_accel_group(GTK_WINDOW(window), accel_group); + + /* File menu bar items */ + fileMi = gtk_menu_item_new_with_mnemonic("_File"); + + newMenu = gtk_menu_new(); + newMi = gtk_image_menu_item_new_from_stock(GTK_STOCK_NEW, accel_group); + diskImageMi = gtk_menu_item_new_with_label("Disk image"); + shrinkItArchiveMi = gtk_menu_item_new_with_label("ShrinkIt Archive"); + + /* 'New' submenu */ + gtk_menu_item_set_submenu(GTK_MENU_ITEM(newMi), newMenu); + gtk_menu_shell_append(GTK_MENU_SHELL(newMenu), diskImageMi); + gtk_menu_shell_append(GTK_MENU_SHELL(newMenu), shrinkItArchiveMi); + + gtk_widget_add_accelerator(shrinkItArchiveMi, "activate", accel_group, GDK_n, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); + + openMi = gtk_image_menu_item_new_from_stock(GTK_STOCK_OPEN, accel_group); + + openVolumeMi = gtk_menu_item_new_with_mnemonic("_Open volume..."); + + gtk_widget_add_accelerator(openVolumeMi, "activate", accel_group, GDK_o, GDK_CONTROL_MASK|GDK_SHIFT_MASK, GTK_ACCEL_VISIBLE); + + reopenMi = gtk_menu_item_new_with_mnemonic("_Reopen"); + + gtk_widget_add_accelerator(reopenMi, "activate", accel_group, GDK_r, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); + + saveChangesMi = gtk_menu_item_new_with_mnemonic("_Save changes"); + + gtk_widget_add_accelerator(saveChangesMi, "activate", accel_group, GDK_s, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); + + closeMi = gtk_image_menu_item_new_from_stock(GTK_STOCK_CLOSE, accel_group); + + fileSep1 = gtk_separator_menu_item_new(); + + archiveInfoMi = gtk_menu_item_new_with_mnemonic("Archive _Info"); + + gtk_widget_add_accelerator(archiveInfoMi, "activate", accel_group, GDK_i, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); + + printMi = gtk_image_menu_item_new_from_stock(GTK_STOCK_PRINT, accel_group); + + gtk_widget_add_accelerator(printMi, "activate", accel_group, GDK_p, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); + + fileSep2 = gtk_separator_menu_item_new(); + + quitMi = gtk_image_menu_item_new_from_stock(GTK_STOCK_QUIT, accel_group); + + gtk_widget_add_accelerator(quitMi, "activate", accel_group, GDK_q, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); + + /* Set up file menu */ + gtk_menu_item_set_submenu(GTK_MENU_ITEM(fileMi), fileMenu); + gtk_menu_shell_append(GTK_MENU_SHELL(fileMenu), newMi); + gtk_menu_shell_append(GTK_MENU_SHELL(fileMenu), openMi); + gtk_menu_shell_append(GTK_MENU_SHELL(fileMenu), openVolumeMi); + gtk_menu_shell_append(GTK_MENU_SHELL(fileMenu), reopenMi); + gtk_menu_shell_append(GTK_MENU_SHELL(fileMenu), saveChangesMi); + gtk_menu_shell_append(GTK_MENU_SHELL(fileMenu), closeMi); + gtk_menu_shell_append(GTK_MENU_SHELL(fileMenu), fileSep1); + gtk_menu_shell_append(GTK_MENU_SHELL(fileMenu), archiveInfoMi); + gtk_menu_shell_append(GTK_MENU_SHELL(fileMenu), printMi); + gtk_menu_shell_append(GTK_MENU_SHELL(fileMenu), fileSep2); + gtk_menu_shell_append(GTK_MENU_SHELL(fileMenu), quitMi); + /* Add file menu to menu bar */ + gtk_menu_shell_append(GTK_MENU_SHELL(menubar), fileMi); + + /* Edit menu bar items */ + editMi = gtk_menu_item_new_with_mnemonic("_Edit"); + copyMi = gtk_image_menu_item_new_from_stock(GTK_STOCK_COPY, accel_group); + pasteMi = gtk_image_menu_item_new_from_stock(GTK_STOCK_PASTE, accel_group); + pasteSpecialMi = gtk_menu_item_new_with_label("Paste Special"); + editSep1 = gtk_separator_menu_item_new(); + findMi = gtk_image_menu_item_new_from_stock(GTK_STOCK_FIND, accel_group); + editSep2 = gtk_separator_menu_item_new(); + + sortMenu = gtk_menu_new(); + sortMi = gtk_menu_item_new_with_mnemonic("_Sort"); + byOriginalOrderMi = gtk_radio_menu_item_new_with_label(sort_radio_group, "By original order"); + sort_radio_group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(byOriginalOrderMi)); + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(byOriginalOrderMi), TRUE); + byPathnameMi = gtk_radio_menu_item_new_with_label(sort_radio_group, "By pathname"); + sort_radio_group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(byPathnameMi)); + /*gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(byPathnameMi), FALSE);*/ + byFileTypeMi = gtk_radio_menu_item_new_with_label(sort_radio_group, "By file type"); + sort_radio_group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(byFileTypeMi)); + /*gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(byFileTypeMi), FALSE);*/ + byAuxtypeMi = gtk_radio_menu_item_new_with_label(sort_radio_group, "By auxtype"); + sort_radio_group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(byAuxtypeMi)); + /*gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(byAuxtypeMi), FALSE);*/ + byModificationDateMi = gtk_radio_menu_item_new_with_label(sort_radio_group, "By modification date"); + sort_radio_group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(byModificationDateMi)); + /*gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(byModificationDateMi), FALSE);*/ + byFormatMi = gtk_radio_menu_item_new_with_label(sort_radio_group, "By format"); + sort_radio_group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(byFormatMi)); + /*gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(byFormatMi), FALSE);*/ + bySizeMi = gtk_radio_menu_item_new_with_label(sort_radio_group, "By size"); + sort_radio_group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(bySizeMi)); + /*gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(bySizeMi), FALSE);*/ + byRatioMi = gtk_radio_menu_item_new_with_label(sort_radio_group, "By ratio"); + sort_radio_group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(byRatioMi)); + /*gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(byRatioMi), FALSE);*/ + byPackedSizeMi = gtk_radio_menu_item_new_with_label(sort_radio_group, "By packed size"); + sort_radio_group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(byPackedSizeMi)); + /*gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(byPackedSizeMi), FALSE);*/ + byAccessMi = gtk_radio_menu_item_new_with_label(sort_radio_group, "By access"); + sort_radio_group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(byAccessMi)); + /*gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(byAccessMi), FALSE);*/ + + /* 'Sort' submenu */ + gtk_menu_item_set_submenu(GTK_MENU_ITEM(sortMi), sortMenu); + gtk_menu_shell_append(GTK_MENU_SHELL(sortMenu), byOriginalOrderMi); + gtk_menu_shell_append(GTK_MENU_SHELL(sortMenu), byPathnameMi); + gtk_menu_shell_append(GTK_MENU_SHELL(sortMenu), byAuxtypeMi); + gtk_menu_shell_append(GTK_MENU_SHELL(sortMenu), byModificationDateMi); + gtk_menu_shell_append(GTK_MENU_SHELL(sortMenu), byFormatMi); + gtk_menu_shell_append(GTK_MENU_SHELL(sortMenu), bySizeMi); + gtk_menu_shell_append(GTK_MENU_SHELL(sortMenu), byRatioMi); + gtk_menu_shell_append(GTK_MENU_SHELL(sortMenu), byPackedSizeMi); + gtk_menu_shell_append(GTK_MENU_SHELL(sortMenu), byAccessMi); + + selectAllMi = gtk_menu_item_new_with_mnemonic("Select _all"); + gtk_widget_add_accelerator(selectAllMi, "activate", accel_group, GDK_a, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); + invertSelectionMi = gtk_menu_item_new_with_mnemonic("_Invert selection"); + gtk_widget_add_accelerator(invertSelectionMi, "activate", accel_group, GDK_i, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); + preferencesMi = gtk_menu_item_new_with_mnemonic("_Preferences..."); + gtk_widget_add_accelerator(preferencesMi, "activate", accel_group, GDK_p, GDK_CONTROL_MASK|GDK_SHIFT_MASK, GTK_ACCEL_VISIBLE); + + /* Set up edit menu */ + gtk_menu_item_set_submenu(GTK_MENU_ITEM(editMi), editMenu); + gtk_menu_shell_append(GTK_MENU_SHELL(editMenu), copyMi); + gtk_menu_shell_append(GTK_MENU_SHELL(editMenu), pasteMi); + gtk_menu_shell_append(GTK_MENU_SHELL(editMenu), pasteSpecialMi); + gtk_menu_shell_append(GTK_MENU_SHELL(editMenu), editSep1); + gtk_menu_shell_append(GTK_MENU_SHELL(editMenu), findMi); + gtk_menu_shell_append(GTK_MENU_SHELL(editMenu), editSep2); + gtk_menu_shell_append(GTK_MENU_SHELL(editMenu), sortMi); + gtk_menu_shell_append(GTK_MENU_SHELL(editMenu), selectAllMi); + gtk_menu_shell_append(GTK_MENU_SHELL(editMenu), invertSelectionMi); + gtk_menu_shell_append(GTK_MENU_SHELL(editMenu), preferencesMi); + /* Add edit menu to menu bar */ + gtk_menu_shell_append(GTK_MENU_SHELL(menubar), editMi); + + /* connect 'preferences' menu item to the preferences dialog event */ + g_signal_connect(G_OBJECT(preferencesMi), "activate", G_CALLBACK(preferences), NULL); + + /* Action menu bar items */ + actionsMi = gtk_menu_item_new_with_label("Actions"); + viewMi = gtk_menu_item_new_with_mnemonic("_View..."); + extractMi = gtk_menu_item_new_with_mnemonic("_Extract..."); + testMi = gtk_menu_item_new_with_mnemonic("_Test..."); + renameMi = gtk_menu_item_new_with_label("Rename..."); + deleteMi = gtk_menu_item_new_with_label("Delete..."); + recompressMi = gtk_menu_item_new_with_label("Re-compress..."); + actionSep1 = gtk_separator_menu_item_new(); + addFilesMi = gtk_menu_item_new_with_mnemonic("Add _files"); + addDiskImageMi = gtk_menu_item_new_with_mnemonic("Add _disk image"); + createSubdirectoryMi = gtk_menu_item_new_with_mnemonic("Create _subdirectory"); + actionSep2 = gtk_separator_menu_item_new(); + openAsDiskImageMi = gtk_menu_item_new_with_mnemonic("_Open As Disk Image"); + editCommentMi = gtk_menu_item_new_with_mnemonic("Edit _comment..."); + editAttributesMi = gtk_menu_item_new_with_mnemonic("Edit _attributes..."); + renameVolumeMi = gtk_menu_item_new_with_label("Rename Volume..."); + actionSep3 = gtk_separator_menu_item_new(); + convertToDiskImageMi = gtk_menu_item_new_with_mnemonic("_Convert to disk image..."); + convertToArchiveFileMi = gtk_menu_item_new_with_mnemonic("_Convert to archive file..."); + importFileFromWAVMi = gtk_menu_item_new_with_label("Import File From WAV..."); + importBASFromTextMi = gtk_menu_item_new_with_mnemonic("Import _BAS From Text..."); + + /* Set up action menu */ + gtk_menu_item_set_submenu(GTK_MENU_ITEM(actionsMi), actionMenu); + gtk_menu_shell_append(GTK_MENU_SHELL(actionMenu), viewMi); + gtk_menu_shell_append(GTK_MENU_SHELL(actionMenu), extractMi); + gtk_menu_shell_append(GTK_MENU_SHELL(actionMenu), testMi); + gtk_menu_shell_append(GTK_MENU_SHELL(actionMenu), renameMi); + gtk_menu_shell_append(GTK_MENU_SHELL(actionMenu), deleteMi); + gtk_menu_shell_append(GTK_MENU_SHELL(actionMenu), recompressMi); + gtk_menu_shell_append(GTK_MENU_SHELL(actionMenu), actionSep1); + gtk_menu_shell_append(GTK_MENU_SHELL(actionMenu), addFilesMi); + gtk_menu_shell_append(GTK_MENU_SHELL(actionMenu), addDiskImageMi); + gtk_menu_shell_append(GTK_MENU_SHELL(actionMenu), createSubdirectoryMi); + gtk_menu_shell_append(GTK_MENU_SHELL(actionMenu), actionSep2); + gtk_menu_shell_append(GTK_MENU_SHELL(actionMenu), openAsDiskImageMi); + gtk_menu_shell_append(GTK_MENU_SHELL(actionMenu), editCommentMi); + gtk_menu_shell_append(GTK_MENU_SHELL(actionMenu), editAttributesMi); + gtk_menu_shell_append(GTK_MENU_SHELL(actionMenu), renameVolumeMi); + gtk_menu_shell_append(GTK_MENU_SHELL(actionMenu), actionSep3); + gtk_menu_shell_append(GTK_MENU_SHELL(actionMenu), convertToDiskImageMi); + gtk_menu_shell_append(GTK_MENU_SHELL(actionMenu), convertToArchiveFileMi); + gtk_menu_shell_append(GTK_MENU_SHELL(actionMenu), importFileFromWAVMi); + gtk_menu_shell_append(GTK_MENU_SHELL(actionMenu), importBASFromTextMi); + /* Add action menu to menu bar */ + gtk_menu_shell_append(GTK_MENU_SHELL(menubar), actionsMi); + + /* Tools menu bar items */ + toolsMi = gtk_menu_item_new_with_label("Tools"); + diskSectorViewerMi = gtk_menu_item_new_with_mnemonic("_Disk sector viewer"); + diskImageConverterMi = gtk_menu_item_new_with_mnemonic("Disk _image converter"); + bulkDiskImageConverterMi = gtk_menu_item_new_with_mnemonic("_Bulk disk image converter"); + toolsSep1 = gtk_separator_menu_item_new(); + volumeCopierOpenVolumeMi = gtk_menu_item_new_with_mnemonic("_Volume Copier (open volume)"); + volumeCopierOpenFileMi = gtk_menu_item_new_with_label("Volume Copier (open file)"); + mergeSSTImagesMi = gtk_menu_item_new_with_mnemonic("_Merge SST Images"); + toolsSep2 = gtk_separator_menu_item_new(); + TwoMGPropertiesEditorMi = gtk_menu_item_new_with_label("2MG Properties Editor"); + EOLScannerMi = gtk_menu_item_new_with_label("EOL Scanner"); + + /* Set up tools menu */ + gtk_menu_item_set_submenu(GTK_MENU_ITEM(toolsMi), toolsMenu); + gtk_menu_shell_append(GTK_MENU_SHELL(toolsMenu), diskSectorViewerMi); + gtk_menu_shell_append(GTK_MENU_SHELL(toolsMenu), diskImageConverterMi); + gtk_menu_shell_append(GTK_MENU_SHELL(toolsMenu), bulkDiskImageConverterMi); + gtk_menu_shell_append(GTK_MENU_SHELL(toolsMenu), toolsSep1); + gtk_menu_shell_append(GTK_MENU_SHELL(toolsMenu), volumeCopierOpenVolumeMi); + gtk_menu_shell_append(GTK_MENU_SHELL(toolsMenu), volumeCopierOpenFileMi); + gtk_menu_shell_append(GTK_MENU_SHELL(toolsMenu), mergeSSTImagesMi); + gtk_menu_shell_append(GTK_MENU_SHELL(toolsMenu), toolsSep2); + gtk_menu_shell_append(GTK_MENU_SHELL(toolsMenu), TwoMGPropertiesEditorMi); + gtk_menu_shell_append(GTK_MENU_SHELL(toolsMenu), EOLScannerMi); + /* Add Tools menu to menu bar */ + gtk_menu_shell_append(GTK_MENU_SHELL(menubar), toolsMi); + + /* Help menu bar items */ + helpMi = gtk_menu_item_new_with_mnemonic("_Help"); + contentsMi = gtk_menu_item_new_with_mnemonic("_Contents..."); + visitCalvadosWebsiteMi = gtk_menu_item_new_with_mnemonic("Visit Calvados _website"); + helpSep1 = gtk_separator_menu_item_new(); + aboutCalvadosMi = gtk_menu_item_new_with_label("About Calvados"); + + /* Set up help menu */ + gtk_menu_item_set_submenu(GTK_MENU_ITEM(helpMi), helpMenu); + gtk_menu_shell_append(GTK_MENU_SHELL(helpMenu), contentsMi); + gtk_menu_shell_append(GTK_MENU_SHELL(helpMenu), visitCalvadosWebsiteMi); + gtk_menu_shell_append(GTK_MENU_SHELL(helpMenu), helpSep1); + gtk_menu_shell_append(GTK_MENU_SHELL(helpMenu), aboutCalvadosMi); + /* Add help menu to menu bar */ + gtk_menu_shell_append(GTK_MENU_SHELL(menubar), helpMi); + + /* Add menu bar to vbox */ + gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, FALSE, 0); + + /* connect 'open image' menu item to the create welcomeage dialog event */ + g_signal_connect(G_OBJECT(openMi), "activate", G_CALLBACK(open_file), NULL); + + /* connect 'disk image' menu item to the create disk image dialog event */ + g_signal_connect(G_OBJECT(diskImageMi), "activate", G_CALLBACK(create_disk_image), NULL); + + /* connect 'shrinkit archive' menu item to the new archive dialog event */ + g_signal_connect(G_OBJECT(shrinkItArchiveMi), "activate", G_CALLBACK(new_archive), NULL); + + /* connect 'select volume' menu item to the open volume dialog event */ + g_signal_connect(G_OBJECT(openVolumeMi), "activate", G_CALLBACK(select_volume), NULL); + + /* connect 'about' menu item to the about box event */ + g_signal_connect(G_OBJECT(aboutCalvadosMi), "activate", G_CALLBACK(show_about), NULL); + + /* connect 'disk sector viewer' menu item to the popup menu event */ + g_signal_connect(G_OBJECT(diskSectorViewerMi), "activate", G_CALLBACK(disk_sector_viewer_popup), NULL); + + /* Connect 'quit' menu item to the window's "destroy" event */ + g_signal_connect(G_OBJECT(quitMi), "activate", G_CALLBACK(gtk_main_quit), NULL); + + /* Create the tool bar */ + toolbar = gtk_toolbar_new(); + gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS); + + /*newTb = gtk_tool_button_new_from_stock(GTK_STOCK_NEW); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), newTb, -1);*/ + + /*openTb = gtk_tool_button_new_from_stock(GTK_STOCK_OPEN);*/ + openTbImage = gtk_image_new_from_file((gchar *)"images/openTb.png"); + openTb = gtk_tool_button_new((GtkWidget *)openTbImage, "Open"); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), openTb, -1); + + gtk_widget_set_tooltip_text(GTK_WIDGET(openTb), "Open (Ctrl-O)"); + + openVolumeTbImage = gtk_image_new_from_file((gchar *)"images/openVolumeTb.png"); + openVolumeTb = gtk_tool_button_new((GtkWidget *)openVolumeTbImage, "Open Volume"); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), openVolumeTb, -1); + + gtk_widget_set_tooltip_text(GTK_WIDGET(openVolumeTb), "Open volume (Ctrl-Shift-O)"); + + newArchiveTbImage = gtk_image_new_from_file((gchar *)"images/newArchiveTb.png"); + newArchiveTb = gtk_tool_button_new((GtkWidget *)newArchiveTbImage, "New Archive"); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), newArchiveTb, -1); + + gtk_widget_set_tooltip_text(GTK_WIDGET(newArchiveTb), "New Archive (Ctrl-N)"); + + createDiskImageTbImage = gtk_image_new_from_file((gchar *)"images/createDiskImageTb.png"); + createDiskImageTb = gtk_tool_button_new((GtkWidget *)createDiskImageTbImage, "Create Disk Image"); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), createDiskImageTb, -1); + + gtk_widget_set_tooltip_text(GTK_WIDGET(createDiskImageTb), "Create Disk Image"); + + /*saveTb = gtk_tool_button_new_from_stock(GTK_STOCK_SAVE); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), saveTb, -1);*/ + + printTbImage = gtk_image_new_from_file((gchar *)"images/printTb.png"); + printTb = gtk_tool_button_new((GtkWidget *)printTbImage, "Print"); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), printTb, -1); + + gtk_widget_add_accelerator(GTK_WIDGET(printTb), "clicked", accel_group, GDK_p, GDK_CONTROL_MASK, GTK_ACCEL_MASK); + + gtk_widget_set_tooltip_text(GTK_WIDGET(printTb), "Print (Ctrl-P)"); + + tbSep1 = gtk_separator_tool_item_new(); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), tbSep1, -1); + + addFilesTbImage = gtk_image_new_from_file((gchar *)"images/addFilesTb.png"); + addFilesTb = gtk_tool_button_new((GtkWidget *)addFilesTbImage, "Add Files"); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), addFilesTb, -1); + + gtk_widget_set_tooltip_text(GTK_WIDGET(addFilesTb), "Add Files"); + + addDiskImageTbImage = gtk_image_new_from_file((gchar *)"images/addDiskImageTb.png"); + addDiskImageTb = gtk_tool_button_new((GtkWidget *)addDiskImageTbImage, "Add Disk Image"); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), addDiskImageTb, -1); + + gtk_widget_set_tooltip_text(GTK_WIDGET(addDiskImageTb), "Add disk image"); + + viewTbImage = gtk_image_new_from_file((gchar *)"images/viewTb.png"); + viewTb = gtk_tool_button_new((GtkWidget *)viewTbImage, "View"); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), viewTb, -1); + + gtk_widget_set_tooltip_text(GTK_WIDGET(viewTb), "View (tab)"); + + extractTbImage = gtk_image_new_from_file((gchar *)"images/extractTb.png"); + extractTb = gtk_tool_button_new((GtkWidget *)extractTbImage, "Extract"); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), extractTb, -1); + + gtk_widget_set_tooltip_text(GTK_WIDGET(extractTb), "Extract"); + + testTbImage = gtk_image_new_from_file((gchar *)"images/testTb.png"); + testTb = gtk_tool_button_new((GtkWidget *)testTbImage, "Test"); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), testTb, -1); + + gtk_widget_set_tooltip_text(GTK_WIDGET(testTb), "Test"); + + renameTbImage = gtk_image_new_from_file((gchar *)"images/renameTb.png"); + renameTb = gtk_tool_button_new((GtkWidget *)renameTbImage, "Rename"); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), renameTb, -1); + + gtk_widget_set_tooltip_text(GTK_WIDGET(renameTb), "Rename"); + + deleteTbImage = gtk_image_new_from_file((gchar *)"images/deleteTb.png"); + deleteTb = gtk_tool_button_new((GtkWidget *)deleteTbImage, "Delete"); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), deleteTb, -1); + + gtk_widget_set_tooltip_text(GTK_WIDGET(deleteTb), "Delete (DEL)"); + + recompressTbImage = gtk_image_new_from_file((gchar *)"images/recompressTb.png"); + recompressTb = gtk_tool_button_new((GtkWidget *)recompressTbImage, "Re-compress"); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), recompressTb, -1); + + gtk_widget_set_tooltip_text(GTK_WIDGET(recompressTb), "Recompress"); + + editCommentTbImage = gtk_image_new_from_file((gchar *)"images/editCommentTb.png"); + editCommentTb = gtk_tool_button_new((GtkWidget *)editCommentTbImage, "Edit Comment"); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), editCommentTb, -1); + + gtk_widget_set_tooltip_text(GTK_WIDGET(editCommentTb), "Edit Comment"); + + tbSep2 = gtk_separator_tool_item_new(); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), tbSep2, -1); + + diskSectorViewerTbImage = gtk_image_new_from_file((gchar *)"images/diskSectorViewerTb.png"); + diskSectorViewerTb = gtk_tool_button_new((GtkWidget *)diskSectorViewerTbImage, "Disk Sector Viewer"); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), diskSectorViewerTb, -1); + + gtk_widget_set_tooltip_text(GTK_WIDGET(diskSectorViewerTb), "Disk Sector Viewer"); + + diskImageConverterTbImage = gtk_image_new_from_file((gchar *)"images/diskImageConverterTb.png"); + diskImageConverterTb = gtk_tool_button_new((GtkWidget *)diskImageConverterTbImage, "Disk Image Converter"); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), diskImageConverterTb, -1); + + gtk_widget_set_tooltip_text(GTK_WIDGET(diskImageConverterTb), "Disk Image Converter"); + + volumeCopierTbImage = gtk_image_new_from_file((gchar *)"images/volumeCopierTb.png"); + volumeCopierTb = gtk_tool_button_new((GtkWidget *)volumeCopierTbImage, "Volume Copier"); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), volumeCopierTb, -1); + + gtk_widget_set_tooltip_text(GTK_WIDGET(volumeCopierTb), "Volume Copier (open volume)"); + + mergeSSTImagesTbImage = gtk_image_new_from_file((gchar *)"images/mergeSSTImagesTb.png"); + mergeSSTImagesTb = gtk_tool_button_new((GtkWidget *)mergeSSTImagesTbImage, "Merge SST Images"); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), mergeSSTImagesTb, -1); + + gtk_widget_set_tooltip_text(GTK_WIDGET(mergeSSTImagesTb), "Merge SST Images"); + + tbSep3 = gtk_separator_tool_item_new(); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), tbSep3, -1); + + exitTb = gtk_tool_button_new_from_stock(GTK_STOCK_QUIT); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), exitTb, -1); + + gtk_widget_set_tooltip_text(GTK_WIDGET(exitTb), "Exit"); + + /* Hook up the open image button to the open file dialog box */ + g_signal_connect(G_OBJECT(openTb), "clicked", G_CALLBACK(open_file), NULL); + + /* Hook up the create disk image button to the create disk image dialog box */ + g_signal_connect(G_OBJECT(createDiskImageTb), "clicked", G_CALLBACK(create_disk_image), NULL); + + /* Hook up the new archive image button to the create disk image dialog box */ + g_signal_connect(G_OBJECT(newArchiveTb), "clicked", G_CALLBACK(new_archive), NULL); + + /* Hook up the open volume button to the select volume dialog box */ + g_signal_connect(G_OBJECT(openVolumeTb), "clicked", G_CALLBACK(select_volume), NULL); + + /* Hook up the disk sector viewer button to the disk sector viewer popup menu */ + g_signal_connect(G_OBJECT(diskSectorViewerTb), "clicked", G_CALLBACK(disk_sector_viewer_popup), NULL); + + /* Hook up the exit button to the quit function */ + g_signal_connect(G_OBJECT(exitTb), "clicked", G_CALLBACK(gtk_main_quit), NULL); + + /* Add the tool bar to the vbox */ + gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 5); + + /*button = gtk_button_new_with_label("Hello Window"); + gtk_container_add(GTK_CONTAINER(vbox), button); + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(gtk_main_quit), NULL);*/ + + /* Add the status bar */ + statusbar = gtk_statusbar_new(); + gtk_box_pack_end(GTK_BOX(vbox), statusbar, FALSE, TRUE, 0); + + /* connect the windows "destroy" event */ + g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL); + + /* set the window as visible */ + gtk_widget_show_all(window); + + /* run the GTK+ main loop */ + gtk_main(); + + return 0; +} + diff --git a/calvados.h b/calvados.h new file mode 100644 index 0000000..a4a983f --- /dev/null +++ b/calvados.h @@ -0,0 +1,27 @@ +/* + * + * cavaldos.h + * + * Include for cavaldos. + * + */ + +#define WINDOW_WIDTH 1300 +#define WINDOW_HEIGHT 725 + +void close_dialog(GtkWidget *widget, gpointer data); +void closing_dialog(GtkWidget *widget, gpointer data); +void select_volume(); +void show_about(GtkWidget *widget, gpointer data); +void disk_sector_viewer_popup(); +void okfunc_create_disk_image(GtkWidget *widget, gpointer data); +void okfunc_select_volume(GtkWidget *widget, gpointer data); +void help_func_create_disk_image(GtkWidget *widget, gpointer data); +void help_func_select_volume(GtkWidget *widget, gpointer data); +void create_disk_image(); +void do_open_file(char *filename); +void open_file(); +void save_to_file(char *filename); +void new_archive(); +void preferences(); + diff --git a/close_dialog.c b/close_dialog.c new file mode 100644 index 0000000..fb14012 --- /dev/null +++ b/close_dialog.c @@ -0,0 +1,19 @@ +#include +#include + +/* + * + * close_dialog() + * + * Called when closing a dialog + * + */ +void close_dialog(GtkWidget *widget, gpointer data) +{ + /* --- Display message --- */ + /*g_print("Cancel function goes here.\n");*/ + + /* --- Close it. --- */ + gtk_widget_destroy(GTK_WIDGET(data)); +} + diff --git a/closing_dialog.c b/closing_dialog.c new file mode 100644 index 0000000..ceb40e9 --- /dev/null +++ b/closing_dialog.c @@ -0,0 +1,16 @@ +#include +#include + +/* + * + * closing_dialog + * + * Calls when window is about to close. returns FALSE + * to let it close. + * + */ +void closing_dialog(GtkWidget *widget, gpointer data) +{ + gtk_grab_remove(GTK_WIDGET(widget)); +} + diff --git a/create_disk_image.c b/create_disk_image.c new file mode 100644 index 0000000..c4ef9bf --- /dev/null +++ b/create_disk_image.c @@ -0,0 +1,327 @@ +#include +#include + +#include "calvados.h" + +/* + * + * create_disk_image() + * + * Create Disk Image dialog box. + * + */ +void create_disk_image() +{ + GtkWidget *dialog_window; + GtkWidget *ok_button; + GtkWidget *cancel_button; + GtkWidget *help_button; + GtkWidget *hbox1; + GtkWidget *vbox1; + GtkWidget *vbox2; + GtkWidget *filesystemFrame; + GtkWidget *newDiskSizeFrame; + GtkWidget *dosOptionsFrame; + GtkWidget *prodosOptionsFrame; + GtkWidget *pascalOptionsFrame; + GtkWidget *hfsOptionsFrame; + GtkWidget *filesystemVbox; + GtkWidget *newDiskSizeVbox; + GtkWidget *dosOptionsVbox; + GtkWidget *prodosOptionsVbox; + GtkWidget *pascalOptionsVbox; + GtkWidget *hfsOptionsVbox; + GtkWidget *dos32Rb; + GtkWidget *dos33Rb; + GtkWidget *prodosRb; + GtkWidget *pascalRb; + GtkWidget *hfsRb; + GtkWidget *blankRb; + GtkWidget *s140kRb; + GtkWidget *s800kRb; + GtkWidget *s14MRb; + GtkWidget *s5MBRb; + GtkWidget *s16MBRb; + GtkWidget *s20MBRb; + GtkWidget *s32MBRb; + GtkWidget *specifyRb; + GtkWidget *blocksEntry; + GtkWidget *blocksLabel; + GtkWidget *specifyHbox; + GtkWidget *allocateDOSTracksCb; + GtkWidget *diskVolumeLabel; + GtkWidget *diskVolumeEntry; + GtkWidget *diskVolumeHbox; + GtkWidget *prodosVolumeLabel; + GtkWidget *prodosVolumeEntry; + GtkWidget *pascalVolumeLabel; + GtkWidget *pascalVolumeEntry; + GtkWidget *hfsVolumeLabel; + GtkWidget *hfsVolumeEntry; + + /* --- Create the dialog --- */ + dialog_window = gtk_dialog_new(); + + /* --- Trap the window close signal to release the grab --- */ + gtk_signal_connect(GTK_OBJECT(dialog_window), "destroy", + GTK_SIGNAL_FUNC(closing_dialog), + &dialog_window); + + /* --- Set the title --- */ + gtk_window_set_title(GTK_WINDOW(dialog_window), "Create Disk Image"); + + /* --- Add a small border --- */ + gtk_container_border_width(GTK_CONTAINER(dialog_window), 5); + + /* Two columns top portion of dialog vbox */ + hbox1 = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_window)->vbox), hbox1, TRUE, TRUE, 0); + + gtk_widget_show(hbox1); + + /* Left column of hbox1 */ + vbox1 = gtk_vbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox1), vbox1, TRUE, TRUE, 0); + + /* Right column of hbox1 */ + vbox2 = gtk_vbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox1), vbox2, TRUE, TRUE, 0); + + gtk_widget_show(vbox1); + gtk_widget_show(vbox2); + + /* Frames on left column */ + filesystemFrame = gtk_frame_new("Filesystem"); + newDiskSizeFrame = gtk_frame_new("New disk size"); + + /* Frames on right column */ + dosOptionsFrame = gtk_frame_new("DOS options"); + prodosOptionsFrame = gtk_frame_new("ProDOS options"); + pascalOptionsFrame = gtk_frame_new("Pascal options"); + hfsOptionsFrame = gtk_frame_new("HFS options"); + + gtk_box_pack_start(GTK_BOX(vbox1), filesystemFrame, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(vbox1), newDiskSizeFrame, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(vbox2), dosOptionsFrame, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(vbox2), prodosOptionsFrame, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(vbox2), pascalOptionsFrame, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(vbox2), hfsOptionsFrame, TRUE, TRUE, 0); + + gtk_widget_show(filesystemFrame); + gtk_widget_show(newDiskSizeFrame); + gtk_widget_show(dosOptionsFrame); + gtk_widget_show(prodosOptionsFrame); + gtk_widget_show(pascalOptionsFrame); + gtk_widget_show(hfsOptionsFrame); + + filesystemVbox = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(filesystemFrame), filesystemVbox); + gtk_widget_show(filesystemVbox); + + newDiskSizeVbox = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(newDiskSizeFrame), newDiskSizeVbox); + gtk_widget_show(newDiskSizeVbox); + + dosOptionsVbox = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(dosOptionsFrame), dosOptionsVbox); + gtk_widget_show(dosOptionsVbox); + + prodosOptionsVbox = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(prodosOptionsFrame), prodosOptionsVbox); + gtk_widget_show(prodosOptionsVbox); + + pascalOptionsVbox = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(pascalOptionsFrame), pascalOptionsVbox); + gtk_widget_show(pascalOptionsVbox); + + hfsOptionsVbox = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(hfsOptionsFrame), hfsOptionsVbox); + gtk_widget_show(hfsOptionsVbox); + + dos32Rb = gtk_radio_button_new_with_label(NULL, "DOS 3.2 (13-sector)"); + dos33Rb = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(dos32Rb), "DOS 3.3"); + prodosRb = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(dos33Rb), "ProDOS"); + pascalRb = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(prodosRb), "Pascal"); + hfsRb = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(pascalRb), "HFS"); + blankRb = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(hfsRb), "Blank"); + + gtk_box_pack_start(GTK_BOX(filesystemVbox), dos32Rb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(filesystemVbox), dos33Rb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(filesystemVbox), prodosRb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(filesystemVbox), pascalRb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(filesystemVbox), hfsRb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(filesystemVbox), blankRb, TRUE, TRUE, 0); + + gtk_widget_show(dos32Rb); + gtk_widget_show(dos33Rb); + gtk_widget_show(prodosRb); + gtk_widget_show(pascalRb); + gtk_widget_show(hfsRb); + gtk_widget_show(blankRb); + + s140kRb = gtk_radio_button_new_with_label(NULL, "140KB (5.25\" floppy)"); + s800kRb = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(s140kRb), "800KB (3.5\" floppy)"); + s14MRb = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(s800kRb), "1.4MB (3.5\" PC floppy)"); + s5MBRb = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(s14MRb), "5MB"); + s16MBRb = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(s5MBRb), "16MB"); + s20MBRb = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(s16MBRb), "20MB"); + s32MBRb = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(s20MBRb), "32MB (largest ProDOS volume)"); + specifyRb = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(s32MBRb), "Specify size:"); + + specifyHbox = gtk_hbox_new(FALSE, 0); + + blocksEntry = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(blocksEntry), 8); + + blocksLabel = gtk_label_new(" blocks"); + gtk_misc_set_alignment(GTK_MISC(blocksLabel), 0, 0.5); + + gtk_box_pack_start(GTK_BOX(specifyHbox), specifyRb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(specifyHbox), blocksEntry, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(specifyHbox), blocksLabel, TRUE, TRUE, 0); + + gtk_box_pack_start(GTK_BOX(newDiskSizeVbox), s140kRb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(newDiskSizeVbox), s800kRb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(newDiskSizeVbox), s14MRb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(newDiskSizeVbox), s5MBRb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(newDiskSizeVbox), s16MBRb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(newDiskSizeVbox), s20MBRb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(newDiskSizeVbox), s32MBRb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(newDiskSizeVbox), specifyHbox, TRUE, TRUE, 0); + + gtk_widget_show(s140kRb); + gtk_widget_show(s800kRb); + gtk_widget_show(s14MRb); + gtk_widget_show(s5MBRb); + gtk_widget_show(s16MBRb); + gtk_widget_show(s20MBRb); + gtk_widget_show(s32MBRb); + gtk_widget_show(specifyRb); + gtk_widget_show(blocksEntry); + gtk_widget_show(blocksLabel); + gtk_widget_show(specifyHbox); + + allocateDOSTracksCb = gtk_check_button_new_with_label("Allocate DOS tracks"); + + diskVolumeHbox = gtk_hbox_new(FALSE, 0); + + diskVolumeLabel = gtk_label_new("Disk volume: "); + gtk_misc_set_alignment(GTK_MISC(diskVolumeLabel), 0, 0.5); + + diskVolumeEntry = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(diskVolumeEntry), 3); + + gtk_box_pack_start(GTK_BOX(diskVolumeHbox), diskVolumeLabel, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(diskVolumeHbox), diskVolumeEntry, TRUE, TRUE, 0); + + gtk_box_pack_start(GTK_BOX(dosOptionsVbox), allocateDOSTracksCb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(dosOptionsVbox), diskVolumeHbox, TRUE, TRUE, 0); + + gtk_widget_show(allocateDOSTracksCb); + gtk_widget_show(diskVolumeLabel); + gtk_widget_show(diskVolumeEntry); + gtk_widget_show(diskVolumeHbox); + + prodosVolumeLabel = gtk_label_new("ProDOS volume name (15 chars):"); + gtk_misc_set_alignment(GTK_MISC(prodosVolumeLabel), 0, 0.5); + + prodosVolumeEntry = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(prodosVolumeEntry), 15); + + gtk_box_pack_start(GTK_BOX(prodosOptionsVbox), prodosVolumeLabel, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(prodosOptionsVbox), prodosVolumeEntry, TRUE, TRUE, 0); + + gtk_widget_show(prodosVolumeLabel); + gtk_widget_show(prodosVolumeEntry); + + pascalVolumeLabel = gtk_label_new("Pascal volume name (7 chars):"); + gtk_misc_set_alignment(GTK_MISC(pascalVolumeLabel), 0, 0.5); + + pascalVolumeEntry = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(pascalVolumeEntry), 15); + + gtk_box_pack_start(GTK_BOX(pascalOptionsVbox), pascalVolumeLabel, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(pascalOptionsVbox), pascalVolumeEntry, TRUE, TRUE, 0); + + gtk_widget_show(pascalVolumeLabel); + gtk_widget_show(pascalVolumeEntry); + + hfsVolumeLabel = gtk_label_new("HFS volume name (27 chars):"); + gtk_misc_set_alignment(GTK_MISC(hfsVolumeLabel), 0, 0.5); + + hfsVolumeEntry = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(hfsVolumeEntry), 27); + + gtk_box_pack_start(GTK_BOX(hfsOptionsVbox), hfsVolumeLabel, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(hfsOptionsVbox), hfsVolumeEntry, TRUE, TRUE, 0); + + gtk_widget_show(hfsVolumeLabel); + gtk_widget_show(hfsVolumeEntry); + + /* + * --- OK button + */ + + /* --- Create the "OK" button --- */ + ok_button = gtk_button_new_with_label("OK"); + + gtk_signal_connect(GTK_OBJECT(ok_button), "clicked", + GTK_SIGNAL_FUNC(okfunc_create_disk_image), + dialog_window); + + /* --- Allow "Cancel" to be a default --- */ + GTK_WIDGET_SET_FLAGS(ok_button, GTK_CAN_DEFAULT); + + /* --- Add the OK button to the bottom hbox2 --- */ + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_window)->action_area), ok_button, TRUE, TRUE, 0); + + /* --- Make the "OK" the default --- */ + gtk_widget_grab_default(ok_button); + + /* --- Make the button visible --- */ + gtk_widget_show(ok_button); + + /* + * --- Cancel button + */ + + /* --- Create the "Cancel" button --- */ + cancel_button = gtk_button_new_with_label("Cancel"); + + gtk_signal_connect(GTK_OBJECT(cancel_button), "clicked", + GTK_SIGNAL_FUNC(close_dialog), + dialog_window); + + /* --- Allow "Cancel" to be a default --- */ + GTK_WIDGET_SET_FLAGS(cancel_button, GTK_CAN_DEFAULT); + + /* --- Add the "Cancel" button to the dialog --- */ + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_window)->action_area), cancel_button, TRUE, TRUE, 0); + + /* --- Make the button visible. --- */ + gtk_widget_show(cancel_button); + + /* + * --- Help button + */ + + /* --- Create the "Help" button --- */ + help_button = gtk_button_new_with_label("Help"); + + gtk_signal_connect(GTK_OBJECT(help_button), "clicked", + GTK_SIGNAL_FUNC(help_func_create_disk_image), + dialog_window); + + /* --- Add the "Help" button to the dialog --- */ + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_window)->action_area), help_button, TRUE, TRUE, 0); + + /* --- Make the button visible. --- */ + gtk_widget_show(help_button); + + /* --- Show the dialog --- */ + gtk_widget_show(dialog_window); + + /* --- Only this window can be used for now --- */ + gtk_grab_add(dialog_window); +} + diff --git a/disk_sector_viewer_popup.c b/disk_sector_viewer_popup.c new file mode 100644 index 0000000..17dd432 --- /dev/null +++ b/disk_sector_viewer_popup.c @@ -0,0 +1,124 @@ +#include +#include + +#include "calvados.h" + +/* + * + * disk_sector_viewer_popup() + * + * Disk Sector Viewer Popup dialog + * + */ +void disk_sector_viewer_popup() +{ + GtkWidget *dialog_window; + GtkWidget *vbox; + GtkWidget *openDiskButton; + GtkWidget *openVolumeButton; + GtkWidget *openArchiveButton; + GtkWidget *cancelButton; + + /* --- Create a dialog window --- */ + dialog_window = gtk_dialog_new(); + + /* --- Trap the destroy button --- */ + gtk_signal_connect(GTK_OBJECT(dialog_window), "destroy", + GTK_SIGNAL_FUNC(gtk_widget_destroyed), + &dialog_window); + + /* --- Add a title to the window --- */ + /*gtk_window_set_title(GTK_WINDOW(dialog_window), "Disk sector viewer");*/ + gtk_window_set_title(GTK_WINDOW(dialog_window), " "); + + /* --- Create a small border --- */ + gtk_container_border_width(GTK_CONTAINER(dialog_window), 5); + + vbox = gtk_vbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_window)->vbox), vbox, TRUE, TRUE, 0); + gtk_widget_show(vbox); + + /* + * --- "open disk" button + */ + + /* --- Create the "open disk" button --- */ + openDiskButton = gtk_button_new_with_label("Open disk image file"); + + /* --- Need to close the window if they press "ok" --- */ + gtk_signal_connect(GTK_OBJECT(openDiskButton), "clicked", + GTK_SIGNAL_FUNC(close_dialog), + dialog_window); + + /* --- Add the button to the dialog --- */ + gtk_box_pack_start(GTK_BOX(vbox), openDiskButton, TRUE, TRUE, 0); + + /* --- Make the button visible --- */ + gtk_widget_show(openDiskButton); + + /* + * --- "open volume" button + */ + + /* --- Create the "open volume" button --- */ + openVolumeButton = gtk_button_new_with_label("Open logical or physical volume"); + + /* --- Need to close the window if they press "ok" --- */ + gtk_signal_connect(GTK_OBJECT(openVolumeButton), "clicked", + GTK_SIGNAL_FUNC(close_dialog), + dialog_window); + + /* --- Add the button to the dialog --- */ + gtk_box_pack_start(GTK_BOX(vbox), openVolumeButton, TRUE, TRUE, 0); + + /* --- Make the button visible --- */ + gtk_widget_show(openVolumeButton); + + /* + * --- "open archive" button + */ + + /* --- Create the "open archive" button --- */ + openArchiveButton = gtk_button_new_with_label("Open current archive"); + + /* --- Need to close the window if they press "ok" --- */ + gtk_signal_connect(GTK_OBJECT(openArchiveButton), "clicked", + GTK_SIGNAL_FUNC(close_dialog), + dialog_window); + + /* --- Add the button to the dialog --- */ + gtk_box_pack_start(GTK_BOX(vbox), openArchiveButton, TRUE, TRUE, 0); + + /* --- Make the button visible --- */ + gtk_widget_show(openArchiveButton); + + /* + * --- "cancel" button + */ + + /* --- Create the "cancel" button --- */ + cancelButton = gtk_button_new_with_label("Cancel"); + + /* --- Need to close the window if they press "ok" --- */ + gtk_signal_connect(GTK_OBJECT(cancelButton), "clicked", + GTK_SIGNAL_FUNC(close_dialog), + dialog_window); + + /* --- Allow it to be the default button --- */ + GTK_WIDGET_SET_FLAGS(cancelButton, GTK_CAN_DEFAULT); + + /* --- Add the button to the dialog --- */ + gtk_box_pack_start(GTK_BOX(vbox), cancelButton, TRUE, TRUE, 0); + + /* --- Make the button the default button --- */ + gtk_widget_grab_default(cancelButton); + + /* --- Make the button visible --- */ + gtk_widget_show(cancelButton); + + /* --- Make the dialog visible --- */ + gtk_widget_show(dialog_window); + + gtk_grab_add(dialog_window); +} + diff --git a/do_open_file.c b/do_open_file.c new file mode 100644 index 0000000..fcf09f8 --- /dev/null +++ b/do_open_file.c @@ -0,0 +1,18 @@ +#include +#include + +#include "calvados.h" + +/* + * + * do_open_file() + * + * Open a file. + * + */ +void do_open_file(char *filename) +{ + /* --- Display message --- */ + g_print("Open file function goes here.\n"); +} + diff --git a/help_func_create_disk_image.c b/help_func_create_disk_image.c new file mode 100644 index 0000000..ab6c0a1 --- /dev/null +++ b/help_func_create_disk_image.c @@ -0,0 +1,26 @@ +#include +#include + +#include "calvados.h" + +/* + * + * help_func_create_disk_image() + * + * Help Function for create disk image + * + * Show that the "Help" button was pressed + * + */ +void help_func_create_disk_image(GtkWidget *widget, gpointer data) +{ + /* --- Display message --- */ + g_print("Help function goes here.\n"); + + /* --- Close it. --- */ + gtk_widget_destroy(GTK_WIDGET(data)); + + /* Now open the help dialog */ +/*FIXME*/ +} + diff --git a/help_func_select_volume.c b/help_func_select_volume.c new file mode 100644 index 0000000..61279e0 --- /dev/null +++ b/help_func_select_volume.c @@ -0,0 +1,26 @@ +#include +#include + +#include "calvados.h" + +/* + * + * help_func_select_volume() + * + * Help Function for select volume image + * + * Show that the "Help" button was pressed + * + */ +void help_func_select_volume(GtkWidget *widget, gpointer data) +{ + /* --- Display message --- */ + g_print("Help function goes here.\n"); + + /* --- Close it. --- */ + gtk_widget_destroy(GTK_WIDGET(data)); + + /* Now open the help dialog */ +/*FIXME*/ +} + diff --git a/images/addDiskImageTb.png b/images/addDiskImageTb.png new file mode 100644 index 0000000..ff2aed6 Binary files /dev/null and b/images/addDiskImageTb.png differ diff --git a/images/addFilesTb.png b/images/addFilesTb.png new file mode 100644 index 0000000..cb4cfeb Binary files /dev/null and b/images/addFilesTb.png differ diff --git a/images/calvados.png b/images/calvados.png new file mode 100644 index 0000000..b5ceb0a Binary files /dev/null and b/images/calvados.png differ diff --git a/images/createDiskImageTb.png b/images/createDiskImageTb.png new file mode 100644 index 0000000..391458d Binary files /dev/null and b/images/createDiskImageTb.png differ diff --git a/images/deleteTb.png b/images/deleteTb.png new file mode 100644 index 0000000..bc28313 Binary files /dev/null and b/images/deleteTb.png differ diff --git a/images/diskImageConverterTb.png b/images/diskImageConverterTb.png new file mode 100644 index 0000000..c118a44 Binary files /dev/null and b/images/diskImageConverterTb.png differ diff --git a/images/diskSectorViewerTb.png b/images/diskSectorViewerTb.png new file mode 100644 index 0000000..174cf48 Binary files /dev/null and b/images/diskSectorViewerTb.png differ diff --git a/images/editCommentTb.png b/images/editCommentTb.png new file mode 100644 index 0000000..8dcd409 Binary files /dev/null and b/images/editCommentTb.png differ diff --git a/images/extractTb.png b/images/extractTb.png new file mode 100644 index 0000000..429476f Binary files /dev/null and b/images/extractTb.png differ diff --git a/images/mergeSSTImagesTb.png b/images/mergeSSTImagesTb.png new file mode 100644 index 0000000..8d804be Binary files /dev/null and b/images/mergeSSTImagesTb.png differ diff --git a/images/newArchiveTb.png b/images/newArchiveTb.png new file mode 100644 index 0000000..9eae077 Binary files /dev/null and b/images/newArchiveTb.png differ diff --git a/images/openTb.png b/images/openTb.png new file mode 100644 index 0000000..eae5eb4 Binary files /dev/null and b/images/openTb.png differ diff --git a/images/openVolumeTb.png b/images/openVolumeTb.png new file mode 100644 index 0000000..5e470cb Binary files /dev/null and b/images/openVolumeTb.png differ diff --git a/images/printTb.png b/images/printTb.png new file mode 100644 index 0000000..7ec80c4 Binary files /dev/null and b/images/printTb.png differ diff --git a/images/recompressTb.png b/images/recompressTb.png new file mode 100644 index 0000000..c08709c Binary files /dev/null and b/images/recompressTb.png differ diff --git a/images/renameTb.png b/images/renameTb.png new file mode 100644 index 0000000..2e9e657 Binary files /dev/null and b/images/renameTb.png differ diff --git a/images/testTb.png b/images/testTb.png new file mode 100644 index 0000000..fe80c27 Binary files /dev/null and b/images/testTb.png differ diff --git a/images/viewTb.png b/images/viewTb.png new file mode 100644 index 0000000..5af6691 Binary files /dev/null and b/images/viewTb.png differ diff --git a/images/volumeCopierTb.png b/images/volumeCopierTb.png new file mode 100644 index 0000000..568d110 Binary files /dev/null and b/images/volumeCopierTb.png differ diff --git a/new_archive.c b/new_archive.c new file mode 100644 index 0000000..effc5de --- /dev/null +++ b/new_archive.c @@ -0,0 +1,39 @@ +#include +#include + +#include "calvados.h" + +/* + * + * new_archive() + * + * New archive dialog box. + * + */ +void new_archive() +{ + GtkWidget *dialog; + + dialog = gtk_file_chooser_dialog_new("New Archive", + NULL, + GTK_FILE_CHOOSER_ACTION_SAVE, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, + NULL); + gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), TRUE); + + gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), "Desktop"); + gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), "new.shk"); + + + if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { + char *filename; + + filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); + save_to_file(filename); + g_free(filename); + } + + gtk_widget_destroy(dialog); +} + diff --git a/okfunc_create_disk_image.c b/okfunc_create_disk_image.c new file mode 100644 index 0000000..bfccadc --- /dev/null +++ b/okfunc_create_disk_image.c @@ -0,0 +1,23 @@ +#include +#include + +#include "calvados.h" + +/* + * + * okfunc_create_disk_image() + * + * OK Function for create disk image + * + * Show that the "OK" button was pressed + * + */ +void okfunc_create_disk_image(GtkWidget *widget, gpointer data) +{ + /* --- Display message --- */ + g_print("Create function goes here.\n"); + + /* --- Close it. --- */ + gtk_widget_destroy(GTK_WIDGET(data)); +} + diff --git a/okfunc_select_volume.c b/okfunc_select_volume.c new file mode 100644 index 0000000..ac48042 --- /dev/null +++ b/okfunc_select_volume.c @@ -0,0 +1,23 @@ +#include +#include + +#include "calvados.h" + +/* + * + * okfunc_select_volume() + * + * OK Function for select volume + * + * Show that the "OK" button was pressed + * + */ +void okfunc_select_volume(GtkWidget *widget, gpointer data) +{ + /* --- Display message --- */ + g_print("Create function goes here.\n"); + + /* --- Close it. --- */ + gtk_widget_destroy(GTK_WIDGET(data)); +} + diff --git a/open_file.c b/open_file.c new file mode 100644 index 0000000..5c81d41 --- /dev/null +++ b/open_file.c @@ -0,0 +1,38 @@ +#include +#include + +#include "calvados.h" + +/* + * + * open_file() + * + * Open file dialog + * + */ +void open_file() +{ + GtkWidget *dialog; + gint res; + + dialog = gtk_file_chooser_dialog_new("Open", + NULL, + GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, + GTK_RESPONSE_ACCEPT, + NULL); + + res = gtk_dialog_run(GTK_DIALOG(dialog)); + if (res == GTK_RESPONSE_ACCEPT) { + char *filename; + GtkFileChooser *chooser = GTK_FILE_CHOOSER(dialog); + filename = gtk_file_chooser_get_filename(chooser); + do_open_file(filename); + g_free(filename); + } + + gtk_widget_destroy(dialog); +} + diff --git a/preferences.c b/preferences.c new file mode 100644 index 0000000..bc24989 --- /dev/null +++ b/preferences.c @@ -0,0 +1,901 @@ +#include +#include + +#include "calvados.h" + +/* + * + * apply_func_preferences() + * + * Actually do apply of preferences. + * + */ +void apply_func_preferences() +{ + g_print("Apply function goes here.\n"); +} + + +/* + * + * help_func_preferences() + * + * Help function for preferences + * + */ +void help_func_preferences() +{ + g_print("Help function goes here.\n"); +} + + +/* + * + * page_switch() + * + * Event that occurs when a different page is now + * the focus. + * + */ +static void page_switch(GtkWidget *widget, + GtkNotebookPage *page, + gint page_num) +{ + g_print("page switch\n"); +} + + +/* + * + * add_page() + * + * Add a page to the notebook + * + * notebook - existing notebook + * szName - name to give to the new page + * + */ +GtkWidget *add_page(GtkWidget *notebook, char *szName) +{ + GtkWidget *label; + /*GtkWidget *frame;*/ + GtkWidget *pageVbox; + + /* --- Create a label from the name. --- */ + label = gtk_label_new(szName); + gtk_widget_show(label); + + /* --- Create a frame for the page --- */ + /*frame = gtk_frame_new(szName);*/ + /*gtk_widget_show(frame);*/ + pageVbox = gtk_vbox_new(FALSE, 0); + gtk_widget_show(pageVbox); + + /* --- Add a page with the frame and label --- */ + /*gtk_notebook_append_page(GTK_NOTEBOOK(notebook), frame, label);*/ + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageVbox, label); + + /*return (frame);*/ + return pageVbox; +} + + +/* + * + * create_notebook() + * + * Create a new notebook and add pages to it. + * + * window - window to create the notebook in. + * + */ +GtkWidget *create_notebook(GtkWidget *window, GtkPositionType pos) +{ + GtkWidget *box1; + GtkWidget *notebook; + + /* --- Let us know when getting destroyed. --- */ + gtk_signal_connect(GTK_OBJECT(window), "destroy", + GTK_SIGNAL_FUNC(gtk_widget_destroyed), + &window); + + /* --- Set border width --- */ + gtk_container_border_width(GTK_CONTAINER(window), 0); + + box1 = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(window), box1); + + /* --- Create the notebook --- */ + notebook = gtk_notebook_new(); + + /* --- Listen for the switch page event --- */ + gtk_signal_connect(GTK_OBJECT(notebook), "switch_page", + GTK_SIGNAL_FUNC(page_switch), NULL); + + /* --- Make sure tabs are set on correct side --- */ + gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), pos); + + /* --- Add notebook to vbox --- */ + gtk_box_pack_start(GTK_BOX(box1), notebook, TRUE, TRUE, 0); + + /* --- Give notebook a border --- */ + gtk_container_border_width(GTK_CONTAINER(notebook), 10); + + /* --- Show everything. --- */ + gtk_widget_show_all(window); + + return notebook; +} + + +/* + * + * preferences() + * + * Preferences dialog box + * + */ +void preferences() +{ + GtkWidget *dialog_window; + GtkWidget *dialogVbox; + GtkWidget *notebook; + GtkWidget *generalTab; + GtkWidget *diskImagesTab; + GtkWidget *fileViewerTab; + GtkWidget *compressionTab; + GtkWidget *filesTab; + GtkWidget *generalHbox; + GtkWidget *actionHbox; + GtkWidget *columnsFrame; + GtkWidget *generalLeftVbox; + GtkWidget *pathnameCb; + GtkWidget *typeCb; + GtkWidget *auxTypeCb; + GtkWidget *modDateCb; + GtkWidget *formatCb; + GtkWidget *sizeCb; + GtkWidget *ratioCb; + GtkWidget *packedCb; + GtkWidget *accessCb; + GtkWidget *defaultsButton; + GtkWidget *generalRightVbox; + GtkWidget *nufxArchivesFrame; + GtkWidget *filenameMungingFrame; + GtkWidget *systemFrame; + GtkWidget *miscellaneousFrame; + GtkWidget *nufxArchivesVbox; + GtkWidget *filenameMungingVbox; + GtkWidget *systemVbox; + GtkWidget *miscellaneousVbox; + GtkWidget *mimicShrinkitQuirksCb; + GtkWidget *handleBadMacArchivesCb; + GtkWidget *reduceErrorCheckingCb; + GtkWidget *displayDOS33FilenamesCb; + GtkWidget *showSpacesAsUnderscoresCb; + GtkWidget *fileTypeAssociationsButton; + GtkWidget *stripPathnamesWhenPastingFilesCb; + GtkWidget *beepWhenActionsCompleteSuccessfullyCb; + GtkWidget *generalRightSpacerBox; + GtkWidget *generalLeftSpacerBox; + GtkWidget *diskImagesVbox; + GtkWidget *generalFrame; + GtkWidget *prodosFrame; + GtkWidget *generalVbox; + GtkWidget *prodosVbox; + GtkWidget *confirmDiskImageFormatCb; + GtkWidget *defaultToReadOnlyCb; + GtkWidget *allowWriteAccessCb; + GtkWidget *allowLowerCaseLettersCb; + GtkWidget *useSparseAllocationCb; + GtkWidget *diskImagesSpacerBox; + GtkWidget *fileViewerVbox; + GtkWidget *convertersFrame; + GtkWidget *conversionOptionsFrame; + GtkWidget *convertersVbox; + GtkWidget *convertersHbox; + GtkWidget *convertersLeftVbox; + GtkWidget *convertersRightVbox; + GtkWidget *compressionVbox; + /*GtkWidget *spacerBox;*/ + GtkWidget *highASCIITextCb; + GtkWidget *cpmTextCb; + GtkWidget *pascalTextCb; + GtkWidget *pascalCodeCb; + GtkWidget *applesoftBASICCb; + GtkWidget *integerBASICCb; + GtkWidget *assemblySourceCb; + GtkWidget *proDOSFoldersCb; + GtkWidget *disassembleCodeCb; + GtkWidget *resourceForksCb; + GtkWidget *gwpTeachAWGSCb; + GtkWidget *eightBitWordProcessorCb; + GtkWidget *appleworksWPCb; + GtkWidget *appleworksDBCb; + GtkWidget *appleworksSSCb; + GtkWidget *hiresImagesCb; + GtkWidget *doubleHiresImagesCb; + GtkWidget *superHiresImagesCb; + GtkWidget *printShopGraphicsCb; + GtkWidget *macpaintImagesCb; + GtkWidget *relaxTypeCheckingOnGraphicsCb; + GtkWidget *scrollHorizontallyCb; + GtkWidget *highlightHexDumpColumnsCb; + GtkWidget *preferSyntaxHighlightingCb; + GtkWidget *disassembleBRKCOPCp; + GtkWidget *preferBWforHiresImagesCb; + GtkAdjustment *viewerFileSizeAdjustment; + GtkWidget *preferredDHRHbox; + GtkWidget *preferredDHRLabel; + GList *preferredDHRComboItems = NULL; + GtkWidget *preferredDHRCombo; + GtkWidget *viewerFileSizeHbox; + GtkWidget *viewerFileSizeLabel; + GtkWidget *viewerFileSizeSpinner; + GtkWidget *kBytesLabel; + GtkWidget *conversionOptionsVbox; + GtkWidget *defaultCompressionMethodLabel; + GtkWidget *noCompressionCb; + GtkWidget *squeezeCb; + GtkWidget *squeezeLabel; + GtkWidget *dynamicLZW1Cb; + GtkWidget *dynamicLZW1Label; + GtkWidget *dynamicLZW2Cb; + GtkWidget *dynamicLZW2Label; + GtkWidget *twelveBitLZCCb; + GtkWidget *twelveBitLZCLabel; + GtkWidget *sixteenBitLZCCb; + GtkWidget *sixteenBitLZCLabel; + GtkWidget *deflateCb; + GtkWidget *deflateLabel; + GtkWidget *bzip2Cb; + GtkWidget *bzip2Label; + GtkWidget *filesVbox; + GtkWidget *folderForTemporaryFilesLabel; + GtkWidget *ok_button; + GtkWidget *cancel_button; + GtkWidget *apply_button; + GtkWidget *help_button; + + /* --- Create the dialog --- */ + /*dialog_window = gtk_dialog_new();*/ + dialog_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + + /* --- Trap the window close signal to release the grab --- */ + gtk_signal_connect(GTK_OBJECT(dialog_window), "destroy", + GTK_SIGNAL_FUNC(closing_dialog), + &dialog_window); + + /* --- Set the title --- */ + gtk_window_set_title(GTK_WINDOW(dialog_window), "Preferences"); + + /* --- Add a small border --- */ + gtk_container_border_width(GTK_CONTAINER(dialog_window), 5); + + /* --- Set the window size. --- */ + /*gtk_widget_set_usize(dialog_window, 500, 450);*/ + + /* --- Show the dialog --- */ + gtk_widget_show(dialog_window); + + dialogVbox = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(dialog_window), dialogVbox); + gtk_widget_show(dialogVbox); + + /*notebook = create_notebook(dialog_window, GTK_POS_TOP);*/ + notebook = create_notebook(dialogVbox, GTK_POS_TOP); + + /* --- Add pages to the notebook --- */ + generalTab = add_page(notebook, "General"); + diskImagesTab = add_page(notebook, "Disk Images"); + fileViewerTab = add_page(notebook, "File Viewer"); + compressionTab = add_page(notebook, "Compression"); + filesTab = add_page(notebook, "Files"); + + /* General tab */ + generalHbox = gtk_hbox_new(FALSE, 0); + + gtk_widget_show(generalHbox); + + gtk_container_add(GTK_CONTAINER(generalTab), generalHbox); + + columnsFrame = gtk_frame_new("Columns"); + + gtk_widget_show(columnsFrame); + + gtk_box_pack_start(GTK_BOX(generalHbox), columnsFrame, TRUE, TRUE, 0); + + /* Left side of general tab */ + generalLeftVbox = gtk_vbox_new(FALSE, 0); + + gtk_container_add(GTK_CONTAINER(columnsFrame), generalLeftVbox); + + gtk_widget_show(generalLeftVbox); + + pathnameCb = gtk_check_button_new_with_label("Pathname"); + typeCb = gtk_check_button_new_with_label("Type"); + auxTypeCb = gtk_check_button_new_with_label("Aux Type"); + modDateCb = gtk_check_button_new_with_label("Mod Date"); + formatCb = gtk_check_button_new_with_label("Format"); + sizeCb = gtk_check_button_new_with_label("Size"); + ratioCb = gtk_check_button_new_with_label("Ratio"); + packedCb = gtk_check_button_new_with_label("Packed"); + accessCb = gtk_check_button_new_with_label("Access"); + defaultsButton = gtk_button_new_with_label("Defaults"); + + gtk_box_pack_start(GTK_BOX(generalLeftVbox), pathnameCb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(generalLeftVbox), typeCb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(generalLeftVbox), auxTypeCb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(generalLeftVbox), modDateCb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(generalLeftVbox), formatCb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(generalLeftVbox), sizeCb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(generalLeftVbox), ratioCb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(generalLeftVbox), packedCb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(generalLeftVbox), accessCb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(generalLeftVbox), defaultsButton, TRUE, TRUE, 0); + + gtk_widget_show(pathnameCb); + gtk_widget_show(typeCb); + gtk_widget_show(auxTypeCb); + gtk_widget_show(modDateCb); + gtk_widget_show(formatCb); + gtk_widget_show(sizeCb); + gtk_widget_show(ratioCb); + gtk_widget_show(packedCb); + gtk_widget_show(accessCb); + gtk_widget_show(defaultsButton); + + /* Left spacer */ + generalLeftSpacerBox = gtk_button_new_with_label(" "); + gtk_box_pack_start(GTK_BOX(generalLeftVbox), generalLeftSpacerBox, TRUE, TRUE, 0); + gtk_widget_show(generalLeftSpacerBox); + + /* Right side of general tab */ + generalRightVbox = gtk_vbox_new(FALSE, 0); + + gtk_box_pack_start(GTK_BOX(generalHbox), generalRightVbox, TRUE, TRUE, 0); + + gtk_widget_show(generalRightVbox); + + nufxArchivesFrame = gtk_frame_new("NuFX (ShrinkIt) archives"); + filenameMungingFrame = gtk_frame_new("Filename munging"); + systemFrame = gtk_frame_new("System"); + miscellaneousFrame = gtk_frame_new("Miscellaneous"); + + gtk_box_pack_start(GTK_BOX(generalRightVbox), nufxArchivesFrame, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(generalRightVbox), filenameMungingFrame, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(generalRightVbox), systemFrame, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(generalRightVbox), miscellaneousFrame, TRUE, TRUE, 0); + + gtk_widget_show(nufxArchivesFrame); + gtk_widget_show(filenameMungingFrame); + gtk_widget_show(systemFrame); + gtk_widget_show(miscellaneousFrame); + + nufxArchivesVbox = gtk_vbox_new(FALSE, 0); + filenameMungingVbox = gtk_vbox_new(FALSE, 0); + systemVbox = gtk_vbox_new(FALSE, 0); + miscellaneousVbox = gtk_vbox_new(FALSE, 0); + + gtk_container_add(GTK_CONTAINER(nufxArchivesFrame), nufxArchivesVbox); + gtk_container_add(GTK_CONTAINER(filenameMungingFrame), filenameMungingVbox); + gtk_container_add(GTK_CONTAINER(systemFrame), systemVbox); + gtk_container_add(GTK_CONTAINER(miscellaneousFrame), miscellaneousVbox); + + gtk_widget_show(nufxArchivesVbox); + gtk_widget_show(filenameMungingVbox); + gtk_widget_show(systemVbox); + gtk_widget_show(miscellaneousVbox); + + /* NuFX frame */ + mimicShrinkitQuirksCb = gtk_check_button_new_with_label("Mimic ShrinkIt Quirks"); + handleBadMacArchivesCb = gtk_check_button_new_with_label("Handle \"bad Mac\" archives"); + reduceErrorCheckingCb = gtk_check_button_new_with_label("Reduce error checking (not recommended)"); + + gtk_box_pack_start(GTK_BOX(nufxArchivesVbox), mimicShrinkitQuirksCb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(nufxArchivesVbox), handleBadMacArchivesCb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(nufxArchivesVbox), reduceErrorCheckingCb, TRUE, TRUE, 0); + + gtk_widget_show(mimicShrinkitQuirksCb); + gtk_widget_show(handleBadMacArchivesCb); + gtk_widget_show(reduceErrorCheckingCb); + + /* Filename munging frame */ + displayDOS33FilenamesCb = gtk_check_button_new_with_label("Display DOS 3.3 Filenames in lower case"); + showSpacesAsUnderscoresCb = gtk_check_button_new_with_label("Show spaces as underscores"); + + gtk_box_pack_start(GTK_BOX(filenameMungingVbox), displayDOS33FilenamesCb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(filenameMungingVbox), showSpacesAsUnderscoresCb, TRUE, TRUE, 0); + + gtk_widget_show(displayDOS33FilenamesCb); + gtk_widget_show(showSpacesAsUnderscoresCb); + + /* System frame */ + fileTypeAssociationsButton = gtk_button_new_with_label("File type associations"); + + gtk_box_pack_start(GTK_BOX(systemVbox), fileTypeAssociationsButton, TRUE, TRUE, 0); + + gtk_widget_show(fileTypeAssociationsButton); + + /* Miscellaneous frame */ + stripPathnamesWhenPastingFilesCb = gtk_check_button_new_with_label("Strip pathnames when pasting files"); + beepWhenActionsCompleteSuccessfullyCb = gtk_check_button_new_with_label("Beep when actions complete successfully"); + + gtk_box_pack_start(GTK_BOX(miscellaneousVbox), stripPathnamesWhenPastingFilesCb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(miscellaneousVbox), beepWhenActionsCompleteSuccessfullyCb, TRUE, TRUE, 0); + + gtk_widget_show(stripPathnamesWhenPastingFilesCb); + gtk_widget_show(beepWhenActionsCompleteSuccessfullyCb); + + /* Right spacer */ + generalRightSpacerBox = gtk_button_new_with_label(" "); + gtk_box_pack_start(GTK_BOX(generalRightVbox), generalRightSpacerBox, TRUE, TRUE, 0); + gtk_widget_show(generalRightSpacerBox); + + /* Disk images tab */ + diskImagesVbox = gtk_vbox_new(FALSE, 0); + + gtk_container_add(GTK_CONTAINER(diskImagesTab), diskImagesVbox); + + gtk_widget_show(diskImagesVbox); + + /* General frame */ + generalFrame = gtk_frame_new("General"); + + gtk_widget_show(generalFrame); + + gtk_box_pack_start(GTK_BOX(diskImagesVbox), generalFrame, TRUE, TRUE, 0); + + generalVbox = gtk_vbox_new(FALSE, 0); + + gtk_container_add(GTK_CONTAINER(generalFrame), generalVbox); + + gtk_widget_show(generalVbox); + + confirmDiskImageFormatCb = gtk_check_button_new_with_label("Confirm disk image format"); + + gtk_box_pack_start(GTK_BOX(generalVbox), confirmDiskImageFormatCb, TRUE, TRUE, 0); + + gtk_widget_show(confirmDiskImageFormatCb); + + defaultToReadOnlyCb = gtk_check_button_new_with_label("Default to read-only when opening volumes"); + + gtk_box_pack_start(GTK_BOX(generalVbox), defaultToReadOnlyCb, TRUE, TRUE, 0); + + gtk_widget_show(defaultToReadOnlyCb); + + allowWriteAccessCb = gtk_check_button_new_with_label("Allow write access to physical disk 0 (not recommended)"); + + gtk_box_pack_start(GTK_BOX(generalVbox), allowWriteAccessCb, TRUE, TRUE, 0); + + gtk_widget_show(allowWriteAccessCb); + + /* ProDOS frame */ + prodosFrame = gtk_frame_new("ProDOS"); + + gtk_widget_show(prodosFrame); + + gtk_box_pack_start(GTK_BOX(diskImagesVbox), prodosFrame, TRUE, TRUE, 0); + + prodosVbox = gtk_vbox_new(FALSE, 0); + + gtk_container_add(GTK_CONTAINER(prodosFrame), prodosVbox); + + gtk_widget_show(prodosVbox); + + allowLowerCaseLettersCb = gtk_check_button_new_with_label("Allow lower case letters and spaces in filenames"); + + gtk_box_pack_start(GTK_BOX(prodosVbox), allowLowerCaseLettersCb, TRUE, TRUE, 0); + + gtk_widget_show(allowLowerCaseLettersCb); + + useSparseAllocationCb = gtk_check_button_new_with_label("Use sparse allocation for empty blocks"); + + gtk_box_pack_start(GTK_BOX(prodosVbox), useSparseAllocationCb, TRUE, TRUE, 0); + + gtk_widget_show(useSparseAllocationCb); + + /* spacer */ + diskImagesSpacerBox = gtk_button_new_with_label(" "); + gtk_box_pack_start(GTK_BOX(diskImagesVbox), diskImagesSpacerBox, TRUE, TRUE, 0); + gtk_widget_show(diskImagesSpacerBox); + + /* File viewer Tab */ + fileViewerVbox = gtk_vbox_new(FALSE, 0); + + gtk_container_add(GTK_CONTAINER(fileViewerTab), fileViewerVbox); + + gtk_widget_show(fileViewerVbox); + + /* File viewer frames */ + convertersFrame = gtk_frame_new("Converters"); + + gtk_box_pack_start(GTK_BOX(fileViewerVbox), convertersFrame, TRUE, TRUE, 0); + + conversionOptionsFrame = gtk_frame_new("Conversion options"); + + gtk_box_pack_start(GTK_BOX(fileViewerVbox), conversionOptionsFrame, TRUE, TRUE, 0); + + gtk_widget_show(convertersFrame); + gtk_widget_show(conversionOptionsFrame); + + /* Converters frame */ + convertersVbox = gtk_vbox_new(FALSE, 0); + + gtk_container_add(GTK_CONTAINER(convertersFrame), convertersVbox); + + gtk_widget_show(convertersVbox); + + convertersHbox = gtk_hbox_new(FALSE, 0); + + gtk_widget_show(convertersHbox); + + gtk_box_pack_start(GTK_BOX(convertersVbox), convertersHbox, TRUE, TRUE, 0); + + convertersLeftVbox = gtk_vbox_new(FALSE, 0); + + gtk_box_pack_start(GTK_BOX(convertersHbox), convertersLeftVbox, TRUE, TRUE, 0); + + convertersRightVbox = gtk_vbox_new(FALSE, 0); + + gtk_box_pack_start(GTK_BOX(convertersHbox), convertersRightVbox, TRUE, TRUE, 0); + + gtk_widget_show(convertersVbox); + + gtk_widget_show(convertersHbox); + + gtk_widget_show(convertersRightVbox); + + gtk_widget_show(convertersLeftVbox); + + /* Left side of converters frame */ + highASCIITextCb = gtk_check_button_new_with_label("High-ASCII text"); + gtk_box_pack_start(GTK_BOX(convertersLeftVbox), highASCIITextCb, TRUE, TRUE, 0); + gtk_widget_show(highASCIITextCb); + + cpmTextCb = gtk_check_button_new_with_label("CP/M text"); + gtk_box_pack_start(GTK_BOX(convertersLeftVbox), cpmTextCb, TRUE, TRUE, 0); + gtk_widget_show(cpmTextCb); + + pascalTextCb = gtk_check_button_new_with_label("Pascal text"); + gtk_box_pack_start(GTK_BOX(convertersLeftVbox), pascalTextCb, TRUE, TRUE, 0); + gtk_widget_show(pascalTextCb); + + pascalCodeCb = gtk_check_button_new_with_label("Pascal code"); + gtk_box_pack_start(GTK_BOX(convertersLeftVbox), pascalCodeCb, TRUE, TRUE, 0); + gtk_widget_show(pascalCodeCb); + + applesoftBASICCb = gtk_check_button_new_with_label("Applesoft BASIC"); + gtk_box_pack_start(GTK_BOX(convertersLeftVbox), applesoftBASICCb, TRUE, TRUE, 0); + gtk_widget_show(applesoftBASICCb); + + integerBASICCb = gtk_check_button_new_with_label("Integer BASIC"); + gtk_box_pack_start(GTK_BOX(convertersLeftVbox), integerBASICCb, TRUE, TRUE, 0); + gtk_widget_show(integerBASICCb); + + assemblySourceCb = gtk_check_button_new_with_label("Assembly source"); + gtk_box_pack_start(GTK_BOX(convertersLeftVbox), assemblySourceCb, TRUE, TRUE, 0); + gtk_widget_show(assemblySourceCb); + + proDOSFoldersCb = gtk_check_button_new_with_label("ProDOS folders"); + gtk_box_pack_start(GTK_BOX(convertersLeftVbox), proDOSFoldersCb, TRUE, TRUE, 0); + gtk_widget_show(proDOSFoldersCb); + + disassembleCodeCb = gtk_check_button_new_with_label("Disassemble code"); + gtk_box_pack_start(GTK_BOX(convertersLeftVbox), disassembleCodeCb, TRUE, TRUE, 0); + gtk_widget_show(disassembleCodeCb); + + resourceForksCb = gtk_check_button_new_with_label("Resource forks"); + gtk_box_pack_start(GTK_BOX(convertersLeftVbox), resourceForksCb, TRUE, TRUE, 0); + gtk_widget_show(resourceForksCb); + + /* Right side of converters frame */ + gwpTeachAWGSCb = gtk_check_button_new_with_label("GWP (Teach, AWGS)"); + gtk_box_pack_start(GTK_BOX(convertersRightVbox), gwpTeachAWGSCb, TRUE, TRUE, 0); + gtk_widget_show(gwpTeachAWGSCb); + + eightBitWordProcessorCb = gtk_check_button_new_with_label("8-bit word processor"); + gtk_box_pack_start(GTK_BOX(convertersRightVbox), eightBitWordProcessorCb, TRUE, TRUE, 0); + gtk_widget_show(eightBitWordProcessorCb); + + appleworksWPCb = gtk_check_button_new_with_label("AppleWorks WP"); + gtk_box_pack_start(GTK_BOX(convertersRightVbox), appleworksWPCb, TRUE, TRUE, 0); + gtk_widget_show(appleworksWPCb); + + appleworksDBCb = gtk_check_button_new_with_label("AppleWorks DB"); + gtk_box_pack_start(GTK_BOX(convertersRightVbox), appleworksDBCb, TRUE, TRUE, 0); + gtk_widget_show(appleworksDBCb); + + appleworksSSCb = gtk_check_button_new_with_label("AppleWorks SS"); + gtk_box_pack_start(GTK_BOX(convertersRightVbox), appleworksSSCb, TRUE, TRUE, 0); + gtk_widget_show(appleworksSSCb); + + hiresImagesCb = gtk_check_button_new_with_label("Hi-Res images"); + gtk_box_pack_start(GTK_BOX(convertersRightVbox), hiresImagesCb, TRUE, TRUE, 0); + gtk_widget_show(hiresImagesCb); + + doubleHiresImagesCb = gtk_check_button_new_with_label("Double Hi-Res images"); + gtk_box_pack_start(GTK_BOX(convertersRightVbox), doubleHiresImagesCb, TRUE, TRUE, 0); + gtk_widget_show(doubleHiresImagesCb); + + superHiresImagesCb = gtk_check_button_new_with_label("Super Hi-Res images"); + gtk_box_pack_start(GTK_BOX(convertersRightVbox), superHiresImagesCb, TRUE, TRUE, 0); + gtk_widget_show(superHiresImagesCb); + + printShopGraphicsCb = gtk_check_button_new_with_label("Print Shop graphics"); + gtk_box_pack_start(GTK_BOX(convertersRightVbox), printShopGraphicsCb, TRUE, TRUE, 0); + gtk_widget_show(printShopGraphicsCb); + + macpaintImagesCb = gtk_check_button_new_with_label("MacPaint images"); + gtk_box_pack_start(GTK_BOX(convertersRightVbox), macpaintImagesCb, TRUE, TRUE, 0); + gtk_widget_show(macpaintImagesCb); + + /* Last one in converter frame */ + relaxTypeCheckingOnGraphicsCb = gtk_check_button_new_with_label("Relax type-checking on graphics"); + gtk_box_pack_start(GTK_BOX(convertersVbox), relaxTypeCheckingOnGraphicsCb, TRUE, TRUE, 0); + gtk_widget_show(relaxTypeCheckingOnGraphicsCb); + + /* Conversion options frame */ + conversionOptionsVbox = gtk_vbox_new(FALSE, 0); + + gtk_container_add(GTK_CONTAINER(conversionOptionsFrame), conversionOptionsVbox); + + gtk_widget_show(conversionOptionsVbox); + + scrollHorizontallyCb = gtk_check_button_new_with_label("Scroll horizontally instead of wrapping words"); + gtk_box_pack_start(GTK_BOX(conversionOptionsVbox), scrollHorizontallyCb, TRUE, TRUE, 0); + gtk_widget_show(scrollHorizontallyCb); + + highlightHexDumpColumnsCb = gtk_check_button_new_with_label("Highlight hex dump columns (small files)"); + gtk_box_pack_start(GTK_BOX(conversionOptionsVbox), highlightHexDumpColumnsCb, TRUE, TRUE, 0); + gtk_widget_show(highlightHexDumpColumnsCb); + + preferSyntaxHighlightingCb = gtk_check_button_new_with_label("Prefer syntax highlighting on BASIC programs"); + gtk_box_pack_start(GTK_BOX(conversionOptionsVbox), preferSyntaxHighlightingCb, TRUE, TRUE, 0); + gtk_widget_show(preferSyntaxHighlightingCb); + + disassembleBRKCOPCp = gtk_check_button_new_with_label("Disassemble BRK/COP as single-byte instructions"); + gtk_box_pack_start(GTK_BOX(conversionOptionsVbox), disassembleBRKCOPCp, TRUE, TRUE, 0); + gtk_widget_show(disassembleBRKCOPCp); + + preferBWforHiresImagesCb = gtk_check_button_new_with_label("Prefer B&W for hi-res images"); + gtk_box_pack_start(GTK_BOX(conversionOptionsVbox), preferBWforHiresImagesCb, TRUE, TRUE, 0); + gtk_widget_show(preferBWforHiresImagesCb); + + preferredDHRHbox = gtk_hbox_new(FALSE, 0); + + gtk_box_pack_start(GTK_BOX(conversionOptionsVbox), preferredDHRHbox, TRUE, TRUE, 0); + + gtk_widget_show(preferredDHRHbox); + + preferredDHRLabel = gtk_label_new("Preferred DHR"); + gtk_misc_set_alignment(GTK_MISC(preferredDHRLabel), 0, 0.5); + gtk_box_pack_start(GTK_BOX(preferredDHRHbox), preferredDHRLabel, TRUE, TRUE, 0); + gtk_widget_show(preferredDHRLabel); + + /* + * --- Create a list of the items first + */ + preferredDHRComboItems = g_list_append(preferredDHRComboItems, "Black & White"); + preferredDHRComboItems = g_list_append(preferredDHRComboItems, "Latched color (recommended)"); + preferredDHRComboItems = g_list_append(preferredDHRComboItems, "Simple 140"); + preferredDHRComboItems = g_list_append(preferredDHRComboItems, "Sliding window"); + + /* --- Make a combo box. --- */ + preferredDHRCombo = gtk_combo_new(); + + /* --- Create the drop down portion of the combo --- */ + gtk_combo_set_popdown_strings(GTK_COMBO(preferredDHRCombo), preferredDHRComboItems); + + /* --- Default the text in the field to a value --- */ + gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(preferredDHRCombo)->entry), "Latched color (recommended)"); + + /* --- Make the edit portion non-editable. They can pick a + * value from the drop down, they just can't end up with + * a value that's not in the drop down. + */ + gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(preferredDHRCombo)->entry), FALSE); + + gtk_box_pack_start(GTK_BOX(preferredDHRHbox), preferredDHRCombo, TRUE, TRUE, 0); + + gtk_widget_show(preferredDHRCombo); + + viewerFileSizeHbox = gtk_hbox_new(FALSE, 0); + + gtk_box_pack_start(GTK_BOX(fileViewerVbox), viewerFileSizeHbox, TRUE, TRUE, 0); + + gtk_widget_show(viewerFileSizeHbox); + + viewerFileSizeLabel = gtk_label_new("Viewer file size"); + gtk_misc_set_alignment(GTK_MISC(viewerFileSizeLabel), 0, 0.5); + gtk_box_pack_start(GTK_BOX(viewerFileSizeHbox), viewerFileSizeLabel, TRUE, TRUE, 0); + gtk_widget_show(viewerFileSizeLabel); + + viewerFileSizeAdjustment = (GtkAdjustment *)gtk_adjustment_new(1024, 0, 32767, 64, 64, 0); + viewerFileSizeSpinner = gtk_spin_button_new(viewerFileSizeAdjustment, 1.0, 5); + gtk_box_pack_start(GTK_BOX(viewerFileSizeHbox), viewerFileSizeSpinner, TRUE, TRUE, 0); + gtk_widget_show(viewerFileSizeSpinner); + + kBytesLabel = gtk_label_new("kBytes"); + gtk_misc_set_alignment(GTK_MISC(kBytesLabel), 0, 0.5); + gtk_widget_show(kBytesLabel); + gtk_box_pack_start(GTK_BOX(viewerFileSizeHbox), kBytesLabel, TRUE, TRUE, 0); + + + /* Compression tab */ + compressionVbox = gtk_vbox_new(FALSE, 0); + + gtk_container_add(GTK_CONTAINER(compressionTab), compressionVbox); + + gtk_widget_show(compressionVbox); + + defaultCompressionMethodLabel = gtk_label_new("Default compression method:"); + gtk_widget_show(defaultCompressionMethodLabel); + gtk_box_pack_start(GTK_BOX(compressionVbox), defaultCompressionMethodLabel, TRUE, TRUE, 0); + + noCompressionCb = gtk_check_button_new_with_label("No compression"); + gtk_box_pack_start(GTK_BOX(compressionVbox), noCompressionCb, TRUE, TRUE, 0); + gtk_widget_show(noCompressionCb); + + squeezeCb = gtk_check_button_new_with_label("Squeeze"); + gtk_box_pack_start(GTK_BOX(compressionVbox), squeezeCb, TRUE, TRUE, 0); + gtk_widget_show(squeezeCb); + + squeezeLabel = gtk_label_new("Uses a combination of RLE and Huffman.\rNot compatible with ProDOS 8 ShrinkIt."); + gtk_box_pack_start(GTK_BOX(compressionVbox), squeezeLabel, TRUE, TRUE, 0); + gtk_widget_show(squeezeLabel); + + dynamicLZW1Cb = gtk_check_button_new_with_label("Dynamic LZW/1"); + gtk_box_pack_start(GTK_BOX(compressionVbox), dynamicLZW1Cb, TRUE, TRUE, 0); + gtk_widget_show(dynamicLZW1Cb); + + dynamicLZW1Label = gtk_label_new("The compression method used by ProDOS 8 ShrinkIt."); + gtk_box_pack_start(GTK_BOX(compressionVbox), dynamicLZW1Label, TRUE, TRUE, 0); + gtk_widget_show(dynamicLZW1Label); + + dynamicLZW2Cb = gtk_check_button_new_with_label("Dynamic LZW/2 (recommended)"); + gtk_box_pack_start(GTK_BOX(compressionVbox), dynamicLZW2Cb, TRUE, TRUE, 0); + gtk_widget_show(dynamicLZW2Cb); + + dynamicLZW2Label = gtk_label_new("The compression method used by GS/ShrinkIt"); + gtk_box_pack_start(GTK_BOX(compressionVbox), dynamicLZW2Label, TRUE, TRUE, 0); + gtk_widget_show(dynamicLZW2Label); + + twelveBitLZCCb = gtk_check_button_new_with_label("12-bit LZC"); + gtk_box_pack_start(GTK_BOX(compressionVbox), twelveBitLZCCb, TRUE, TRUE, 0); + gtk_widget_show(twelveBitLZCCb); + + twelveBitLZCLabel = gtk_label_new("Compression used by UNIX \"compress\" command.\rNot compatible with ProDOS 8 ShrinkIt."); + gtk_box_pack_start(GTK_BOX(compressionVbox), twelveBitLZCLabel, TRUE, TRUE, 0); + gtk_widget_show(twelveBitLZCLabel); + + sixteenBitLZCCb = gtk_check_button_new_with_label("16-bit LZC"); + gtk_box_pack_start(GTK_BOX(compressionVbox), sixteenBitLZCCb, TRUE, TRUE, 0); + gtk_widget_show(sixteenBitLZCCb); + + sixteenBitLZCLabel = gtk_label_new("Compression used by UNIX \"compress\" command.\rNot compatible with ProDOS 8 ShrinkIt."); + gtk_box_pack_start(GTK_BOX(compressionVbox), sixteenBitLZCLabel, TRUE, TRUE, 0); + gtk_widget_show(sixteenBitLZCLabel); + + deflateCb = gtk_check_button_new_with_label("deflate"); + gtk_box_pack_start(GTK_BOX(compressionVbox), deflateCb, TRUE, TRUE, 0); + gtk_widget_show(deflateCb); + + deflateLabel = gtk_label_new("Uses a combination of RLE and Huffman.\rNot compatible with ProDOS 8 ShrinkIt."); + gtk_box_pack_start(GTK_BOX(compressionVbox), deflateLabel, TRUE, TRUE, 0); + gtk_widget_show(deflateLabel); + + bzip2Cb = gtk_check_button_new_with_label("Bzip2"); + gtk_box_pack_start(GTK_BOX(compressionVbox), bzip2Cb, TRUE, TRUE, 0); + gtk_widget_show(bzip2Cb); + + bzip2Label = gtk_label_new("Compression used by bzip2.\rNot compatible with any Apple II applications."); + gtk_box_pack_start(GTK_BOX(compressionVbox), bzip2Label, TRUE, TRUE, 0); + gtk_widget_show(bzip2Label); + + + /* Files tab */ + filesVbox = gtk_vbox_new(FALSE, 0); + + gtk_container_add(GTK_CONTAINER(filesTab), filesVbox); + + gtk_widget_show(filesVbox); + + folderForTemporaryFilesLabel = gtk_label_new("Folder for temporary files:"); + gtk_widget_show(folderForTemporaryFilesLabel); + gtk_box_pack_start(GTK_BOX(filesVbox), folderForTemporaryFilesLabel, TRUE, TRUE, 0); + + + /* spacer */ + /*spacerBox = gtk_button_new_with_label(" "); + gtk_box_pack_start(GTK_BOX(dialogVbox), spacerBox, TRUE, TRUE, 0); + gtk_widget_show(spacerBox);*/ + + /* Action area */ + actionHbox = gtk_hbox_new(FALSE, 0); + + gtk_widget_show(actionHbox); + + gtk_container_add(GTK_CONTAINER(dialogVbox), actionHbox); + + /* + * --- OK button + */ + + /* --- Create the "OK" button --- */ + ok_button = gtk_button_new_with_label("OK"); + + gtk_signal_connect(GTK_OBJECT(ok_button), "clicked", + GTK_SIGNAL_FUNC(okfunc_create_disk_image), + dialog_window); + + /* --- Allow "Cancel" to be a default --- */ + GTK_WIDGET_SET_FLAGS(ok_button, GTK_CAN_DEFAULT); + + /* --- Add the OK button to the bottom hbox2 --- */ + gtk_box_pack_start(GTK_BOX(actionHbox), ok_button, TRUE, TRUE, 0); + + /* --- Make the "OK" the default --- */ + gtk_widget_grab_default(ok_button); + + /* --- Make the button visible --- */ + gtk_widget_show(ok_button); + + /* + * --- Cancel button + */ + + /* --- Create the "Cancel" button --- */ + cancel_button = gtk_button_new_with_label("Cancel"); + + gtk_signal_connect(GTK_OBJECT(cancel_button), "clicked", + GTK_SIGNAL_FUNC(close_dialog), + dialog_window); + + /* --- Allow "Cancel" to be a default --- */ + GTK_WIDGET_SET_FLAGS(cancel_button, GTK_CAN_DEFAULT); + + /* --- Add the "Cancel" button to the dialog --- */ + gtk_box_pack_start(GTK_BOX(actionHbox), cancel_button, TRUE, TRUE, 0); + + /* --- Make the button visible. --- */ + gtk_widget_show(cancel_button); + + /* + * --- Apply button + */ + + /* --- Create the "Apply" button --- */ + apply_button = gtk_button_new_with_label("Apply"); + + gtk_signal_connect(GTK_OBJECT(apply_button), "clicked", + GTK_SIGNAL_FUNC(apply_func_preferences), + dialog_window); + + /* --- Add the "Apply" button to the dialog --- */ + gtk_box_pack_start(GTK_BOX(actionHbox), apply_button, TRUE, TRUE, 0); + + /* --- Make the button visible. --- */ + gtk_widget_show(apply_button); + + /* + * --- Help button + */ + + /* --- Create the "Help" button --- */ + help_button = gtk_button_new_with_label("Help"); + + gtk_signal_connect(GTK_OBJECT(help_button), "clicked", + GTK_SIGNAL_FUNC(help_func_preferences), + dialog_window); + + /* --- Add the "Help" button to the dialog --- */ + gtk_box_pack_start(GTK_BOX(actionHbox), help_button, TRUE, TRUE, 0); + + /* --- Make the button visible. --- */ + gtk_widget_show(help_button); + + /* --- Only this window can be used for now --- */ + gtk_grab_add(dialog_window); +} + diff --git a/save_to_file.c b/save_to_file.c new file mode 100644 index 0000000..3744fe8 --- /dev/null +++ b/save_to_file.c @@ -0,0 +1,17 @@ +#include +#include + +#include "calvados.h" + +/* + * + * save_to_file() + * + * Actually save data to a file + * + */ +void save_to_file(char *filename) +{ + g_print("Save to file goes here.\n"); +} + diff --git a/select_volume.c b/select_volume.c new file mode 100644 index 0000000..b8292c6 --- /dev/null +++ b/select_volume.c @@ -0,0 +1,204 @@ +#include +#include + +#include "calvados.h" + +enum { + COL_VOLUME_OR_DEVICE_NAME = 0, + COL_REMARK, + NUM_SELECT_VOLUME_COLS +}; + + +/* + * + * select_volume() + * + * Select volume dialog box + * + */ +void select_volume() +{ + GtkWidget *dialog_window; + GtkWidget *ok_button; + GtkWidget *cancel_button; + GtkWidget *help_button; + GtkWidget *showLabel; + GList *showComboItems = NULL; + GtkWidget *showCombo; + GtkWidget *showHbox; + GtkListStore *store; + /*GtkTreeIter iter;*/ + GtkCellRenderer *renderer; + GtkTreeModel *model; + GtkWidget *view; + GtkWidget *openAsReadOnlyCB; + + /* --- Create the dialog --- */ + dialog_window = gtk_dialog_new(); + + /* --- Trap the window close signal to release the grab --- */ + gtk_signal_connect(GTK_OBJECT(dialog_window), "destroy", + GTK_SIGNAL_FUNC(closing_dialog), + &dialog_window); + + /* --- Set the title --- */ + gtk_window_set_title(GTK_WINDOW(dialog_window), "Select Volume"); + + /* --- Add a small border --- */ + gtk_container_border_width(GTK_CONTAINER(dialog_window), 5); + + showHbox = gtk_hbox_new(FALSE, 0); + + showLabel = gtk_label_new("Show: "); + gtk_misc_set_alignment(GTK_MISC(showLabel), 0, 0.5); + + /* + * --- Create a list of the items first + */ + showComboItems = g_list_append(showComboItems, "Both logical and physical"); + showComboItems = g_list_append(showComboItems, "Logical volumes"); + showComboItems = g_list_append(showComboItems, "Physical disks"); + + /* --- Make a combo box. --- */ + showCombo = gtk_combo_new(); + + /* --- Create the drop down portion of the combo --- */ + gtk_combo_set_popdown_strings(GTK_COMBO(showCombo), showComboItems); + + /* --- Default the text in the field to a value --- */ + gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(showCombo)->entry), "Both logical and physical"); + + /* --- Make the edit portion non-editable. They can pick a + * value from the drop down, they just can't end up with + * a value that's not in the drop down. + */ + gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(showCombo)->entry), FALSE); + + gtk_box_pack_start(GTK_BOX(showHbox), showLabel, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(showHbox), showCombo, TRUE, TRUE, 0); + + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_window)->vbox), showHbox, TRUE, TRUE, 0); + + gtk_widget_show(showLabel); + gtk_widget_show(showCombo); + gtk_widget_show(showHbox); + + store = gtk_list_store_new(NUM_SELECT_VOLUME_COLS, G_TYPE_STRING, G_TYPE_UINT); + +/*FIXME*/ + /* This needs to be in a loop reading from somewhere */ + /* Append a row and fill in some data */ + /*gtk_list_store_append(store, &iter); + gtk_list_store_set(store, &iter, + COL_VOLUME_OR_DEVICE_NAME, "", + COL_REMARK, "", + -1);*/ + + view = gtk_tree_view_new(); + + /* --- Column #1 --- */ + renderer = gtk_cell_renderer_text_new(); + gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), + -1, + "Volume or Device Name", + renderer, + "text", COL_VOLUME_OR_DEVICE_NAME, + NULL); + + /* --- Column #2 --- */ + renderer = gtk_cell_renderer_text_new(); + gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), + -1, + "Remark", + renderer, + "text", COL_REMARK, + NULL); + + model = GTK_TREE_MODEL(store); + + gtk_tree_view_set_model(GTK_TREE_VIEW(view), model); + + /* The tree view has acquired its own reference to the + * model, so we can drop ours. That way the model will + * be freed automatically when the tree view is destroyed */ + g_object_unref(model); + + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_window)->vbox), view, TRUE, TRUE, 0); + + gtk_widget_show(view); + + openAsReadOnlyCB = gtk_check_button_new_with_label("Open as read-only (writing to the volume will be disabled)"); + gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(openAsReadOnlyCB), TRUE); + + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_window)->vbox), openAsReadOnlyCB, TRUE, TRUE, 0); + + gtk_widget_show(openAsReadOnlyCB); + + /* + * --- OK button + */ + + /* --- Create the "OK" button --- */ + ok_button = gtk_button_new_with_label("OK"); + + gtk_signal_connect(GTK_OBJECT(ok_button), "clicked", + GTK_SIGNAL_FUNC(okfunc_select_volume), + dialog_window); + + /* --- Allow "Cancel" to be a default --- */ + GTK_WIDGET_SET_FLAGS(ok_button, GTK_CAN_DEFAULT); + + /* --- Add the OK button to the bottom hbox2 --- */ + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_window)->action_area), ok_button, TRUE, TRUE, 0); + + /* --- Make the "OK" the default --- */ + gtk_widget_grab_default(ok_button); + + /* --- Make the button visible --- */ + gtk_widget_show(ok_button); + + /* + * --- Cancel button + */ + + /* --- Create the "Cancel" button --- */ + cancel_button = gtk_button_new_with_label("Cancel"); + + gtk_signal_connect(GTK_OBJECT(cancel_button), "clicked", + GTK_SIGNAL_FUNC(close_dialog), + dialog_window); + + /* --- Allow "Cancel" to be a default --- */ + GTK_WIDGET_SET_FLAGS(cancel_button, GTK_CAN_DEFAULT); + + /* --- Add the "Cancel" button to the dialog --- */ + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_window)->action_area), cancel_button, TRUE, TRUE, 0); + + /* --- Make the button visible. --- */ + gtk_widget_show(cancel_button); + + /* + * --- Help button + */ + + /* --- Create the "Help" button --- */ + help_button = gtk_button_new_with_label("Help"); + + gtk_signal_connect(GTK_OBJECT(help_button), "clicked", + GTK_SIGNAL_FUNC(help_func_select_volume), + dialog_window); + + /* --- Add the "Help" button to the dialog --- */ + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_window)->action_area), help_button, TRUE, TRUE, 0); + + /* --- Make the button visible. --- */ + gtk_widget_show(help_button); + + /* --- Show the dialog --- */ + gtk_widget_show(dialog_window); + + /* --- Only this window can be used for now --- */ + gtk_grab_add(dialog_window); +} + diff --git a/show_about.c b/show_about.c new file mode 100644 index 0000000..eaf10c4 --- /dev/null +++ b/show_about.c @@ -0,0 +1,28 @@ +#include +#include + +/* + * + * show_about() + * + * Show the about box + * + */ +void show_about(GtkWidget *widget, gpointer data) +{ + GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file("images/calvados.png", NULL); + + GtkWidget *dialog = gtk_about_dialog_new(); + gtk_about_dialog_set_name(GTK_ABOUT_DIALOG(dialog), "Calvados"); + gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog), "0.1"); + gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(dialog),"(c) Leeland Heins"); + gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(dialog), + "Calvados is intended to be a work-alike of CiderPress for Linux."); + gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(dialog), + "http://softwarejanitor.com"); + gtk_about_dialog_set_logo(GTK_ABOUT_DIALOG(dialog), pixbuf); + g_object_unref(pixbuf), pixbuf = NULL; + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); +} +