From 9a3662022c31af702bc8c0afa1b6aa22d26d50a3 Mon Sep 17 00:00:00 2001 From: David Brown <dbrown@gitlab.riscosopen.org> Date: Thu, 18 Sep 1997 10:23:47 +0000 Subject: [PATCH] Modified opening and closing of directories to prevent unnecessary redraws. Altered Newdirectory/NewURL routines to create new directories at the pointer. --- c/Hotlist | 76 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 56 insertions(+), 20 deletions(-) diff --git a/c/Hotlist b/c/Hotlist index f69fcd9..9541f2d 100644 --- a/c/Hotlist +++ b/c/Hotlist @@ -2052,7 +2052,7 @@ static _kernel_oserror * hotlist_directory_open_close(hotlist_item * item, unsig /* Clear all selected items within the directory */ - hotlist_clear_flags(item->data.directory_content, hl_ALL, HOTLIST_G_IS_SELECTED); + hotlist_clear_flags(item->data.directory_content, hl_ALL, HOTLIST_G_IS_SELECTED | HOTLIST_G_REDRAW_NOW); /* Do the appropriate redrawing */ @@ -3763,7 +3763,7 @@ static int hotlist_newedit_url_handler(int event_code, ToolboxEvent *event, IdBl { hotlist_item *item, *tempitem; char *tempdesc, *tempurl; - int size; + int size, atend; item = hotlist_find_selected_item(); writablefield_get_value(0, @@ -3804,18 +3804,35 @@ static int hotlist_newedit_url_handler(int event_code, ToolboxEvent *event, IdBl { case HOTLIST_MENUSECTION_NEW: tempitem = hotlist_find_item(hotlist_root->data.directory_content, menu_itemno); - if (!tempitem) tempitem = hotlist_root; + if (!tempitem) + { + show_error(hotlist_new_url(hotlist_root, + HOTLIST_POSITION_END, + tempdesc, + tempurl)); + atend = 1; + } else { - tempitem = tempitem->parent; + show_error(hotlist_new_url(tempitem, + HOTLIST_POSITION_AFTER, + tempdesc, + tempurl)); + atend = 0; } - show_error(hotlist_new_url(tempitem, - HOTLIST_POSITION_END, - tempdesc, - tempurl)); + hotlist_preopen(); - hotlist_redraw_items(menu_itemno, - hotlist_count_displayed_items(hotlist_root->data.directory_content)); + + if (atend) + { + hotlist_redraw_items(hotlist_count_displayed_items(hotlist_root->data.directory_content)-1, + hotlist_count_displayed_items(hotlist_root->data.directory_content)-1); + } + else + { + hotlist_redraw_items(menu_itemno, + hotlist_count_displayed_items(hotlist_root->data.directory_content)); + } hotlist_clear_flags(hotlist_root, hl_ALL, HOTLIST_G_REDRAW_NOW); hotlist_modified(HL_MODIFIED_ADD); free(tempdesc); @@ -3848,7 +3865,7 @@ static int hotlist_newedit_url_handler(int event_code, ToolboxEvent *event, IdBl static int hotlist_newren_directory_handler(int event_code, ToolboxEvent *event, IdBlock *id_block, void *handle) { - int size; + int size, atend; hotlist_item *item, *tempitem; char *tempname; @@ -3872,16 +3889,36 @@ static int hotlist_newren_directory_handler(int event_code, ToolboxEvent *event, { case HOTLIST_MENUSECTION_NEW: tempitem = hotlist_find_item(hotlist_root->data.directory_content, menu_itemno); - if (!tempitem) tempitem = hotlist_root; + + if (!tempitem) + { + hotlist_new_directory(hotlist_root, + tempname, + HOTLIST_POSITION_END, + &tempitem); + atend = 1; + } else - tempitem = tempitem->parent; - hotlist_new_directory(tempitem, - tempname, - HOTLIST_POSITION_END, - &tempitem); + { + hotlist_new_directory(tempitem, + tempname, + HOTLIST_POSITION_AFTER, + &tempitem); + atend = 0; + } + hotlist_preopen(); - hotlist_redraw_items(menu_itemno, - hotlist_count_displayed_items(hotlist_root->data.directory_content)); + + if (atend) + { + hotlist_redraw_items(hotlist_count_displayed_items(hotlist_root->data.directory_content)-1, + hotlist_count_displayed_items(hotlist_root->data.directory_content)-1); + } + else + { + hotlist_redraw_items(menu_itemno, + hotlist_count_displayed_items(hotlist_root->data.directory_content)); + } hotlist_clear_flags(hotlist_root, hl_ALL, HOTLIST_G_REDRAW_NOW); hotlist_modified(HL_MODIFIED_ADD); free(tempname); @@ -3894,7 +3931,6 @@ static int hotlist_newren_directory_handler(int event_code, ToolboxEvent *event, hotlist_preopen(); hotlist_redraw_now(); hotlist_modified(HL_MODIFIED_ALTER); - //toolbox_hide_object(0, id_block->ancestor_id); break; } -- GitLab