Skip to content

Commit 6ad8618

Browse files
committed
fix up Group action
1 parent bdc1987 commit 6ad8618

File tree

7 files changed

+48
-35
lines changed

7 files changed

+48
-35
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
- high-dpi support
77
- icon for windows exe
88
- fix Fontname creation
9+
- add ^G to group selected rows
10+
- add "Group selected" to column menu
911

1012
## 9.0.11 2025/07/21
1113

TODO

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
2-
- select two rows then ^G should make a Group[] at the bottom of the current
3-
column
4-
5-
add "Group slected rows" to column menu
6-
7-
remove "Group" from row menu
8-
91
- make toolkilgroupview more compact
102

113
scrolling all the time in the default window size is a PITA

src/app.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ app_startup(GApplication *app)
229229
{ "win.fullscreen", { "F11", NULL } },
230230
{ "win.properties", { "<Alt>Return", NULL } },
231231
{ "win.keyboard-duplicate", { "<Primary>d", NULL } },
232+
{ "win.keyboard-group-selected", { "<Primary>g", NULL } },
232233
};
233234

234235
// all our private application settings

src/columnview.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,22 @@ columnview_edit(Columnview *cview)
5252
}
5353
}
5454

55+
static void
56+
columnview_group_selected(Columnview *cview)
57+
{
58+
Column *col = COLUMN(VOBJECT(cview)->iobject);
59+
Workspace *ws = col->ws;
60+
61+
if (workspace_selected_num(ws) > 0) {
62+
icontainer_current(ICONTAINER(ws), ICONTAINER(col));
63+
if (!workspace_selected_group(ws))
64+
workspace_show_error(ws);
65+
66+
workspace_deselect_all(ws);
67+
symbol_recalculate_all();
68+
}
69+
}
70+
5571
static void
5672
columnview_caption_edit_activate(GtkEntry *self, gpointer user_data)
5773
{
@@ -547,6 +563,8 @@ columnview_action(GSimpleAction *action, GVariant *parameter, View *view)
547563
workspace_deselect_all(ws);
548564
column_select_symbols(col);
549565
}
566+
else if (g_str_equal(name, "column-group-selected"))
567+
columnview_group_selected(cview);
550568
else if (g_str_equal(name, "column-duplicate")) {
551569
char new_name[MAX_STRSIZE];
552570
Column *new_col;

src/gtk/workspacegroupview.ui

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
<attribute name="label">New column</attribute>
88
<attribute name="action">win.column-new</attribute>
99
</item>
10-
<item>
11-
<attribute name="label">Group selected</attribute>
12-
<attribute name="action">win.prev</attribute>
13-
</item>
1410
<item>
1511
<attribute name='label' translatable='yes'>Next error</attribute>
1612
<attribute name='action'>win.next-error</attribute>
@@ -51,10 +47,6 @@
5147
<attribute name='label' translatable='yes'>Duplicate</attribute>
5248
<attribute name='action'>win.row-duplicate</attribute>
5349
</item>
54-
<item>
55-
<attribute name='label' translatable='yes'>Group</attribute>
56-
<attribute name='action'>win.row-group</attribute>
57-
</item>
5850
<item>
5951
<attribute name='label' translatable='yes'>Ungroup</attribute>
6052
<attribute name='action'>win.row-ungroup</attribute>
@@ -101,6 +93,10 @@
10193
<attribute name='label' translatable='yes'>Select all</attribute>
10294
<attribute name='action'>win.column-select-all</attribute>
10395
</item>
96+
<item>
97+
<attribute name='label' translatable='yes'>Group selected</attribute>
98+
<attribute name='action'>win.column-group-selected</attribute>
99+
</item>
104100
<item>
105101
<attribute name='label' translatable='yes'>Duplicate</attribute>
106102
<attribute name='action'>win.column-duplicate</attribute>

src/mainwindow.c

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,24 @@ mainwindow_keyboard_duplicate_action(GSimpleAction *action,
621621
}
622622
}
623623

624+
// ^G in the main window ... duplicate selected rows, or last row
625+
static void
626+
mainwindow_keyboard_group_selected_action(GSimpleAction *action,
627+
GVariant *parameter, gpointer user_data)
628+
{
629+
Mainwindow *main = MAINWINDOW(user_data);
630+
631+
Workspace *ws;
632+
if ((ws = WORKSPACE(ICONTAINER(main->wsg)->current))) {
633+
if (workspace_selected_num(ws) > 0 &&
634+
!workspace_selected_group(ws))
635+
workspace_show_error(ws);
636+
637+
workspace_deselect_all(ws);
638+
symbol_recalculate_all();
639+
}
640+
}
641+
624642
static GActionEntry mainwindow_entries[] = {
625643
// main window actions
626644

@@ -632,9 +650,11 @@ static GActionEntry mainwindow_entries[] = {
632650
{ "recover", mainwindow_recover_action },
633651
{ "close", mainwindow_close_action },
634652
{ "quit", mainwindow_quit_action },
635-
{ "keyboard-duplicate", mainwindow_keyboard_duplicate_action },
636653
{ "fullscreen", action_toggle, NULL, "false", mainwindow_fullscreen },
637654

655+
{ "keyboard-duplicate", mainwindow_keyboard_duplicate_action },
656+
{ "keyboard-group-selected", mainwindow_keyboard_group_selected_action },
657+
638658
// workspace tab menu
639659
{ "tab-new", mainwindow_tab_new },
640660
{ "tab-close-current", mainwindow_tab_close_current },
@@ -659,6 +679,7 @@ static GActionEntry mainwindow_entries[] = {
659679
// column menu
660680
{ "column-edit-caption", mainwindow_view_action },
661681
{ "column-select-all", mainwindow_view_action },
682+
{ "column-group-selected", mainwindow_view_action },
662683
{ "column-duplicate", mainwindow_view_action },
663684
// takes a string param with the name of the column to merge
664685
{ "column-merge", mainwindow_view_action, "s" },
@@ -668,10 +689,9 @@ static GActionEntry mainwindow_entries[] = {
668689

669690
// row menu
670691
{ "row-edit", mainwindow_view_action },
692+
{ "row-duplicate", mainwindow_view_action },
671693
{ "row-saveas", mainwindow_view_action },
672-
{ "row-group", mainwindow_view_action },
673694
{ "row-ungroup", mainwindow_view_action },
674-
{ "row-duplicate", mainwindow_view_action },
675695
{ "row-replace", mainwindow_view_action },
676696
{ "row-recalculate", mainwindow_view_action },
677697
{ "row-reset", mainwindow_view_action },

src/rowview.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -376,20 +376,6 @@ rowview_duplicate(Rowview *rview)
376376
symbol_recalculate_all();
377377
}
378378

379-
static void
380-
rowview_group(Rowview *rview)
381-
{
382-
Row *row = ROW(VOBJECT(rview)->iobject);
383-
384-
if (workspace_selected_num(row->ws) < 2)
385-
row_select(row);
386-
if (!workspace_selected_group(row->ws))
387-
workspace_show_error(row->ws);
388-
workspace_deselect_all(row->ws);
389-
390-
symbol_recalculate_all();
391-
}
392-
393379
static void
394380
rowview_ungroup(Rowview *rview)
395381
{
@@ -456,8 +442,6 @@ rowview_action(GSimpleAction *action, GVariant *parameter, View *view)
456442
}
457443
else if (g_str_equal(name, "row-replace") && graphic)
458444
classmodel_graphic_replace(CLASSMODEL(graphic), window);
459-
else if (g_str_equal(name, "row-group"))
460-
rowview_group(rview);
461445
else if (g_str_equal(name, "row-ungroup"))
462446
rowview_ungroup(rview);
463447
else if (g_str_equal(name, "row-recalc"))

0 commit comments

Comments
 (0)