arohl / gdis

A visualization program for the display, manipulation, and analysis of isolated molecules and periodic structures
GNU General Public License v2.0
43 stars 17 forks source link

Extensions #39

Closed cajfisher closed 3 years ago

cajfisher commented 3 years ago

Add menu shortcuts (including DEL for selection delete and INS for colour editor, no. of selected atoms info display in upper righthand corner of model window, and About dialog with clickable link.

ovhpa commented 3 years ago

Hello,

Thank you for your contribution!

Unfortunately, I can't review it right now. But there seems to be a problem in the commit 52818f0 Did you by any chance delete the file gui_main.c and then copy it again (possibly from another system)? It seems to me that this commit is suspiciously big as the whole gui_main.c file is changed and I can't see any reason for that.

Anyway, I will review the changes tomorrow or later this week only, sorry for the delay.

Best,

cajfisher commented 3 years ago

Hi!

Sorry about that. The problem is that gui_main.c is in DOS format (carriage return and line feed line endings) whereas my gui_main.c is in unix/linux format (like all the other text files). It's probably better to have all files in the same format.

The only coding changes to gui_main.c are as follows:

< / can we assoc. with a single atom /

/ can we assoc. with a single atom? / 757c757 < / setup cell renderers /

/ set up cell renderers / 878c878 < / setup the text rendering colum /

/ set up the text rendering colum / 887c887 < / setup the selection handler /

/ set up the selection handler / 1332,1338c1332,1338 < / < { "/File/_New", NULL, create_new_model, 1, NULL }, < { "/File/sep1", NULL, NULL, 0, "" }, < / < { "/File/_Open...", NULL, file_load_dialog, 1, NULL }, < { "/File/_Save...", NULL, file_save_dialog, 1, NULL }, < { "/File/_Close", NULL, tree_select_delete, 1, NULL },

{ "/File/_New", "N", edit_model_create, 1, NULL }, / { "/File/sep1", NULL, NULL, 0, "" }, /

{ "/File/_Open...", "O", file_load_dialog, 1, NULL }, { "/File/_Save...", "S", file_save_dialog, 1, NULL }, { "/File/_Close", "W", tree_select_delete, 1, NULL }, 1351c1351 < { "/File/_Quit", NULL, gdis_exit_test, 0, NULL },

{ "/File/_Quit", "Q", gdis_exit_test, 0, NULL }, 1354,1359c1354,1356 < { "/Edit/_Copy", NULL, select_copy, 0, NULL }, < { "/Edit/_Paste", NULL, select_paste, 0, NULL }, < { "/Edit/sep1", NULL, NULL, 0, "" }, < < { "/Edit/Delete", NULL, select_delete, 0, NULL }, < { "/Edit/Undo", NULL, undo_active, 0, NULL },

{ "/Edit/Undo", "Z", undo_active, 0, NULL }, { "/Edit/_Copy", "C", select_copy, 0, NULL }, { "/Edit/_Paste", "V", select_paste, 0, NULL }, 1364,1365d1360 < { "/Edit/Hide", NULL, select_hide, 0, NULL }, < { "/Edit/Unhide all", NULL, unhide_atoms, 0, NULL }, 1367,1368c1362,1367 < { "/Edit/Select all", NULL, select_all, 0, NULL }, < { "/Edit/Invert", NULL, select_invert, 0, NULL },

{ "/Edit/Delete selected", NULL, select_delete, 0, NULL }, { "/Edit/Select all", "A", select_all, 0, NULL }, { "/Edit/Invert selection", "I", select_invert, 0, NULL }, { "/Edit/Hide selected", "H", select_hide, 0, NULL }, { "/Edit/Hide unselected", "U", unselect_hide, 0, NULL }, { "/Edit/Unhide all", NULL, unhide_atoms, 0, NULL }, 1377c1376 < { "/Tools/Building/Editing...", NULL, gui_edit_dialog, 0, NULL },

{ "/Tools/Building/Editing...", "E", gui_edit_dialog, 0, NULL }, 1399c1398 < { "/View/Display properties...", NULL, gui_render_dialog, 0, NULL},

{ "/View/Display properties...", "D", gui_render_dialog, 0, NULL}, 1417,1419c1416,1418 < / < { "/Help/About...", NULL, gui_help_dialog, 0, NULL}, < /

{ "/Help/About...", NULL, gui_about_dialog, 0, NULL},

1427a1427,1438

ifdef UNUSED_BUT_SET

GdkModifierType state;

state = (GdkModifierType) event->state;

if ((state & GDK_CONTROL_MASK)) ctrl = TRUE;

if ((state & GDK_MOD1_MASK)) alt = TRUE;

endif

1430c1441 < / selection delete /

/ colour settings / 1432c1443 < undo_active();

select_colour();

1476a1488,1497

/ about dialog / case GDK_F9: gui_about_dialog(); break;

/ manual / case GDK_F12: gui_help_dialog(); break; 1477a1499

1735,1737c1757,1759 < // < / setup the active model widget / < //

/**/ / set up the active model widget / /**/ 1810a1833 GtkAccelGroup accel; 1816a1840,1842 / Make an accelerator group (shortcut keys) */ accel = gtk_accel_group_new();

1856c1882 < item = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "
", NULL);

item = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "
", accel); 1858a1885 gtk_window_add_accel_group(GTK_WINDOW (window), accel); 2015c2042 < / model geomtry /

/ model geometry / 2266c2293 < text = g_strdup_printf("This is free software, distributed under the terms of the GNU public license (GPL).\nFor more information visit http://www.gnu.org\n");

text = g_strdup_printf("This is free software, distributed under the terms of the GNU public license (GPL).\nFor more information visit http://www.gnu.org/\n");

Regards,

Craig


差出人: Okadome Valencia @.> 送信日時: 2021年6月6日 19:42 宛先: arohl/gdis @.> CC: クレイグ・フィッシャー @.>; Author @.> 件名: Re: [arohl/gdis] Extensions (#39)

Hello,

Thank you for your contribution!

Unfortunately, I can't review it right now. But there seems to be a problem in the commit 52818f0https://github.com/arohl/gdis/commit/52818f0269eaafab54e9227940bff9bbfaefb94a Did you by any chance delete the file gui_main.c and then copy it again (possibly from another system)? It seems to me that this commit is suspiciously big as the whole gui_main.c file is changed and I can't see any reason for that.

Anyway, I will review the changes tomorrow or later this week only, sorry for the delay.

Best,

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/arohl/gdis/pull/39#issuecomment-855377212, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AP5N32AY3DLFR24ZPOXB2TDTRNGH5ANCNFSM46FUST2A.

arohl commented 3 years ago

No idea when/how that happened but I can confirm that file does have DOS line breaks

ovhpa commented 3 years ago

Hello,

I'm finally back to GDIS after a few very long days ^^' Anyway, I didn't find much problems with the pull request. The DOS line breaks are surprizing, especially since I haven't get a PC with DOS/windows operating system since at least a decade. But it could be a github problem (I remember hearing about something similar some times ago). Anyway, I have just a little complain with the static analysis:

Bug reported by the clang static analyzer.

Description: Access to field 'code' results in a dereference of a null pointer (loaded from variable 'error')
File: /home/hubertokadomevalencia/git/diff/gdis/src/gui_help.c
Line: 59

But I'm gonna take care of it later: it is a bug in the error hadling that would very unlikely impact any user. I plan to do a little BUG hunting later, while clearing a few memory leaks (I found a few new ones, related to GTK object).

Best,