Commit 9a366202 authored by David Brown's avatar David Brown
Browse files

Modified opening and closing of directories to prevent unnecessary redraws.

Altered Newdirectory/NewURL routines to create new directories at the pointer.
parent 5a494095
......@@ -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;
else
if (!tempitem)
{
tempitem = tempitem->parent;
show_error(hotlist_new_url(hotlist_root,
HOTLIST_POSITION_END,
tempdesc,
tempurl));
atend = 1;
}
else
{
show_error(hotlist_new_url(tempitem,
HOTLIST_POSITION_END,
HOTLIST_POSITION_AFTER,
tempdesc,
tempurl));
atend = 0;
}
hotlist_preopen();
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,
HOTLIST_POSITION_AFTER,
&tempitem);
atend = 0;
}
hotlist_preopen();
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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment