Add files via upload

This commit is contained in:
Leeland Heins 2017-03-13 23:04:47 -05:00 committed by GitHub
parent f9577e74fe
commit c5dda859f2
37 changed files with 2514 additions and 0 deletions

29
Makefile Normal file
View File

@ -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)

629
calvados.c Normal file
View File

@ -0,0 +1,629 @@
/*
*
* cavaldos.c
*
* Designed to be a workalike of CiderPress.
*
* 20170310 Leeland Heins
*
*/
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#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;
}

27
calvados.h Normal file
View File

@ -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();

19
close_dialog.c Normal file
View File

@ -0,0 +1,19 @@
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
/*
*
* 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));
}

16
closing_dialog.c Normal file
View File

@ -0,0 +1,16 @@
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
/*
*
* 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));
}

327
create_disk_image.c Normal file
View File

@ -0,0 +1,327 @@
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#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);
}

124
disk_sector_viewer_popup.c Normal file
View File

@ -0,0 +1,124 @@
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#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);
}

18
do_open_file.c Normal file
View File

@ -0,0 +1,18 @@
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#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");
}

View File

@ -0,0 +1,26 @@
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#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*/
}

26
help_func_select_volume.c Normal file
View File

@ -0,0 +1,26 @@
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#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*/
}

BIN
images/addDiskImageTb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

BIN
images/addFilesTb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 B

BIN
images/calvados.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

BIN
images/deleteTb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

BIN
images/editCommentTb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

BIN
images/extractTb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

BIN
images/mergeSSTImagesTb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

BIN
images/newArchiveTb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 B

BIN
images/openTb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

BIN
images/openVolumeTb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

BIN
images/printTb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

BIN
images/recompressTb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 B

BIN
images/renameTb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 B

BIN
images/testTb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

BIN
images/viewTb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 B

BIN
images/volumeCopierTb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

39
new_archive.c Normal file
View File

@ -0,0 +1,39 @@
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#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);
}

View File

@ -0,0 +1,23 @@
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#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");