From 28ddc73c6bf8cb6d25e871b070cd7d93599b5c06 Mon Sep 17 00:00:00 2001 From: Tom White Date: Mon, 29 Sep 2008 12:06:21 +0100 Subject: Line wrapping in src/displaywindow.c --- src/displaywindow.c | 125 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 73 insertions(+), 52 deletions(-) diff --git a/src/displaywindow.c b/src/displaywindow.c index a038c8c..0049747 100644 --- a/src/displaywindow.c +++ b/src/displaywindow.c @@ -132,13 +132,14 @@ static void displaywindow_about(GtkWidget *widget, DisplayWindow *dw) { gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(window), PACKAGE_VERSION); gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(window), "(c) 2006-2007 Thomas White and contributors"); gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(window), "Diffraction Tomography Reconstruction"); - gtk_about_dialog_set_license(GTK_ABOUT_DIALOG(window), "(c) 2006-2007 Thomas White \n" - "Virtual trackball (c) Copyright 1993, 1994, Silicon Graphics, Inc.\n" - "See Credits for a full list of contributors\n" - "\n" - "Research funded by:\n" - "FEI Electron Optics B.V.\n" - "The Engineering and Physical Sciences Research Council"); + gtk_about_dialog_set_license(GTK_ABOUT_DIALOG(window), + "(c) 2006-2007 Thomas White \n" + "Virtual trackball (c) Copyright 1993, 1994, Silicon Graphics, Inc.\n" + "See Credits for a full list of contributors\n" + "\n" + "Research funded by:\n" + "FEI Electron Optics B.V.\n" + "The Engineering and Physical Sciences Research Council"); gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(window), "http://www-hrem.msm.cam.ac.uk/"); gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(window), authors); @@ -223,7 +224,8 @@ static gint displaywindow_savecache(GtkWidget *widget, DisplayWindow *dw) { GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL); - g_signal_connect(G_OBJECT(dw->savecache_window), "response", G_CALLBACK(displaywindow_savecache_response), dw->ctx); + g_signal_connect(G_OBJECT(dw->savecache_window), "response", G_CALLBACK(displaywindow_savecache_response), + dw->ctx); gtk_widget_show_all(dw->savecache_window); return 0; @@ -272,7 +274,8 @@ static gint displaywindow_setaxis(GtkWidget *widget, DisplayWindow *dw) { GtkWidget *label; dw->tiltaxis_window = gtk_dialog_new_with_buttons("Set Tilt Axis Position", GTK_WINDOW(dw->window), - GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CLOSE, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); + GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CLOSE, GTK_STOCK_OK, GTK_RESPONSE_OK, + NULL); vbox = gtk_vbox_new(FALSE, 0); hbox = gtk_hbox_new(TRUE, 0); @@ -378,37 +381,45 @@ static void displaywindow_addmenubar(DisplayWindow *dw) { GtkActionEntry entries[] = { - { "FileAction", NULL, "_File", NULL, NULL, NULL }, - { "SaveCacheAction", "filesave", "Save Image Analysis to _Cache", NULL, NULL, G_CALLBACK(displaywindow_savecache) }, - { "SaveHKLAction", GTK_STOCK_SAVE, "Save Reflections", NULL, NULL, G_CALLBACK(displaywindow_savehkl) }, - { "CloseAction", GTK_STOCK_QUIT, "_Quit", NULL, NULL, G_CALLBACK(displaywindow_close) }, - - { "ViewAction", NULL, "_View", NULL, NULL, NULL }, - - { "ToolsAction", NULL, "_Tools", NULL, NULL, NULL }, - { "DirAxAction", "dtr-dirax", "Start _DirAx", "D", NULL, G_CALLBACK(displaywindow_dirax) }, - { "DirAxReRunAction", NULL, "Run another DirAx cycle", NULL, NULL, G_CALLBACK(displaywindow_dirax_rerun) }, - { "StopDirAxAction", NULL, "Stop DirAx", NULL, NULL, G_CALLBACK(displaywindow_dirax_stop) }, - { "RefineStepAction", "dtr-refine", "Refine Unit Cell", NULL, NULL, G_CALLBACK(displaywindow_refinestep) }, - { "RefineSeqAction", "dtr-refineall", "Run Refinement Sequence", NULL, NULL, G_CALLBACK(displaywindow_refinestack) }, - { "SetAxisAction", "dtr-tiltaxis", "Set Tilt Axis Position...", NULL, NULL, G_CALLBACK(displaywindow_setaxis) }, - { "IncrAxisAction", NULL, "Increase Tilt Axis Position", "Up", NULL, G_CALLBACK(displaywindow_incraxis) }, - { "DecrAxisAction", NULL, "Decrease Tilt Axis Position", "Down", NULL, G_CALLBACK(displaywindow_decraxis) }, - { "ExtractIntensitiesAction", "dtr-quantify", "Quantify Reflection Intensities", NULL, NULL, G_CALLBACK(displaywindow_extract) }, - - { "HelpAction", NULL, "_Help", NULL, NULL, NULL }, - { "AboutAction", GTK_STOCK_ABOUT, "_About DTR...", NULL, NULL, G_CALLBACK(displaywindow_about) }, - - { "ButtonDirAxAction", "dtr-dirax", "Run _DirAx", NULL, NULL, G_CALLBACK(displaywindow_dirax) }, - { "ButtonTiltAxisAction", "dtr-tiltaxis", "Tilt Axis", NULL, NULL, G_CALLBACK(displaywindow_setaxis) }, - { "ButtonRefineStepAction", "dtr-refine", "Refine", NULL, NULL, G_CALLBACK(displaywindow_refinestep) }, - { "ButtonRefineSeqAction", "dtr-refineall", "Sequence", NULL, NULL, G_CALLBACK(displaywindow_refinestack) }, - { "ButtonFirstImageAction", GTK_STOCK_GOTO_FIRST, "First Image", NULL, NULL, G_CALLBACK(displaywindow_image_first) }, - { "ButtonPrevImageAction", GTK_STOCK_GO_BACK, "Previous Image", NULL, NULL, G_CALLBACK(displaywindow_image_prev) }, - { "ButtonNextImageAction", GTK_STOCK_GO_FORWARD, "Next Image", NULL, NULL, G_CALLBACK(displaywindow_image_next) }, - { "ButtonLastImageAction", GTK_STOCK_GOTO_LAST, "Last Image", NULL, NULL, G_CALLBACK(displaywindow_image_last) }, - { "ButtonExtractIntensitiesAction", "dtr-quantify", "Quantify", NULL, NULL, G_CALLBACK(displaywindow_extract) }, - + { "FileAction", NULL, "_File", NULL, NULL, NULL }, + { "SaveCacheAction", "filesave", "Save Image Analysis to _Cache", + NULL, NULL, G_CALLBACK(displaywindow_savecache) }, + { "SaveHKLAction", GTK_STOCK_SAVE, "Save Reflections", NULL, NULL, G_CALLBACK(displaywindow_savehkl) }, + { "CloseAction", GTK_STOCK_QUIT, "_Quit", NULL, NULL, G_CALLBACK(displaywindow_close) }, + + { "ViewAction", NULL, "_View", NULL, NULL, NULL }, + + { "ToolsAction", NULL, "_Tools", NULL, NULL, NULL }, + { "DirAxAction", "dtr-dirax", "Start _DirAx", "D", NULL, G_CALLBACK(displaywindow_dirax) }, + { "DirAxReRunAction", NULL, "Run another DirAx cycle", NULL, NULL, G_CALLBACK(displaywindow_dirax_rerun) }, + { "StopDirAxAction", NULL, "Stop DirAx", NULL, NULL, G_CALLBACK(displaywindow_dirax_stop) }, + { "RefineStepAction", "dtr-refine", "Refine Unit Cell", NULL, NULL, G_CALLBACK(displaywindow_refinestep) }, + { "RefineSeqAction", "dtr-refineall", "Run Refinement Sequence", + NULL, NULL, G_CALLBACK(displaywindow_refinestack) }, + { "SetAxisAction", "dtr-tiltaxis", "Set Tilt Axis Position...", NULL, NULL, G_CALLBACK(displaywindow_setaxis) }, + { "IncrAxisAction", NULL, "Increase Tilt Axis Position", "Up", NULL, G_CALLBACK(displaywindow_incraxis) }, + { "DecrAxisAction", NULL, "Decrease Tilt Axis Position", + "Down", NULL, G_CALLBACK(displaywindow_decraxis) }, + { "ExtractIntensitiesAction", "dtr-quantify", "Quantify Reflection Intensities", + NULL, NULL, G_CALLBACK(displaywindow_extract) }, + + { "HelpAction", NULL, "_Help", NULL, NULL, NULL }, + { "AboutAction", GTK_STOCK_ABOUT, "_About DTR...", NULL, NULL, G_CALLBACK(displaywindow_about) }, + + { "ButtonDirAxAction", "dtr-dirax", "Run _DirAx", NULL, NULL, G_CALLBACK(displaywindow_dirax) }, + { "ButtonTiltAxisAction", "dtr-tiltaxis", "Tilt Axis", NULL, NULL, G_CALLBACK(displaywindow_setaxis) }, + { "ButtonRefineStepAction", "dtr-refine", "Refine", NULL, NULL, G_CALLBACK(displaywindow_refinestep) }, + { "ButtonRefineSeqAction", "dtr-refineall", "Sequence", NULL, NULL, G_CALLBACK(displaywindow_refinestack) }, + { "ButtonFirstImageAction", GTK_STOCK_GOTO_FIRST, "First Image", + NULL, NULL, G_CALLBACK(displaywindow_image_first) }, + { "ButtonPrevImageAction", GTK_STOCK_GO_BACK, "Previous Image", + NULL, NULL, G_CALLBACK(displaywindow_image_prev) }, + { "ButtonNextImageAction", GTK_STOCK_GO_FORWARD, "Next Image", + NULL, NULL, G_CALLBACK(displaywindow_image_next) }, + { "ButtonLastImageAction", GTK_STOCK_GOTO_LAST, "Last Image", + NULL, NULL, G_CALLBACK(displaywindow_image_last) }, + { "ButtonExtractIntensitiesAction", "dtr-quantify", "Quantify", NULL, NULL, G_CALLBACK(displaywindow_extract) }, + }; guint n_entries = G_N_ELEMENTS(entries); @@ -425,9 +436,12 @@ static void displaywindow_addmenubar(DisplayWindow *dw) { guint n_radios2 = G_N_ELEMENTS(radios2); GtkToggleActionEntry toggles[] = { - { "CubeAction", NULL, "Show 100 nm^-1 _Cube", NULL, NULL, G_CALLBACK(displaywindow_changecube), dw->cube }, - { "LinesAction", NULL, "Show Indexing Lines", NULL, NULL, G_CALLBACK(displaywindow_changelines), dw->lines }, - { "BackgroundAction", NULL, "Show Coloured Background", NULL, NULL, G_CALLBACK(displaywindow_changebackground), dw->background }, + { "CubeAction", NULL, "Show 100 nm^-1 _Cube", + NULL, NULL, G_CALLBACK(displaywindow_changecube), dw->cube }, + { "LinesAction", NULL, "Show Indexing Lines", + NULL, NULL, G_CALLBACK(displaywindow_changelines), dw->lines }, + { "BackgroundAction", NULL, "Show Coloured Background", + NULL, NULL, G_CALLBACK(displaywindow_changebackground), dw->background }, }; guint n_toggles = G_N_ELEMENTS(toggles); @@ -435,8 +449,10 @@ static void displaywindow_addmenubar(DisplayWindow *dw) { dw->action_group = gtk_action_group_new("dtrdisplaywindow"); gtk_action_group_add_actions(dw->action_group, entries, n_entries, dw); - gtk_action_group_add_radio_actions(dw->action_group, radios, n_radios, -1, G_CALLBACK(displaywindow_changeview), dw); - gtk_action_group_add_radio_actions(dw->action_group, radios2, n_radios2, -1, G_CALLBACK(displaywindow_changemode), dw); + gtk_action_group_add_radio_actions(dw->action_group, radios, n_radios, + -1, G_CALLBACK(displaywindow_changeview), dw); + gtk_action_group_add_radio_actions(dw->action_group, radios2, n_radios2, + -1, G_CALLBACK(displaywindow_changemode), dw); gtk_action_group_add_toggle_actions(dw->action_group, toggles, n_toggles, dw); dw->ui = gtk_ui_manager_new(); @@ -497,9 +513,10 @@ void displaywindow_update_imagestack(DisplayWindow *dw) { /* Now connect partners */ for ( j=0; jrflist->n_features; j++ ) { if ( image->rflist->features[j].partner ) { - imagedisplay_add_line(dw->stack, image->rflist->features[j].x, image->rflist->features[j].y, - image->rflist->features[j].partner->x, image->rflist->features[j].partner->y, - IMAGEDISPLAY_MARK_LINE_1); + imagedisplay_add_line(dw->stack, + image->rflist->features[j].x, image->rflist->features[j].y, + image->rflist->features[j].partner->x, image->rflist->features[j].partner->y, + IMAGEDISPLAY_MARK_LINE_1); } } } @@ -598,12 +615,15 @@ DisplayWindow *displaywindow_open(ControlContext *ctx) { gtk_widget_set_size_request(dw->drawing_area, 640, 640); gtk_widget_set_gl_capability(dw->drawing_area, glconfig, NULL, TRUE, GDK_GL_RGBA_TYPE); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), dw->drawing_area, gtk_label_new("Reconstruction")); - gtk_widget_add_events(dw->drawing_area, GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_VISIBILITY_NOTIFY_MASK); + gtk_widget_add_events(dw->drawing_area, + GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_VISIBILITY_NOTIFY_MASK); g_signal_connect(GTK_OBJECT(dw->drawing_area), "configure_event", G_CALLBACK(glbits_configure), dw); g_signal_connect(GTK_OBJECT(dw->drawing_area), "realize", G_CALLBACK(glbits_realise), dw); g_signal_connect(GTK_OBJECT(dw->drawing_area), "expose_event", G_CALLBACK(glbits_expose), dw); - g_signal_connect(GTK_OBJECT(dw->drawing_area), "button_press_event", G_CALLBACK(displaywindow_gl_button_press), dw); - g_signal_connect(GTK_OBJECT(dw->drawing_area), "motion_notify_event", G_CALLBACK(displaywindow_gl_motion_notify), dw); + g_signal_connect(GTK_OBJECT(dw->drawing_area), "button_press_event", + G_CALLBACK(displaywindow_gl_button_press), dw); + g_signal_connect(GTK_OBJECT(dw->drawing_area), "motion_notify_event", + G_CALLBACK(displaywindow_gl_motion_notify), dw); g_signal_connect(GTK_OBJECT(dw->drawing_area), "destroy", G_CALLBACK(displaywindow_gl_destroyed), dw); if ( ctx->images->n_images > 0 ) { @@ -612,7 +632,8 @@ DisplayWindow *displaywindow_open(ControlContext *ctx) { gtk_notebook_append_page(GTK_NOTEBOOK(notebook), dw->stack->vbox, gtk_label_new("Image Stack")); displaywindow_update_imagestack(dw); } else { - gtk_notebook_append_page(GTK_NOTEBOOK(notebook), gtk_label_new("No Images to Display"), gtk_label_new("Image Stack")); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), gtk_label_new("No Images to Display"), + gtk_label_new("Image Stack")); } displaywindow_enable_cell_functions(dw, FALSE); -- cgit v1.2.3