]> uap-core.de Git - note.git/commitdiff
remove maximized setting from the navigation stack
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Fri, 19 Jun 2026 19:40:05 +0000 (21:40 +0200)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Fri, 19 Jun 2026 19:40:05 +0000 (21:40 +0200)
application/menu.c
application/nbconfig.c
application/src/notebook.rs
application/src/window.rs
application/window.c
ui-rs/src/ui/toolkit.rs
ui/common/context.c
ui/common/document.c

index 648ad323381f4d53a37712abe7ea5716bdc71557..a0d64490a8ad433e8c7111db75a47640560283c5 100644 (file)
@@ -44,10 +44,10 @@ void menu_cleanup() {
 void toolbar_init() {
     ui_toolbar_item("GoBack", .icon = UI_ICON_GO_BACK, .onclick = action_go_back);
     ui_toolbar_item("GoForward", .icon = UI_ICON_GO_FORWARD, .onclick = action_go_forward);
-    ui_toolbar_item("AddNote", .icon = UI_ICON_ADD, .onclick = action_note_new, .states = UI_GROUPS(APP_STATE_NOTEBOOK_SELECTED));
+    ui_toolbar_item("AddNote", .icon = UI_ICON_ADD, .onclick = action_note_new, .states = UI_STATES(APP_STATE_NOTEBOOK_SELECTED));
     
-    ui_toolbar_item("GoBack2", .icon = UI_ICON_GO_BACK, .onclick = action_go_back, .visibility_states = UI_GROUPS(APP_STATE_HIDE_NOTELIST));
-    ui_toolbar_item("GoForward2", .icon = UI_ICON_GO_FORWARD, .onclick = action_go_forward, .visibility_states = UI_GROUPS(APP_STATE_HIDE_NOTELIST));
+    ui_toolbar_item("GoBack2", .icon = UI_ICON_GO_BACK, .onclick = action_go_back, .visibility_states = UI_STATES(APP_STATE_HIDE_NOTELIST));
+    ui_toolbar_item("GoForward2", .icon = UI_ICON_GO_FORWARD, .onclick = action_go_forward, .visibility_states = UI_STATES(APP_STATE_HIDE_NOTELIST));
     
     ui_toolbar_appmenu() {
         ui_menuitem("New Window", .onclick = action_new_window);
index e48c1ec5d85d0797f735242fe95d4fc5ce050d4c..7ee1d7de2354d1375bfd38a1b243c09b0264c8d3 100644 (file)
@@ -697,7 +697,7 @@ void notebook_config_dialog(void) {
                             ui_button(obj, .label = "New Notebook", .onclick = nbconfig_notebooklist_add_notebook);
                             ui_button(obj, .icon = UI_ICON_GO_UP, .onclick = nbconfig_notebooklist_move_up);
                             ui_button(obj, .icon = UI_ICON_GO_DOWN, .onclick = nbconfig_notebooklist_move_down);
-                            ui_button(obj, .icon = UI_ICON_DELETE, .onclick = nbconfig_notebooklist_delete);
+                            ui_button(obj, .icon = UI_ICON_REMOVE, .onclick = nbconfig_notebooklist_delete);
                         }
                         UiModel *model = ui_model(obj->ctx, UI_STRING, "Notebook", -1);
                         model->columnsize[0] = -1;
@@ -743,7 +743,7 @@ void notebook_config_dialog(void) {
                         ui_listview(obj, .list = wdata->tab3_repositories, .getvalue = repolist_get_value, .fill = TRUE, .onselection = nbconfig_repolist_onselect);
                         ui_hbox(obj) {
                             ui_button(obj, .icon = UI_ICON_NEW_FOLDER, .onclick = nbconfig_repolist_add);
-                            ui_button(obj, .icon = UI_ICON_DELETE, .onclick = nbconfig_repolist_delete);
+                            ui_button(obj, .icon = UI_ICON_REMOVE, .onclick = nbconfig_repolist_delete);
                         }
                     }
                     
@@ -765,7 +765,7 @@ void notebook_config_dialog(void) {
                         ui_newline(obj);
                         
                         ui_rlabel(obj, .label = "Encryption key");
-                        ui_dropdown(obj, .list = wdata->tab3_repo_encryption_key, .states = UI_GROUPS(NBCONFIG_STATE_REPOSITORY_ENCRYPTION), .hfill = TRUE);
+                        ui_dropdown(obj, .list = wdata->tab3_repo_encryption_key, .states = UI_STATES(NBCONFIG_STATE_REPOSITORY_ENCRYPTION), .hfill = TRUE);
                         
                     }
                 }
index eaa0f7a05e82f34421c7ea83a7a54378e44c6ec8..4f8d3528912edad47876cced4ca9bc7536864911 100644 (file)
@@ -129,7 +129,7 @@ impl Notebook {
         }
     }
 
-    pub fn select_note_from(&mut self, from: NoteSelectFrom, maximized: bool) -> Option<()> {
+    pub fn select_note_from(&mut self, from: NoteSelectFrom) -> Option<()> {
         let mut add_to_nav = false;
         let (selected_index, note) = match from {
             NoteSelectFrom::ListSelection(s) => {
@@ -157,7 +157,7 @@ impl Notebook {
         let is_new = note.is_new();
 
         let id = note.id.clone();
-        let nav = NavigationItem { collection_id: self.collection_id, note_id: Some(note.id.clone()), note_maximized: maximized };
+        let nav = NavigationItem { collection_id: self.collection_id, note_id: Some(note.id.clone()) };
         let doc = if let Some(doc) = &note.model {
             doc.clone()
         } else {
@@ -186,7 +186,7 @@ impl Notebook {
     #[action]
     pub fn note_selected(&mut self, event: &ActionEvent) {
         if let EventType::ListSelection(s) = event.event_type {
-            self.select_note_from(NoteSelectFrom::ListSelection(s), false);
+            self.select_note_from(NoteSelectFrom::ListSelection(s));
         }
     }
 
@@ -195,7 +195,7 @@ impl Notebook {
         let obj = &mut event.obj.as_mut()?;
 
         if let EventType::ListSelection(s) = event.event_type {
-            let result = self.select_note_from(NoteSelectFrom::ListSelection(s), true);
+            let result = self.select_note_from(NoteSelectFrom::ListSelection(s));
             //obj.splitview_set_visible(0, false);
             self.view.set(1);
             // in case select_note_from didn't return a result, the note was already selected
@@ -204,8 +204,7 @@ impl Notebook {
                 let current = &self.selected_note.as_ref()?;
                 let nav = NavigationItem {
                     collection_id: self.collection_id,
-                    note_id: Some(current.id.clone()),
-                    note_maximized: true
+                    note_id: Some(current.id.clone())
                 };
 
                 let arg: Box<dyn Any> = Box::new(nav);
@@ -227,20 +226,14 @@ impl Notebook {
     }
 
     #[action(NavigationItem)]
-    pub fn navigate_to_note(&mut self, event: &mut ActionEvent, nav: &NavigationItem) {
-        let Some(obj) = &mut event.obj else {
-            return;
-        };
-
+    pub fn navigate_to_note(&mut self, _event: &mut ActionEvent, nav: &NavigationItem) {
         //println!("navigate to note");
         if nav.collection_id != self.collection_id {
             println!("invalid navigation event: notebook collection_id {} != {}", self.collection_id, nav.collection_id);
             return;
         }
 
-        self.select_note_from(NoteSelectFrom::NavigationItem(nav.clone()), false);
-        //obj.splitview_set_visible(0, !nav.note_maximized);
-        //self.view.set(nav.note_maximized as i64);
+        self.select_note_from(NoteSelectFrom::NavigationItem(nav.clone()));
     }
 
     pub fn update_note_title(&mut self, update: &NoteTitleUpdate) {
index 8a25c6498ffe807e5882b0f9d43629aba1e3c944..d710649e6d09ec57c9caa8da2298995839d1cee1 100644 (file)
@@ -212,6 +212,7 @@ pub fn create_window(app: &App, ctx: &AppContext<MainWindow>) -> UiObject<MainWi
                             }
 
                             let notebook_doc = nb.get_doc(&e.data.backend);
+                            e.obj.splitview_set_visible(0, true);
                             e.obj.ctx.attach(&notebook_doc);
                             e.data.selected_notebook = Some(notebook_doc);
                             //e.obj.splitview_set_visible(0, !nav.note_maximized);
@@ -350,7 +351,6 @@ impl Navigation {
 pub struct NavigationItem {
     pub collection_id: i32,
     pub note_id: Option<NoteId>,
-    pub note_maximized: bool
 }
 
 pub enum NavDirection {
index 6aabbb53a0470c6aa7822565225be6fb3e0d58a7..e4c75aa6d06db340dd62f0f32e9f8cf9247f01a8 100644 (file)
@@ -106,7 +106,7 @@ void window_create() {
                 ui_vbox(obj, .fill = TRUE) {
                     ui_grid(obj, .margin = 10, .columnspacing = 10, .rowspacing = 10, .def_vfill = TRUE) {
                         //ui_label(obj, .label = "Title", .vfill = TRUE);
-                        ui_textfield(obj, .varname = "note_title", .onchange = action_note_title_changed, .hexpand = TRUE, .hfill = TRUE, .states = UI_GROUPS(APP_STATE_NOTE_SELECTED));
+                        ui_textfield(obj, .varname = "note_title", .onchange = action_note_title_changed, .hexpand = TRUE, .hfill = TRUE, .states = UI_STATES(APP_STATE_NOTE_SELECTED));
                         ui_newline(obj);
                     }
                     ui_hbox(obj, .style_class = "note_toolbar", .margin = 10, .spacing = 4) {
@@ -120,7 +120,7 @@ void window_create() {
                         ui_button(obj, .icon = "insert-image", .onclick = action_textnote_insertimg);
                         ui_button(obj, .icon = "insert-link");
                     }
-                    ui_hbox_w(obj, wdata->attachments, .margin = 10, .visibility_states = UI_GROUPS(APP_STATE_NOTE_HAS_ATTACHMENTS)) {
+                    ui_hbox_w(obj, wdata->attachments, .margin = 10, .visibility_states = UI_STATES(APP_STATE_NOTE_HAS_ATTACHMENTS)) {
                         UIWIDGET sw;
                         ui_scrolledwindow_w(obj, sw, .name = "note_attachments_sw") {
                             ui_itemlist(obj, .varname = "note_attachments", .container = UI_CONTAINER_HBOX, .create_ui = attachment_item, .userdata = wdata);
@@ -132,10 +132,10 @@ void window_create() {
 #if GTK_MAJOR_VERSION >= 4
                     ui_customwidget(obj, editor_gtk4_workaround, wdata, .hfill = TRUE);
 #endif
-                    wdata->textview = ui_textarea(obj, .varname = "note_text", .vfill = TRUE, .hfill = TRUE, .hexpand = TRUE, .vexpand = TRUE, .colspan = 2, .states = UI_GROUPS(APP_STATE_NOTE_SELECTED), .fill = UI_ON);
+                    wdata->textview = ui_textarea(obj, .varname = "note_text", .vfill = TRUE, .hfill = TRUE, .hexpand = TRUE, .vexpand = TRUE, .colspan = 2, .states = UI_STATES(APP_STATE_NOTE_SELECTED), .fill = UI_ON);
                     editor_init_textview(obj, ui_textarea_gettextwidget(wdata->textview));
                     
-                    ui_grid(obj, .margin = 4, .columnspacing = 4, .rowspacing = 4, .def_hfill = TRUE, .def_vfill = TRUE, .visibility_states = UI_GROUPS(APP_STATE_NOTE_FIND)) {
+                    ui_grid(obj, .margin = 4, .columnspacing = 4, .rowspacing = 4, .def_hfill = TRUE, .def_vfill = TRUE, .visibility_states = UI_STATES(APP_STATE_NOTE_FIND)) {
                         ui_rlabel(obj, .label = "Find");
                         wdata->searchbar_textfield = ui_textfield(obj, .hexpand = TRUE, .onactivate = action_searchbar_next, .varname = "search");
                         ui_button(obj, .label = "Previous", .onclick = action_searchbar_prev);
@@ -145,10 +145,10 @@ void window_create() {
                         ui_button(obj, .icon = "window-close", .onclick = action_searchbar_close);
                         
                         ui_newline(obj);
-                        ui_rlabel(obj, .label = "Replace", .visibility_states = UI_GROUPS(APP_STATE_NOTE_REPLACE));
-                        ui_textfield(obj, .hexpand = TRUE, .varname = "replace", .visibility_states = UI_GROUPS(APP_STATE_NOTE_REPLACE), .onactivate = action_searchbar_replace);
-                        ui_button(obj, .label = "Replace", .visibility_states = UI_GROUPS(APP_STATE_NOTE_REPLACE), .onclick = action_searchbar_replace);
-                        ui_button(obj, .label = "Replace All", .visibility_states = UI_GROUPS(APP_STATE_NOTE_REPLACE), .onclick = action_searchbar_replace_all);
+                        ui_rlabel(obj, .label = "Replace", .visibility_states = UI_STATES(APP_STATE_NOTE_REPLACE));
+                        ui_textfield(obj, .hexpand = TRUE, .varname = "replace", .visibility_states = UI_STATES(APP_STATE_NOTE_REPLACE), .onactivate = action_searchbar_replace);
+                        ui_button(obj, .label = "Replace", .visibility_states = UI_STATES(APP_STATE_NOTE_REPLACE), .onclick = action_searchbar_replace);
+                        ui_button(obj, .label = "Replace All", .visibility_states = UI_STATES(APP_STATE_NOTE_REPLACE), .onclick = action_searchbar_replace_all);
                     }
                 } 
             }
index 4e7580d3a06d4a0039541dd25fa506664c6dc4d9..473396eded137898c795edecef0ee4ed1d0dd8dd 100644 (file)
@@ -59,6 +59,7 @@ impl Default for UiContext {
     }
 }
 
+
 impl UiContext {
     pub fn from_ptr(ctx: *mut ffi::UiContext) -> UiContext {
         UiContext {
index a3ae312b64b5db70d57c9298f5d10f7bd7e184a1..757056f491e17100abccadb87920d3b5d0144c65 100644 (file)
@@ -136,8 +136,7 @@ void uic_context_destroy(UiContext *ctx, void *document) {
     }
     
     uic_context_detach_all(ctx);
-    
-    printf("cxMempoolFree %p\n", ctx);
+
     cxMempoolFree(ctx->mp);
 }
 
@@ -282,7 +281,6 @@ void uic_context_detach_all(UiContext *ctx) {
     i = cxListIterator(ls);
     cx_foreach(void *, doc, i) {
         uic_context_detach_document(ctx, doc);
-        uic_send_status_change(ui_document_context(doc), NULL);
     }
     
     cxListFree(ls);
index 6635badba7f259e590bd1ffc9b7cac1311750047..287b5b51f81d7dd1001b5c0aba93a492b540f7eb 100644 (file)
@@ -64,7 +64,6 @@ void ui_document_unref(void *doc) {
     UiContext *ctx = ui_document_context(doc);
     if(ctx) {
         if(--ctx->ref == 0) {
-            printf("doc destroy %p ctx %p\n", doc, ctx);
             uic_context_destroy(ctx, doc);
         }
     }