summaryrefslogtreecommitdiff
path: root/atari/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'atari/misc.c')
-rwxr-xr-xatari/misc.c121
1 files changed, 35 insertions, 86 deletions
diff --git a/atari/misc.c b/atari/misc.c
index 8b745fd2f..1b4c3eaf4 100755
--- a/atari/misc.c
+++ b/atari/misc.c
@@ -21,9 +21,9 @@
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
+
#include <sys/types.h>
-#include <mint/osbind.h>
-#include <windom.h>
+#include <mint/osbind.h>
#include "content/content.h"
#include "content/hlcache.h"
@@ -36,13 +36,14 @@
#include "utils/utils.h"
#include "utils/url.h"
#include "utils/log.h"
-#include "content/fetch.h"
+#include "content/fetch.h"
+
#include "atari/gui.h"
#include "atari/toolbar.h"
-#include "atari/browser.h"
+
#include "atari/misc.h"
#include "atari/encoding.h"
-#include "atari/msgbox.h"
+#include "atari/gemtk/gemtk.h"
#include "cflib.h"
extern void * h_gem_rsrc;
@@ -60,13 +61,13 @@ void warn_user(const char *warning, const char *detail)
snprintf(message, len, messages_get(warning), detail);
printf("%s\n", message);
- msg_box_show(MSG_BOX_ALERT, message);
+ gemtk_msg_box_show(GEMTK_MSG_BOX_ALERT, message);
}
void die(const char *error)
{
printf("%s\n", error);
- msg_box_show(MSG_BOX_ALERT, error);
+ gemtk_msg_box_show(GEMTK_MSG_BOX_ALERT, error);
exit(1);
}
@@ -111,10 +112,7 @@ bool path_add_part(char *path, int length, const char *newpart)
return true;
}
-/*
- TBD: make use of this function or remove it...
-*/
-struct gui_window * find_gui_window( unsigned long handle, short mode ){
+struct gui_window * find_guiwin_by_aes_handle(short handle){
struct gui_window * gw;
gw = window_list;
@@ -122,47 +120,20 @@ struct gui_window * find_gui_window( unsigned long handle, short mode ){
if( handle == 0 ){
return( NULL );
}
- else if( mode == BY_WINDOM_HANDLE ){
- WINDOW * win = (WINDOW*) handle;
- while( gw != NULL) {
- if( gw->root->handle == win ) {
- return( gw );
- }
- else
- gw = gw->next;
- }
- }
- else if( mode == BY_GEM_HANDLE ){
- short ghandle = (short)handle;
- while( gw != NULL) {
- if( gw->root->handle != NULL
- && gw->root->handle->handle == ghandle ) {
- return( gw );
- }
- else
- gw = gw->next;
- }
- }
-
- return( NULL );
-}
-
-
-struct gui_window * find_cmp_window( COMPONENT * c )
-{
- struct gui_window * gw;
- gw = window_list;
- while( gw != NULL ) {
- assert( gw->browser != NULL );
- if( gw->browser->comp == c ) {
- return( gw );
+
+ while(gw != NULL) {
+ if( gw->root->win != NULL
+ && gemtk_wm_get_handle(gw->root->win) == handle ) {
+ return(gw);
}
else
gw = gw->next;
}
+
return( NULL );
}
-
+
+
static int scan_process_list(scan_process_callback cb, void *data)
{
int pid, count = 0;
@@ -260,25 +231,6 @@ bool is_process_running(const char * name)
}
-/* -------------------------------------------------------------------------- */
-/* GEM Utillity functions: */
-/* -------------------------------------------------------------------------- */
-
-/* Return a string from resource file */
-char *get_rsc_string( int idx) {
- char *txt;
- RsrcGaddr( h_gem_rsrc, R_STRING, idx, &txt );
- return txt;
-}
-
-OBJECT *get_tree( int idx) {
- OBJECT *tree;
- RsrcGaddr( h_gem_rsrc, R_TREE, idx, &tree);
- return tree;
-}
-
-
-
/**
* Callback for load_icon(). Should be removed once bitmaps get loaded directly
* from disc
@@ -370,8 +322,8 @@ void gem_set_cursor( MFORM_EX * cursor )
static int number = 255;
if( flags == cursor->flags && number == cursor->number )
return;
- if( cursor->flags & MFORM_EX_FLAG_USERFORM ) {
- MouseSprite( cursor->tree, cursor->number);
+ if( cursor->flags & MFORM_EX_FLAG_USERFORM ) {
+ gemtk_obj_mouse_sprite(cursor->tree, cursor->number);
} else {
graf_mouse(cursor->number, NULL );
}
@@ -521,7 +473,8 @@ long nkc_to_input_key(short nkc, long * ucs4_out)
* \param name Default file name
* \return a static char pointer or null if the user aborted the selection.
*/
-const char * file_select( const char * title, const char * name ) {
+const char * file_select(const char * title, const char * name ) {
+
static char path[PATH_MAX]=""; // First usage : current directory
static char fullname[PATH_MAX]="";
char tmpname[255];
@@ -530,43 +483,39 @@ const char * file_select( const char * title, const char * name ) {
if( strlen(name)>254)
return( NULL );
- strcpy( tmpname, name );
+ strcpy(tmpname, name);
if( use_title == NULL ){
use_title = (char*)"";
}
- if( FselInput( path, tmpname, (char*)"", use_title, NULL, NULL)) {
- strncpy( fullname, path, PATH_MAX-1 );
- strncat( fullname, tmpname, PATH_MAX-strlen(fullname)-1 );
- return( (const char*)&fullname );
+ if (select_file(path, tmpname, (char*)"*", use_title, NULL)) {
+ snprintf(fullname, PATH_MAX, "%s%s", path, tmpname);
+ return((const char*)&fullname);
}
+
return( NULL );
}
-void dbg_lgrect( char * str, LGRECT * r )
-{
- printf("%s: x: %d, y: %d, w: %d, h: %d\n", str,
- r->g_x, r->g_y, r->g_w, r->g_h );
-}
-
-void dbg_grect( char * str, GRECT * r )
+void dbg_grect(const char * str, GRECT * r)
{
- printf("%s: x: %d, y: %d, w: %d, h: %d\n", str,
- r->g_x, r->g_y, r->g_w, r->g_h );
+ printf("%s: x: %d, y: %d, w: %d, h: %d (x2: %d, y2: %d)\n", str,
+ r->g_x, r->g_y, r->g_w, r->g_h, r->g_x + r->g_w, r->g_y + r->g_h);
}
-void dbg_pxy( char * str, short * pxy )
+void dbg_pxy(const char * str, short * pxy )
{
printf("%s: x: %d, y: %d, w: %d, h: %d\n", str,
pxy[0], pxy[1], pxy[2], pxy[3] );
}
-void dbg_rect( char * str, int * pxy )
+void dbg_rect(const char * str, int * pxy)
{
- printf("%s: x: %d, y: %d, w: %d, h: %d\n", str,
- pxy[0], pxy[1], pxy[2], pxy[3] );
+ printf("%s: x0: %d, y0: %d, x1: %d, y1: %d (w: %d, h: %d)\n", str,
+ pxy[0], pxy[1], pxy[2], pxy[3],
+ pxy[2] - pxy[0],
+ pxy[3] - pxy[1] );
}
/* some LDG functions here to reduce dependencies */