Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Cameron Cawley
Browse
Commits
7a66122e
Commit
7a66122e
authored
27 years ago
by
David Brown
Browse files
Options
Download
Email Patches
Plain Diff
Various bug fixes and support for displaying either URLs or descriptions
parent
87bedb4b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
159 additions
and
16 deletions
+159
-16
c/Hotlist
c/Hotlist
+144
-16
h/Hotlist
h/Hotlist
+15
-0
No files found.
c/Hotlist
View file @
7a66122e
...
...
@@ -70,7 +70,7 @@ static unsigned int last_selected_item = 0xffffffff; /* The last item which
static
int
hotlist_dragging
=
0
;
/* Holds a set of values for different dragging cases (see Hotlist.h) */
static
unsigned
int
highlighted_itemno
;
/* During dragging, the number of a directory item using the '...+' sprite */
static
hotlist_item
*
hotlist_current_highlighted
=
NULL
;
/* To save scanning lists, pointer to the highlighted item */
static
int
hl_show_urls
;
/* 0 when url descriptions to be shown, 1 to show urls */
static
unsigned
int
hotlist_bbar_size
=
0
;
/* Height in OS units of the button bar */
...
...
@@ -104,6 +104,8 @@ static ToolboxEventHandler hotlist_newedit_url_handler;
static
ToolboxEventHandler
hotlist_newren_directory_handler
;
static
ToolboxEventHandler
hotlist_reset_url_handler
;
static
ToolboxEventHandler
hotlist_reset_directory_handler
;
static
ToolboxEventHandler
hotlist_show_descriptions_handler
;
static
ToolboxEventHandler
hotlist_show_urls_handler
;
/* Debug functions */
...
...
@@ -151,6 +153,7 @@ static void hotlist_lower_tags (char * string);
static
_kernel_oserror
*
hotlist_load_directory
(
FILE
*
fileptr
,
hotlist_item
*
target
);
static
void
hotlist_drag_renderer
(
hotlist_item
*
item
,
unsigned
int
item_height
,
unsigned
int
item_dir_width
,
unsigned
int
item_url_width
);
static
void
hotlist_start_drag
(
void
);
static
_kernel_oserror
*
hotlist_modified
(
unsigned
int
type
);
/* List manupulation */
...
...
@@ -1380,7 +1383,10 @@ static void _hotlist_draw(hotlist_item *list,
wimp_plot_icon
(
&
hotlist_iconblock
);
/* Plot sprite icon */
regs
.
r
[
0
]
=
1
;
regs
.
r
[
1
]
=
(
int
)
list
->
name
;
if
(
list
->
type
==
hl_url
&&
hl_show_urls
)
regs
.
r
[
1
]
=
(
int
)
list
->
data
.
url
;
else
regs
.
r
[
1
]
=
(
int
)
list
->
name
;
regs
.
r
[
2
]
=
0
;
wimp_text_op
(
&
regs
);
/* Get width of text for text icon */
...
...
@@ -1394,8 +1400,17 @@ static void _hotlist_draw(hotlist_item *list,
hotlist_iconblock
.
bbox
.
xmax
=
indent
+
temp_width
+
2
+
regs
.
r
[
0
]
+
12
;
hotlist_iconblock
.
bbox
.
ymax
=
(
-
item_height
*
item_number
)
-
2
;
hotlist_iconblock
.
bbox
.
ymin
=
(
-
item_height
*
item_number
)
-
item_height
+
2
;
if
(
list
->
type
==
hl_url
&&
hl_show_urls
)
{
hotlist_iconblock
.
data
.
it
.
buffer
=
list
->
data
.
url
;
hotlist_iconblock
.
data
.
it
.
buffer_size
=
strlen
(
list
->
data
.
url
);
}
else
{
hotlist_iconblock
.
data
.
it
.
buffer
=
list
->
name
;
hotlist_iconblock
.
data
.
it
.
buffer_size
=
strlen
(
list
->
name
);
}
wimp_plot_icon
(
&
hotlist_iconblock
);
...
...
@@ -1468,7 +1483,10 @@ static void _hotlist_get_max_width(hotlist_item *list, unsigned int indent)
}
regs
.
r
[
0
]
=
1
;
regs
.
r
[
1
]
=
(
int
)
list
->
name
;
if
(
list
->
type
==
hl_url
&&
hl_show_urls
)
regs
.
r
[
1
]
=
(
int
)
list
->
data
.
url
;
else
regs
.
r
[
1
]
=
(
int
)
list
->
name
;
regs
.
r
[
2
]
=
0
;
wimp_text_op
(
&
regs
);
...
...
@@ -1589,6 +1607,8 @@ _kernel_oserror * hotlist_add(char * description, char * url, int at_bottom)
break
;
}
if
(
!
e
)
return
hotlist_modified
(
HL_MODIFIED_ADD
);
return
e
;
}
...
...
@@ -1624,7 +1644,10 @@ static void hotlist_get_shape(unsigned int *xmin,
count
-=
2
;
regs
.
r
[
0
]
=
1
;
regs
.
r
[
1
]
=
(
int
)
item
->
name
;
if
(
item
->
type
==
hl_url
&&
hl_show_urls
)
regs
.
r
[
1
]
=
(
int
)
item
->
data
.
url
;
else
regs
.
r
[
1
]
=
(
int
)
item
->
name
;
regs
.
r
[
2
]
=
0
;
wimp_text_op
(
&
regs
);
...
...
@@ -1943,6 +1966,13 @@ static void hotlist_window_preopen(hl_opentype type)
BBox
bbox
;
WimpGetWindowStateBlock
state
;
int
height
,
width
;
unsigned
int
objectstate
;
if
(
type
==
already_open
)
{
toolbox_get_object_state
(
0
,
hotlist_windowid
,
&
objectstate
);
if
(
!
objectstate
&
Toolbox_GetObjectState_Showing
)
return
;
}
hotlist_get_entry_sizes
(
&
item_height
,
&
item_dir_width
,
&
item_url_width
);
...
...
@@ -2109,6 +2139,19 @@ void hotlist_set_menu_details(ObjectId menuid)
break
;
}
menu_get_sub_menu_show
(
0
,
menuid
,
HOTLIST_DISPLAY_MENUITEM
,
&
submenu_id
);
if
(
hl_show_urls
)
{
menu_set_tick
(
0
,
submenu_id
,
HOTLIST_MENU_SHOWDESCRIPTIONS
,
0
);
menu_set_tick
(
0
,
submenu_id
,
HOTLIST_MENU_SHOWURLS
,
1
);
}
else
{
menu_set_tick
(
0
,
submenu_id
,
HOTLIST_MENU_SHOWDESCRIPTIONS
,
1
);
menu_set_tick
(
0
,
submenu_id
,
HOTLIST_MENU_SHOWURLS
,
0
);
}
}
/*************************************************/
...
...
@@ -2125,6 +2168,7 @@ static int hotlist_menuopen_handler(int event_code, ToolboxEvent * event, IdBloc
unsigned
int
item_height
,
item_dir_width
,
item_url_width
;
unsigned
int
xmin
,
xmax
;
int
window_handle
;
ObjectId
sub_menu
;
hotlist_get_entry_sizes
(
&
item_height
,
&
item_dir_width
,
&
item_url_width
);
...
...
@@ -2141,6 +2185,8 @@ static int hotlist_menuopen_handler(int event_code, ToolboxEvent * event, IdBloc
menu_itemno
=
-
pointerblock
.
y
/
item_height
;
}
menu_get_sub_menu_show
(
0
,
id_block
->
self_id
,
HOTLIST_DISPLAY_MENUITEM
,
&
sub_menu
);
if
(
hotlist_count_selected_items
()
==
0
)
{
item
=
hotlist_find_item
(
hotlist_root
->
data
.
directory_content
,
menu_itemno
);
...
...
@@ -2152,9 +2198,10 @@ static int hotlist_menuopen_handler(int event_code, ToolboxEvent * event, IdBloc
if
(
item
&&
pointerblock
.
x
>=
xmin
&&
pointerblock
.
x
<=
xmax
)
{
item
->
flags
|=
HOTLIST_G_IS_SELECTED
;
item
->
flags
|=
HOTLIST_G_IS_SELECTED
|
HOTLIST_G_REDRAW_NOW
;
if
(
item
->
type
==
hl_directory
)
hotlist_set_flags
(
item
->
data
.
directory_content
,
hl_ALL
,
HOTLIST_G_IS_SELECTED
);
menu_select
=
1
;
hotlist_redraw_
items
(
menu_itemno
,
menu_item
no
);
hotlist_redraw_no
w
(
);
}
}
...
...
@@ -2658,6 +2705,8 @@ _kernel_oserror * hotlist_load(char * filename)
/* Finished; redraw issues are left to the caller */
if
(
!
e
)
return
hotlist_modified
(
HL_MODIFIED_LOAD
);
return
e
;
}
...
...
@@ -2806,6 +2855,16 @@ _kernel_oserror * hotlist_initialise(void)
hotlist_reset_directory_handler
,
NULL
));
RetError
(
event_register_toolbox_handler
(
-
1
,
HotlistShowDesc
,
hotlist_show_descriptions_handler
,
NULL
));
RetError
(
event_register_toolbox_handler
(
-
1
,
HotlistShowURLs
,
hotlist_show_urls_handler
,
NULL
));
return
NULL
;
}
...
...
@@ -2826,9 +2885,9 @@ _kernel_oserror * hotlist_initialise(void)
_kernel_oserror
*
hotlist_open
(
int
show_type
,
void
*
type
,
int
show_urls
)
{
/
/ Not implemented yet...
/
* Sets show descriptions / show URLs */
show_urls
=
show_urls
;
hl_
show_urls
=
show_urls
;
/* Set the size of the window etc. */
...
...
@@ -2896,6 +2955,8 @@ static int hotlist_menu_selectall_handler(int event_code, ToolboxEvent * event,
hotlist_set_menu_details
(
id_block
->
self_id
);
}
menu_select
=
0
;
return
1
;
}
...
...
@@ -2984,6 +3045,9 @@ static int hotlist_menu_delete_handler(int event_code, ToolboxEvent *event, IdBl
hotlist_redraw_items
(
0
,
noitems
);
hotlist_window_preopen
(
already_open
);
toolbox_hide_object
(
0
,
id_block
->
ancestor_id
);
hotlist_modified
(
HL_MODIFIED_DELETE
);
return
0
;
}
...
...
@@ -3153,7 +3217,10 @@ static int hotlist_newedit_url_handler(int event_code, ToolboxEvent *event, IdBl
tempdesc
,
tempurl
));
hotlist_window_preopen
(
already_open
);
hotlist_redraw_now
();
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
);
free
(
tempurl
);
break
;
...
...
@@ -3166,7 +3233,7 @@ static int hotlist_newedit_url_handler(int event_code, ToolboxEvent *event, IdBl
item
->
flags
|=
HOTLIST_G_REDRAW_NOW
;
hotlist_window_preopen
(
already_open
);
hotlist_redraw_now
();
//toolbox_hide_object(0, id_block->ancestor_id
);
hotlist_modified
(
HL_MODIFIED_ALTER
);
break
;
}
...
...
@@ -3216,7 +3283,10 @@ static int hotlist_newren_directory_handler(int event_code, ToolboxEvent *event,
HOTLIST_POSITION_END
,
&
tempitem
);
hotlist_window_preopen
(
already_open
);
hotlist_redraw_now
();
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
);
break
;
...
...
@@ -3226,6 +3296,7 @@ static int hotlist_newren_directory_handler(int event_code, ToolboxEvent *event,
item
->
flags
|=
HOTLIST_G_REDRAW_NOW
;
hotlist_window_preopen
(
already_open
);
hotlist_redraw_now
();
hotlist_modified
(
HL_MODIFIED_ALTER
);
//toolbox_hide_object(0, id_block->ancestor_id);
break
;
...
...
@@ -3339,7 +3410,9 @@ static void hotlist_drag_renderer(hotlist_item *item, unsigned int item_height,
}
regs
.
r
[
0
]
=
1
;
regs
.
r
[
1
]
=
(
int
)
item
->
name
;
if
(
item
->
type
==
hl_url
&&
hl_show_urls
)
regs
.
r
[
1
]
=
(
int
)
item
->
data
.
url
;
else
regs
.
r
[
1
]
=
(
int
)
item
->
name
;
regs
.
r
[
2
]
=
0
;
if
(
wimp_text_op
(
&
regs
))
/* Get width of text for text icon */
{
...
...
@@ -3351,8 +3424,16 @@ static void hotlist_drag_renderer(hotlist_item *item, unsigned int item_height,
hotlist_iconblock
.
bbox
.
xmax
=
temp_width
+
regs
.
r
[
0
]
+
16
;
hotlist_iconblock
.
bbox
.
ymax
=
item_height
;
hotlist_iconblock
.
bbox
.
ymin
=
4
;
if
(
item
->
type
==
hl_url
&&
hl_show_urls
)
{
hotlist_iconblock
.
data
.
it
.
buffer
=
item
->
data
.
url
;
hotlist_iconblock
.
data
.
it
.
buffer_size
=
strlen
(
item
->
data
.
url
);
}
else
{
hotlist_iconblock
.
data
.
it
.
buffer
=
item
->
name
;
hotlist_iconblock
.
data
.
it
.
buffer_size
=
strlen
(
item
->
name
);
}
if
(
wimp_plot_icon
(
&
hotlist_iconblock
))
{
...
...
@@ -3690,6 +3771,7 @@ static int hotlist_drag_completed_handler(int event_code, WimpPollBlock *event,
if
(
sourceitem
->
type
==
hl_directory
)
hotlist_clear_flags
(
sourceitem
->
data
.
directory_content
,
hl_ALL
,
HOTLIST_G_IS_SELECTED
);
targetitem
=
sourceitem
;
}
hotlist_modified
(
HL_MODIFIED_MOVE
);
}
else
{
...
...
@@ -3709,6 +3791,7 @@ static int hotlist_drag_completed_handler(int event_code, WimpPollBlock *event,
&
targetitem
);
if
(
sourceitem
->
type
==
hl_directory
)
hotlist_clear_flags
(
sourceitem
->
data
.
directory_content
,
hl_ALL
,
HOTLIST_G_IS_SELECTED
);
}
hotlist_modified
(
HL_MODIFIED_COPY
);
}
bottom2
=
hotlist_count_displayed_items
(
hotlist_root
->
data
.
directory_content
);
...
...
@@ -4143,3 +4226,48 @@ static unsigned int hotlist_no_contents_selected(hotlist_item * item)
return
1
;
}
/*************************************************/
/* hotlist_show_descriptions_handler() */
/* */
/* Selects show descriptions and redraws hotlist */
/* window and menu to reflect this */
/*************************************************/
static
int
hotlist_show_descriptions_handler
(
int
event_code
,
ToolboxEvent
*
event
,
IdBlock
*
id_block
,
void
*
handle
)
{
hl_show_urls
=
0
;
hotlist_set_menu_details
(
id_block
->
parent_id
);
hotlist_window_preopen
(
already_open
);
hotlist_redraw_items
(
0
,
hotlist_count_displayed_items
(
hotlist_root
->
data
.
directory_content
));
return
1
;
}
/*************************************************/
/* hotlist_show_urls_handler() */
/* */
/* Selects show urls and redraws hotlist window */
/* and menu to reflect this */
/*************************************************/
static
int
hotlist_show_urls_handler
(
int
event_code
,
ToolboxEvent
*
event
,
IdBlock
*
id_block
,
void
*
handle
)
{
hl_show_urls
=
1
;
hotlist_set_menu_details
(
id_block
->
parent_id
);
hotlist_window_preopen
(
already_open
);
hotlist_redraw_items
(
0
,
hotlist_count_displayed_items
(
hotlist_root
->
data
.
directory_content
));
return
1
;
}
/*************************************************/
/* hotlist_modified() */
/* */
/* Called whenever the hotlist is modified */
/*************************************************/
static
_kernel_oserror
*
hotlist_modified
(
unsigned
int
type
)
{
return
NULL
;
}
This diff is collapsed.
Click to expand it.
h/Hotlist
View file @
7a66122e
...
...
@@ -55,6 +55,9 @@
#define HotlistCloseAll 0x3009
#define HotlistDelete 0x300a
#define HotlistShowDesc 0x3013
#define HotlistShowURLs 0x3014
/* Enumerations */
typedef
enum
hotlist_type
...
...
@@ -166,6 +169,13 @@
#define HOTLIST_SCROLL_SPEED_INC 8
#define HOTLIST_SCROLL_SPEED_MAX 128
#define HL_MODIFIED_ADD 0
#define HL_MODIFIED_DELETE 1
#define HL_MODIFIED_MOVE 2
#define HL_MODIFIED_COPY 3
#define HL_MODIFIED_LOAD 4
#define HL_MODIFIED_ALTER 5
/* Various component IDs */
#define HOTLIST_URL_MENUITEM 0x05
...
...
@@ -175,6 +185,10 @@
#define HOTLIST_NEWURL_MENUITEM 0x06
#define HOTLIST_OPENALL_MENUITEM 0x03
#define HOTLIST_CLOSEALL_MENUITEM 0x04
#define HOTLIST_DISPLAY_MENUITEM 0x07
#define HOTLIST_MENU_SHOWDESCRIPTIONS 0x00
#define HOTLIST_MENU_SHOWURLS 0x01
#define HOTLIST_SAVE_SUBMENUITEM 0x00
#define HOTLIST_RENAME_SUBMENUITEM 0x01
...
...
@@ -189,6 +203,7 @@
#define HOTLIST_NEWURL_CANCEL 0x03
#define HOTLIST_NEWURL_NEW 0x02
/* Function prototypes */
_kernel_oserror
*
hotlist_initialise
(
void
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment