Commit 2729d7af authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Change to link against tboxlibint

For some reason this toolbox module was unique in linking against the public toolboxlib rather than the internal one, this meant having to carefully tippy toe around not mixing header files (as they contain similar but differently named definitions).
A massive search and replace job.
Tested briefly using ResEd/ResTest and a textarea and scrolllist in a ROM build.
Requires Common-0_21.

Version 0.36. Tagged as 'Gadgets-0_36'
parent 25c43974
......@@ -15,6 +15,23 @@
#ifndef _TEXT_H
#define _TEXT_H
/* The constant error strings */
extern unsigned int e_nosuchblk;
extern unsigned int e_reinitmem;
extern unsigned int e_notinit;
extern unsigned int e_outofintmem;
extern unsigned int e_outofbarmem;
extern unsigned int e_badsbar;
extern unsigned int e_badindex;
extern unsigned int e_outoflistmem;
extern unsigned int e_badslist;
extern unsigned int e_badcol;
extern unsigned int e_outofareamem;
extern unsigned int e_badarea;
extern unsigned int e_badcol;
extern unsigned int e_active;
extern unsigned int e_outofmem;
extern void text_system_write0(const char *text, int x, int y);
extern void text_system_writeN(const char *text, int x, int y,
unsigned int line_len);
......
/* Copyright 1997 Acorn Computers Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/****************************************************************************
* This source file was written by Acorn Computers Limited. It is part of *
* the toolbox library for writing desktop applications in C. It may be *
* used freely in the creation of programs for Archimedes or Risc PC. It *
* should be used with Acorn's C Compiler Release 5 or later. *
* *
* *
* Copyright Acorn Computers Ltd, 1994 *
* *
***************************************************************************/
/*
* Name : textarea.h
* Description : C veneers to the Methods provided by the textarea gadget
*/
#ifndef __textarea_h
#define __textarea_h
#ifndef __kernel_h
#include "kernel.h"
#endif
#ifndef __toolbox_h
#include "toolbox.h"
#endif
#ifndef __window_h
#include "window.h"
#endif
/****************************************************************************
* TextArea Templates *
****************************************************************************/
/*-- flags --*/
#define TextArea_Scrollbar_Vertical 0x00000001
#define TextArea_Scrollbar_Horizontal 0x00000002
#define TextArea_WordWrap 0x00000004
#define TextAreaValidFlags 0xC0000007
/*-- templates --*/
typedef struct
{
GadgetHeader hdr;
int type;
int event;
char *text;
unsigned int foreground;
unsigned int background;
} TextArea;
/*-- TextArea methods --*/
#define TextArea_Base 0x4018
#define TextArea_Type (sizeof(TextArea)) << 16 | TextArea_Base
#define TextArea_SWIBase 0x140180
#define TextArea_GetState (TextArea_Base + 0)
#define TextArea_SetState (TextArea_Base + 1)
#define TextArea_SetText (TextArea_Base + 2)
#define TextArea_GetText (TextArea_Base + 3)
#define TextArea_InsertText (TextArea_Base + 4)
#define TextArea_ReplaceText (TextArea_Base + 5)
#define TextArea_GetSelection (TextArea_Base + 6)
#define TextArea_SetSelection (TextArea_Base + 7)
#define TextArea_SetFont (TextArea_Base + 8)
#define TextArea_SetColour (TextArea_Base + 9)
#define TextArea_GetColour (TextArea_Base + 10)
#define TextArea_SetCursorPosition (TextArea_Base + 11)
#define TextArea_GetCursorPosition (TextArea_Base + 12)
/*-- TextArea events --*/
/*-- TextArea SWI method constants --*/
#define TextArea_DesktopColours (1<<0)
/****************************************************************************
* The following functions provide veneers to the methods that are *
* associated with this particular class. Please read the C Release 5 *
* user guide for more detailed information on their functionality. *
****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
/*
* Name : textarea_replace_text
* Description : Replaces a block of text with new text in a specified textarea
* In : unsigned int flags
* ObjectId window
* ComponentId textarea
* unsigned int index_start
* unsigned int index_end
* const char *text
* Out : None
* Returns : pointer to error block
*/
extern _kernel_oserror *textarea_replace_text ( unsigned int flags,
ObjectId window,
ComponentId textarea,
unsigned int index_start,
unsigned int index_end,
const char *text
);
/*
* Name : textarea_insert_text
* Description : Inserts text at a specified offset into the specified textarea
* In : unsigned int flags
* ObjectId window
* ComponentId textarea
* unsigned int index
* const char *text
* Out : None
* Returns : pointer to error block
*/
extern _kernel_oserror *textarea_insert_text ( unsigned int flags,
ObjectId window,
ComponentId textarea,
unsigned int index,
const char *text
);
/*
* Name : textarea_set_state
* Description : Sets the state of the specified textarea.
* In : unsigned int flags
* ObjectId window
* ComponentId textarea
* unsigned int state
* Out : None
* Returns : pointer to error block
*/
extern _kernel_oserror *textarea_set_state ( unsigned int flags,
ObjectId window,
ComponentId textarea,
unsigned int state
);
/*
* Name : textarea_get_state
* Description : Gets the state of the specified textarea.
* In : unsigned int flags
* ObjectId window
* ComponentId textarea
* Out : unsigned int *state
* Returns : pointer to error block
*/
extern _kernel_oserror *textarea_get_state ( unsigned int flags,
ObjectId window,
ComponentId textarea,
unsigned int *state
);
/*
* Name : textarea_get_selection_text
* Description : Gets the selected text of the specified textarea.
* In : unsigned int flags
* ObjectId window
* ComponentId textarea
* char *buffer
* int size
* Out : unsigned int *nbytes
* Returns : pointer to error block
*/
extern _kernel_oserror *textarea_get_selection_text ( unsigned int flags,
ObjectId window,
ComponentId textarea,
char *buffer,
int size,
unsigned int *nbytes
);
/*
* Name : textarea_set_selection
* Description : Sets the selection for the specified textarea.
* In : unsigned int flags
* ObjectId window
* ComponentId textarea
* unsigned int index_start
* unsigned int index_end
* Out : None
* Returns : pointer to error block
*/
extern _kernel_oserror *textarea_set_selection ( unsigned int flags,
ObjectId window,
ComponentId textarea,
unsigned int index_start,
unsigned int index_end
);
/*
* Name : textarea_get_selection_points
* Description : Gets the selection points for the specified textarea.
* In : unsigned int flags
* ObjectId window
* ComponentId textarea
* Out : unsigned int *index_start
* unsigned int *index_end
* Returns : pointer to error block
*/
extern _kernel_oserror *textarea_get_selection_points ( unsigned int flags,
ObjectId window,
ComponentId textarea,
unsigned int *index_start,
unsigned int *index_end
);
/*
* Name : textarea_set_colour
* Description : Sets the colours for the specified textarea.
* In : unsigned int flags
* ObjectId window
* ComponentId textarea
* unsigned int foreground
* unsigned int background
* Out : None
* Returns : pointer to error block
*/
extern _kernel_oserror *textarea_set_colour ( unsigned int flags,
ObjectId window,
ComponentId textarea,
unsigned int foreground,
unsigned int background
);
/*
* Name : textarea_get_colour
* Description : Gets the colours currently being used for the specified textarea.
* In : unsigned int flags
* ObjectId window
* ComponentId textarea
* Out : unsigned int *foreground
* unsigned int *background
* Returns : pointer to error block
*/
extern _kernel_oserror *textarea_get_colour ( unsigned int flags,
ObjectId window,
ComponentId textarea,
unsigned int *foreground,
unsigned int *background
);
/*
* Name : textarea_get_text
* Description : Gets the text that is current displayed in the specified textarea.
* In : unsigned int flags
* ObjectId window
* ComponentId writable
* char *buffer
* int buff_size
* Out : int *nbytes
* Returns : pointer to error block
*/
extern _kernel_oserror *textarea_get_text ( unsigned int flags,
ObjectId window,
ComponentId writable,
char *buffer,
int buff_size,
int *nbytes
);
/*
* Name : textarea_set_text
* Description : Sets the text string to be shown in the specified textarea
* In : unsigned int flags
* ObjectId window
* ComponentId writable
* const char *text
* Out : None
* Returns : pointer to error block
*/
extern _kernel_oserror *textarea_set_text ( unsigned int flags,
ObjectId window,
ComponentId writable,
const char *text
);
/*
* Name : textarea_set_font
* Description : Set the font for the specified textarea.
* In : unsigned int flags
* ObjectId window
* ComponentId textarea
* const char *font_name
* unsigned int width
* unsigned int height
* Out : None
* Returns : pointer to error block
*/
extern _kernel_oserror *textarea_set_font ( unsigned int flags,
ObjectId window,
ComponentId textarea,
const char *font_name,
unsigned int width,
unsigned int height
);
/*
* Name : textarea_set_cursor_position
* Description : Sets the cursor position in a textarea
* In : unsigned int flags
* ObjectId window
* ComponentId textarea
* int index
* int *old_index
* Out : None
* Returns : pointer to error block
*/
extern _kernel_oserror *textarea_set_cursor_position ( unsigned int flags,
ObjectId window,
ComponentId textarea,
unsigned int index,
unsigned int *old_index
);
/*
* Name : textarea_get_cursor_position
* Description : Gets the cursor position in a textarea
* In : unsigned int flags
* ObjectId window
* ComponentId textarea
* unsigned int *index
* Out : None
* Returns : pointer to error block
*/
extern _kernel_oserror *textarea_get_cursor_position ( unsigned int flags,
ObjectId window,
ComponentId textarea,
unsigned int *index
);
#ifdef __cplusplus
}
#endif
#endif
......@@ -19,9 +19,6 @@
#define __TEXTAREAP_H
#include "modmem.h"
#include "TextArea.h"
#include "TextMan.h"
/*-- OS unit indent around edge of gadget for text --*/
#define TextArea_DefaultIndent 5
......@@ -33,10 +30,10 @@
#define NEWDELETE 1
typedef struct {
ObjectId parent_id;
ComponentId component_id;
ObjectId object_id;
BBox box;
ObjectID parent_id;
ComponentID component_id;
ObjectID object_id;
wimp_Bbox box;
int event;
unsigned int state;
int type;
......@@ -51,7 +48,7 @@ typedef struct {
_kernel_oserror *textarea_init(void);
_kernel_oserror *textarea_die(void);
int textarea_active(void);
_kernel_oserror *textarea_add(TextArea *, int wimpw, ObjectId obj_id,
_kernel_oserror *textarea_add(TextArea *, int wimpw, ObjectID obj_id,
int **icons, int **data);
_kernel_oserror *textarea_method(PrivateTextArea *handle,
_kernel_swi_regs *regs);
......@@ -60,9 +57,9 @@ _kernel_oserror *textarea_fade(PrivateTextArea *handle, int fade);
_kernel_oserror *textarea_plot(TextArea *);
_kernel_oserror *textarea_move(int type, PrivateTextArea *tdata,
BBox *box);
wimp_Bbox *box);
_kernel_oserror *textarea_redraw_all(unsigned int flags, ObjectId object_id);
_kernel_oserror *textarea_redraw_all(unsigned int flags, ObjectID object_id);
_kernel_oserror *textarea_filter(_kernel_swi_regs *regs);
......
......@@ -36,27 +36,10 @@ extern unsigned int redrawing_window;
extern int filter_toolbox_events[];
extern int filter_wimp_events[];
extern void work_to_screen(BBox *box, WimpGetWindowStateBlock *state);
extern void screen_to_work(BBox *box, WimpGetWindowStateBlock *state);
extern void work_to_screen(wimp_Bbox *box, wimp_GetWindowState *state);
extern void screen_to_work(wimp_Bbox *box, wimp_GetWindowState *state);
extern _kernel_oserror *redraw_gadget(int window_handle, GadgetHeader *hdr);
/* The constant error strings */
extern unsigned int e_nosuchblk;
extern unsigned int e_reinitmem;
extern unsigned int e_notinit;
extern unsigned int e_outofintmem;
extern unsigned int e_outofbarmem;
extern unsigned int e_badsbar;
extern unsigned int e_badindex;
extern unsigned int e_outoflistmem;
extern unsigned int e_badslist;
extern unsigned int e_badcol;
extern unsigned int e_outofareamem;
extern unsigned int e_badarea;
extern unsigned int e_badcol;
extern unsigned int e_active;
extern unsigned int e_outofmem;
#ifndef Service_RedrawingWindow
#define Service_RedrawingWindow 0x44ec6
#endif
......
......@@ -19,8 +19,6 @@
* rlougher Nov 96 Created
*/
#include "MemMan.h"
#define INSERTION_GAP 256
typedef struct
......
......@@ -18,7 +18,9 @@
#ifndef __UTILS_H
#define __UTILS_H
extern _kernel_oserror *work_to_screen_handle(BBox *visible,
BBox *work, int window_handle);
extern _kernel_oserror *work_to_screen_handle(wimp_Bbox *visible,
wimp_Bbox *work, int window_handle);
extern _kernel_oserror *window_get_wimp_handle(unsigned int flags,
ObjectID window, int *window_handle);
#endif
......@@ -24,25 +24,6 @@
#include "kernel.h"
#ifndef __wimp_h
#include "wimp.h"
#endif
#ifndef __toolbox_h
#include "toolbox.h"
#endif
#ifndef __window_h
#include "window.h"
#endif
/* Gadget extension service calls provided by the window module */
#define Service_WindowModuleStarting (Window_SWIChunkBase + 1)
#define Service_WindowModuleDying (Window_SWIChunkBase + 2)
#define Service_GadgetRegistered (Window_SWIChunkBase + 3)
#define Service_GadgetDeregistered (Window_SWIChunkBase + 4)
/* filter types */
typedef enum {GLib_ToolboxEvents = 0, GLib_WimpEvents = 1, GLib_WimpMessages =2} FilterTypes;
......@@ -102,15 +83,15 @@ void *mem_allocate(int amount);
void mem_free(void *tag);
int glib_create_icon(WimpCreateIconBlock *i);
int glib_create_icon(wimp_IconCreate *i);
int glib_create_gadget(ObjectId,Gadget *i,int f);
int glib_create_gadget(ObjectID,Gadget *i,int f);
void glib_move_gadget(int type, ObjectId obj,ComponentId id,BBox *box);
void glib_move_gadget(int type, ObjectID obj,ComponentID id,wimp_Bbox *box);
void graphics_window(BBox *area);
void graphics_window(wimp_Bbox *area);
BBox *intersection(BBox *a, BBox *b);
wimp_Bbox *intersection(wimp_Bbox *a, wimp_Bbox *b);
_kernel_oserror *add_task_interest(FilterTypes type, int *list, int SWI);
......
/* Copyright 1997 Acorn Computers Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define Window_RegisterExternal (Window_SWIChunkBase + 5)
#define Window_DeregisterExternal (Window_SWIChunkBase + 6)
#define Window_SupportExternal (Window_SWIChunkBase + 7)
/* Copyright 1997 Acorn Computers Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Created by cmhg vsn 5.00 [Jan 11 1995]
*/
#ifndef __cmhg_defs_h
#define __cmhg_defs_h
#define TextGadgets_00 0x140180
#define TextGadgets_TextArea 0x140180
#define TextGadgets_TextField 0x140181
#define TextGadgets_ScrollList 0x140182
#define TextGadgets_Scrollbar 0x140183
#define TextGadgets_RedrawAll 0x140184
#define TextGadgets_Filter 0x140185
#endif
......@@ -13,23 +13,19 @@
* limitations under the License.
*/
/*
* utils.h
* riscos_uti.h
*
* The utils.c file defines various functions that might otherwise
* have been found in a library like RISC OS Lib, ie. small functions
* based on SWI calls to RISC OS.
*
*/
#ifndef UTILS_H
#define UTILS_H
#ifndef RISCOS_UTI_H
#define RISCOS_UTI_H
#define FAILED 0
#define SUCCESS 1
#ifndef __toolbox_h
#include "toolbox.h"
#endif
/*
* This structure is used to carry information about a sprite around
*/
......@@ -53,13 +49,13 @@ _kernel_oserror * file_load(char *name, char *add) ;
void CLG(void);
char *object_name(ObjectId id);
char *object_name(ObjectID id);
int is_object(ObjectId id,char *name);
int is_object(ObjectID id,char *name);
void warn_about_memory(void);
ObjectId named_object(char *name);
ObjectID named_object(char *name);
char *lookup_token(const char *t);
......@@ -96,13 +92,13 @@ _kernel_oserror *os_plot(unsigned short command, int x, int y);
_kernel_oserror * os_sprite_plot_to_screen (ROSpriteInfo *sprinfo, char *tt, long x, long y);
// Following functions are defined in riscos_graphics.s
BBox get_graphics_window(void);
void set_graphics_window(BBox box);
wimp_Bbox get_graphics_window(void);
void set_graphics_window(wimp_Bbox box);
/* set_graphics_window_in_window ------------------------------------------
* Sets a graphics window inside existing graphics window
* Returns: 0 if new window is 0*0 pixels, else 1
*/
int set_graphics_window_in_window(BBox inside, BBox outside);
int set_graphics_window_in_window(wimp_Bbox inside, wimp_Bbox outside);
_kernel_oserror *colourtrans_set_gcol(unsigned int colour,
unsigned int flags, unsigned int action);
......
......@@ -23,6 +23,7 @@
GET hdr:Macros
GET Hdr:System
GET Hdr:Wimp
GET Hdr:Toolbox
GET Hdr:APCS.<APCS>
; APCS compliant
......@@ -73,4 +74,24 @@ work_to_screen_handle
Return "r4-r9"
; window_get_wimp_handle ---------------------------------------------------
; Gets the underlying Wimp handle for the specified window object
;
; On entry: r0 = flags
; r1 = window
; r2 = address of window_handle
; On exit: r0 = NULL (or pointer to error block)
window_get_wimp_handle
EXPORT window_get_wimp_handle
stmfd sp!, {r2, r4-r9, lr}
mov r2, #0 ; Window_GetWimpHandle
swi XToolbox_ObjectMiscOp
ldmvsfd sp!, {r2, r4-r9, pc}
ldmfd sp!, {r2, r4-r9, lr}
teq r2, #0
strne r0, [r2]
mov r0, #0
mov pc, lr
END
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