summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--amiga/Makefile.target2
-rw-r--r--amiga/bitmap.c1
-rwxr-xr-xamiga/bitmap.h2
-rwxr-xr-xamiga/clipboard.c1
-rw-r--r--amiga/download.c256
-rwxr-xr-xamiga/download.h11
-rwxr-xr-xamiga/gui.c40
-rwxr-xr-xamiga/gui.h1
-rwxr-xr-xamiga/gui_options.c1
-rwxr-xr-xamiga/menu.c1
-rw-r--r--amiga/theme.c2
-rwxr-xr-xamiga/tree.c2
12 files changed, 12 insertions, 308 deletions
diff --git a/amiga/Makefile.target b/amiga/Makefile.target
index 270568266..76477a475 100644
--- a/amiga/Makefile.target
+++ b/amiga/Makefile.target
@@ -38,7 +38,7 @@ S_AMIGA := compat.c gui.c tree.c history.c hotlist.c schedule.c \
plotters.c object.c menu.c save_pdf.c arexx.c version.c \
cookies.c context_menu.c clipboard.c save_complete.c \
fetch_mailto.c search.c history_local.c download.c iff_dr2d.c \
- sslcert.c gui_options.c print.c theme.c \
+ sslcert.c gui_options.c print.c theme.c drag.c \
stringview/stringview.c stringview/urlhistory.c
S_AMIGA := $(addprefix amiga/,$(S_AMIGA))
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index 26c34286f..418897e7b 100644
--- a/amiga/bitmap.c
+++ b/amiga/bitmap.c
@@ -17,7 +17,6 @@
*/
#include "assert.h"
-#include "image/bitmap.h"
#include "amiga/bitmap.h"
#include <proto/exec.h>
#include <proto/picasso96api.h>
diff --git a/amiga/bitmap.h b/amiga/bitmap.h
index 1af3d87b5..d2246d242 100755
--- a/amiga/bitmap.h
+++ b/amiga/bitmap.h
@@ -18,6 +18,8 @@
#ifndef AMIGA_BITMAP_H
#define AMIGA_BITMAP_H
+#include "image/bitmap.h"
+
#include <exec/types.h>
#include <proto/graphics.h>
#include <intuition/classusr.h>
diff --git a/amiga/clipboard.c b/amiga/clipboard.c
index 436a65961..d4f263d6a 100755
--- a/amiga/clipboard.c
+++ b/amiga/clipboard.c
@@ -28,6 +28,7 @@
#include "amiga/bitmap.h"
#include "amiga/iff_dr2d.h"
#include "amiga/menu.h"
+#include "amiga/drag.h"
#include <proto/iffparse.h>
#include <proto/intuition.h>
diff --git a/amiga/download.c b/amiga/download.c
index 5ae7301b2..96c322aed 100644
--- a/amiga/download.c
+++ b/amiga/download.c
@@ -41,6 +41,8 @@
#include "desktop/selection.h"
#include "desktop/save_complete.h"
+#include "image/ico.h"
+
#include "utils/errors.h"
#include "utils/log.h"
#include "utils/messages.h"
@@ -56,11 +58,6 @@
#include <reaction/reaction_macros.h>
-struct Window *drag_icon = NULL;
-ULONG drag_icon_width;
-ULONG drag_icon_height;
-BOOL drag_in_progress = FALSE;
-
struct gui_download_window *gui_download_window_create(download_context *ctx,
struct gui_window *gui)
{
@@ -329,255 +326,6 @@ gui_window_save_link(struct gui_window *g, const char *url, const char *title)
}
}
-void gui_drag_save_object(gui_save_type type, hlcache_handle *c,
- struct gui_window *g)
-{
- char *filetype;
-
- if(strcmp(option_use_pubscreen,"Workbench")) return;
-
- switch(type)
- {
- case GUI_SAVE_OBJECT_ORIG: // object
- case GUI_SAVE_SOURCE:
- filetype = ami_content_type_to_file_type(content_get_type(c));
- break;
- case GUI_SAVE_COMPLETE:
- filetype = "drawer";
- break;
- case GUI_SAVE_OBJECT_NATIVE:
-#ifdef WITH_NS_SVG
- if(content_get_type(c) == CONTENT_SVG)
- {
- filetype = "dr2d";
- }
- else
-#endif
- {
- filetype = "ilbm";
- }
- break;
- }
-
- ami_drag_icon_show(g->shared->win, filetype);
-
- drag_save_data = c;
- drag_save_gui = g;
- drag_save = type;
-}
-
-void gui_drag_save_selection(struct selection *s, struct gui_window *g)
-{
- ami_drag_icon_show(g->shared->win, "ascii");
-
- ami_autoscroll = TRUE;
- drag_save_data = s;
- drag_save = GUI_SAVE_TEXT_SELECTION;
-}
-
-void ami_drag_save(struct Window *win)
-{
- ULONG which = WBO_NONE,type;
- char path[1025],dpath[1025];
- char *source_data;
- ULONG source_size;
-
- ami_drag_icon_close(NULL);
- ami_autoscroll = FALSE;
-
- if(strcmp(option_use_pubscreen,"Workbench") == 0)
- {
- which = WhichWorkbenchObject(NULL,scrn->MouseX,scrn->MouseY,
- WBOBJA_Type,&type,
- WBOBJA_FullPath,&path,
- WBOBJA_FullPathSize,1024,
- WBOBJA_DrawerPath,&dpath,
- WBOBJA_DrawerPathSize,1024,
- TAG_DONE);
- }
-
- if((which == WBO_DRAWER) || ((which == WBO_ICON) && (type > WBDRAWER)))
- {
- strcpy(path,dpath);
- }
- else if(which == WBO_NONE)
- {
- if(drag_save == GUI_SAVE_TEXT_SELECTION)
- ami_drag_selection((struct selection *)drag_save_data);
- else DisplayBeep(scrn);
-
- drag_save = 0;
- drag_save_data = NULL;
- return;
- }
-
- if(path[0] == '\0')
- {
- DisplayBeep(scrn);
- drag_save = 0;
- drag_save_data = NULL;
- return;
- }
-
- ami_update_pointer(win,GUI_POINTER_WAIT);
-
- switch(drag_save)
- {
- case GUI_SAVE_OBJECT_ORIG: // object
- case GUI_SAVE_SOURCE:
- {
- struct hlcache_handle *c = drag_save_data;
- BPTR fh = 0;
- AddPart(path, content_get_title(c), 1024);
-
- if(fh = FOpen(path,MODE_NEWFILE,0))
- {
- if((source_data = content_get_source_data(c, &source_size)))
- FWrite(fh, source_data, 1, source_size);
-
- FClose(fh);
- SetComment(path, content_get_url(c));
- }
- }
- break;
-
- case GUI_SAVE_TEXT_SELECTION: // selection
- AddPart(path,"netsurf_text_file",1024);
- selection_save_text((struct selection *)drag_save_data,path);
- break;
-
- case GUI_SAVE_COMPLETE:
- {
- struct hlcache_handle *c = drag_save_data;
- BPTR lock = 0;
-
- AddPart(path, content_get_title(c), 1024);
- if(lock = CreateDir(path))
- {
- UnLock(lock);
- save_complete(c,path);
- SetComment(path, content_get_url(c));
- }
- ami_superimpose_favicon(path,
- drag_save_gui->favicon, NULL);
- }
- break;
-
- case GUI_SAVE_OBJECT_NATIVE:
- {
- hlcache_handle *c = drag_save_data;
- struct bitmap *bm;
-
- AddPart(path, content_get_title(c), 1024);
- if(bm = content_get_bitmap(c))
- {
- bm->url = content_get_url(c);
- bm->title = content_get_title(c);
- bitmap_save(bm, path, 0);
- }
-#ifdef WITH_NS_SVG
- else if(content_get_type(c) == CONTENT_SVG)
- {
- ami_save_svg(c, path);
- }
-#endif
- }
- break;
-
- default:
- LOG(("Unsupported drag save operation %ld",drag_save));
- break;
- }
-
- drag_save = 0;
- drag_save_data = NULL;
- ami_update_pointer(win,GUI_POINTER_DEFAULT);
-}
-
-void ami_drag_icon_show(struct Window *win, char *type)
-{
- struct DiskObject *dobj = NULL;
- ULONG *icondata1;
- ULONG width, height;
- long format = 0;
- int err = 0;
- int deftype = WBPROJECT;
-
- drag_in_progress = TRUE;
-
- if(option_drag_save_icons == false)
- {
- ami_update_pointer(win, AMI_GUI_POINTER_DRAG);
- return;
- }
- else
- {
- ami_update_pointer(win, GUI_POINTER_DEFAULT);
- }
-
- if(!strcmp(type, "drawer")) deftype = WBDRAWER;
-
- dobj = GetIconTags(NULL, ICONGETA_GetDefaultName, type,
- ICONGETA_GetDefaultType, deftype,
- TAG_DONE);
-
- err = IconControl(dobj,
- ICONCTRLA_GetWidth,&width,
- ICONCTRLA_GetHeight,&height,
- TAG_DONE);
-
- drag_icon_width = width;
- drag_icon_height = height;
-
- drag_icon = OpenWindowTags(NULL,
- WA_Left, scrn->MouseX - (width/2),
- WA_Top, scrn->MouseY - (height/2),
- WA_Width, width,
- WA_Height, height,
- WA_PubScreen, scrn,
- WA_Borderless, TRUE,
- WA_ToolBox, TRUE,
- WA_StayTop, TRUE,
- WA_Opaqueness, 128,
- WA_OverrideOpaqueness, TRUE,
- TAG_DONE);
-
-/* probably need layouticon and drawinfo stuff too */
-
- DrawIconState(drag_icon->RPort, dobj, NULL, 0, 0, IDS_NORMAL,
- ICONDRAWA_Frameless, TRUE,
- ICONDRAWA_Borderless, TRUE,
- TAG_DONE);
-}
-
-void ami_drag_icon_move(void)
-{
- if(drag_icon == NULL) return;
-
- ChangeWindowBox(drag_icon, scrn->MouseX - (drag_icon_width / 2),
- scrn->MouseY - (drag_icon_height / 2),
- drag_icon_width, drag_icon_height);
-}
-
-/**
- * Close the drag icon (invisible) window if it is open
- *
- * \param win pointer to window to clear drag pointer
- */
-
-void ami_drag_icon_close(struct Window *win)
-{
- if(drag_icon) CloseWindow(drag_icon);
- if(win) ami_update_pointer(win, GUI_POINTER_DEFAULT);
- drag_icon = NULL;
- drag_in_progress = FALSE;
-}
-
-BOOL ami_drag_in_progress(void)
-{
- return drag_in_progress;
-}
-
void ami_superimpose_favicon(STRPTR path, struct hlcache_handle *icon, STRPTR type)
{
struct DiskObject *dobj = NULL;
diff --git a/amiga/download.h b/amiga/download.h
index 6d7a782ff..3530c49ca 100755
--- a/amiga/download.h
+++ b/amiga/download.h
@@ -42,19 +42,8 @@ struct gui_download_window {
char fname[1024];
};
-int drag_save;
-void *drag_save_data;
-struct gui_window *drag_save_gui;
-
void ami_download_window_abort(struct gui_download_window *dw);
BOOL ami_download_window_event(struct gui_download_window *dw);
-void ami_drag_save(struct Window *win);
-void ami_drag_icon_show(struct Window *win, char *type);
-void ami_drag_icon_close(struct Window *win);
-void ami_drag_icon_move(void);
-BOOL ami_drag_in_progress(void);
void ami_free_download_list(struct List *dllist);
void ami_superimpose_favicon(STRPTR path, struct hlcache_handle *icon, STRPTR type);
-
-const char *ami_content_type_to_file_type(content_type type);
#endif
diff --git a/amiga/gui.c b/amiga/gui.c
index e44f3a73f..d0e88e905 100755
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -27,6 +27,7 @@
#include "desktop/searchweb.h"
#include "desktop/selection.h"
#include "desktop/textinput.h"
+#include "image/ico.h"
#include "render/form.h"
#include "utils/messages.h"
#include "utils/utf8.h"
@@ -40,6 +41,7 @@
#include "amiga/context_menu.h"
#include "amiga/cookies.h"
#include "amiga/download.h"
+#include "amiga/drag.h"
#include "amiga/fetch_mailto.h"
#include "amiga/font.h"
#include "amiga/gui.h"
@@ -72,7 +74,6 @@
#include <proto/graphics.h>
#include <proto/intuition.h>
#include <proto/keymap.h>
-#include <proto/layers.h>
#include <proto/locale.h>
#include <proto/Picasso96API.h>
#include <proto/timer.h>
@@ -3887,40 +3888,3 @@ struct box *ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *x, ULONG *y)
}
return text_box;
}
-
-struct gui_window_2 *ami_find_gwin_by_id(struct Window *win)
-{
- struct nsObject *node, *nnode;
- struct gui_window_2 *gwin;
-
- if(!IsMinListEmpty(window_list))
- {
- node = (struct nsObject *)GetHead((struct List *)window_list);
-
- do
- {
- nnode=(struct nsObject *)GetSucc((struct Node *)node);
-
- if(node->Type == AMINS_WINDOW) // or frame?
- {
- gwin = node->objstruct;
- if(win == gwin->win) return gwin;
- }
- } while(node = nnode);
- }
- return NULL;
-}
-
-struct gui_window_2 *ami_window_at_pointer(void)
-{
- struct Layer *layer;
-
- LockLayerInfo(&scrn->LayerInfo);
-
- layer = WhichLayer(&scrn->LayerInfo, scrn->MouseX, scrn->MouseY);
-
- UnlockLayerInfo(&scrn->LayerInfo);
-
- if(layer) return ami_find_gwin_by_id(layer->Window);
- else return NULL;
-}
diff --git a/amiga/gui.h b/amiga/gui.h
index 3743ff9fd..cd06b395d 100755
--- a/amiga/gui.h
+++ b/amiga/gui.h
@@ -132,7 +132,6 @@ void ami_do_redraw(struct gui_window_2 *g);
STRPTR ami_locale_langs(void);
int ami_key_to_nskey(ULONG keycode, struct InputEvent *ie);
struct box *ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *x, ULONG *y);
-struct gui_window_2 *ami_window_at_pointer(void);
struct TextFont *origrpfont;
struct MinList *window_list;
diff --git a/amiga/gui_options.c b/amiga/gui_options.c
index 59f5803f7..b5db61736 100755
--- a/amiga/gui_options.c
+++ b/amiga/gui_options.c
@@ -27,6 +27,7 @@
#include <intuition/classusr.h>
#include "amiga/object.h"
+#include "amiga/font.h"
#include "amiga/gui.h"
#include "amiga/gui_options.h"
#include "utils/messages.h"
diff --git a/amiga/menu.c b/amiga/menu.c
index 2ab4a055e..832dfc12f 100755
--- a/amiga/menu.c
+++ b/amiga/menu.c
@@ -41,6 +41,7 @@
#include "amiga/iff_dr2d.h"
#include "amiga/clipboard.h"
#include "amiga/gui_options.h"
+#include "amiga/theme.h"
#include "desktop/tree_url_node.h"
#include <classes/window.h>
#include <proto/intuition.h>
diff --git a/amiga/theme.c b/amiga/theme.c
index 7b10e139b..ad538c411 100644
--- a/amiga/theme.c
+++ b/amiga/theme.c
@@ -33,7 +33,7 @@
#include <intuition/pointerclass.h>
#include <workbench/icon.h>
-#include "amiga/download.h"
+#include "amiga/drag.h"
#include "amiga/options.h"
#include "amiga/theme.h"
#include "utils/messages.h"
diff --git a/amiga/tree.c b/amiga/tree.c
index 75886844f..a72de8d1f 100755
--- a/amiga/tree.c
+++ b/amiga/tree.c
@@ -50,7 +50,7 @@
#include "desktop/history_global_core.h"
#include "desktop/hotlist.h"
#include "amiga/sslcert.h"
-#include "amiga/download.h" /* drag icon stuff */
+#include "amiga/drag.h" /* drag icon stuff */
#include "amiga/theme.h" /* pointers */
#include "utils/utils.h"