Commit 3a006449 authored by Robert Sprowson's avatar Robert Sprowson

Read choices from Choices: not Choices$Write.

Use central definitions of Wimp_MHelpEnable and corresponding event
structure.
Remove unnecessary listening for FontMenu_Selection event, looks like a
copy'n'paste from the configure plugin.
Use the internationalised "_TaskName" from the messages file in error
boxes (requires loading the messages a bit earlier in main()).

Version 3.19. Tagged as 'Help2-3_19'
parent e22cdd2e
/* (3.18)
/* (3.19)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 3.18
#define Module_MajorVersion_CMHG 3.19
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 14 Jan 2012
#define Module_Date_CMHG 11 Feb 2012
#define Module_MajorVersion "3.18"
#define Module_Version 318
#define Module_MajorVersion "3.19"
#define Module_Version 319
#define Module_MinorVersion ""
#define Module_Date "14 Jan 2012"
#define Module_Date "11 Feb 2012"
#define Module_ApplicationDate "14-Jan-12"
#define Module_ApplicationDate "11-Feb-12"
#define Module_ComponentName "Help2"
#define Module_ComponentPath "castle/RiscOS/Sources/Apps/Help2"
#define Module_FullVersion "3.18"
#define Module_HelpVersion "3.18 (14 Jan 2012)"
#define Module_LibraryVersionInfo "3:18"
#define Module_FullVersion "3.19"
#define Module_HelpVersion "3.19 (11 Feb 2012)"
#define Module_LibraryVersionInfo "3:19"
......@@ -13,23 +13,16 @@
* limitations under the License.
*/
/*---------------------------------------------------------------------------*/
/* File: c.common */
/* File: common.c */
/* Purpose: Commonly used Wimp routines */
/* Author: Richard Leggett */
/* History: 28-Oct-97: RML: Begun (some routines nicked from PhotoQV) */
/*---------------------------------------------------------------------------*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "kernel.h"
#include "wimp.h"
#include "wimplib.h"
#include "toolbox.h"
#include "gadgets.h"
#include "swis.h"
#include "common.h"
#include "defines.h"
/* Global messages file descriptor and string pointer */
MessagesFD *message_block;
......@@ -51,7 +44,7 @@ void error_trap(_kernel_oserror *err, int err_type)
/* Report the appropriate error, has one occured */
if (err != NULL)
{
wimp_report_error(err, 0, TaskName, 0, 0, 0);
wimp_report_error(err, 0, messages_lookup("_TaskName"), 0, 0, 0);
/* Now, if it was a fatal error (type != 0), exit at once */
if (err_type != 0) exit(0);
......@@ -84,7 +77,7 @@ void messages_register(MessagesFD *messagefd_point, char *messagebuff_point)
* In: *
*---------------------------------------------------------------------------*/
char* messages_lookup(char *token_string)
char *messages_lookup(const char *token_string)
{
_kernel_swi_regs regs;
......@@ -98,7 +91,7 @@ char* messages_lookup(char *token_string)
}
char* messages_lookup_with_parameter(char* token_string, char* parameter)
char *messages_lookup_with_parameter(char *token_string, char *parameter)
{
_kernel_swi_regs regs;
......@@ -116,12 +109,12 @@ char* messages_lookup_with_parameter(char* token_string, char* parameter)
/*---------------------------------------------------------------------------*
* common_read_screensize *
* *
* Return the size of rhe screen in OS units *
* Return the size of the screen in OS units *
*---------------------------------------------------------------------------*/
_kernel_oserror* common_read_screensize(int* x, int* y)
_kernel_oserror *common_read_screensize(int *x, int *y)
{
_kernel_oserror* e;
_kernel_oserror *e;
int xeig, yeig, xpix, ypix;
e=_swix(OS_ReadModeVariable, _INR(0,1)|_OUT(2), -1, 4, &xeig); if (e) return e;
......@@ -142,7 +135,7 @@ _kernel_oserror* common_read_screensize(int* x, int* y)
* Given a string, return a kernel_oserror compatible error. *
*---------------------------------------------------------------------------*/
_kernel_oserror* common_error(char *s)
_kernel_oserror *common_error(char *s)
{
static _kernel_oserror e;
e.errnum=0;
......@@ -165,7 +158,7 @@ _kernel_oserror* common_error(char *s)
* by. *
*---------------------------------------------------------------------------*/
int strncmpa(char* str1, char* str2, int size)
int strncmpa(char *str1, char *str2, int size)
{
int n;
int equal=size;
......
......@@ -30,7 +30,6 @@
#include <stdlib.h>
#include <string.h>
#include "wimp.h"
#include "wimplib.h"
#include "swis.h"
#include "wimplib.h"
#include "toolbox.h"
......@@ -38,12 +37,11 @@
#include "window.h"
#include "iconbar.h"
#include "proginfo.h"
#include "fontmenu.h"
#include "menu.h"
#include "help.h"
#include "common.h"
#include "defines.h"
#include "VersionNum"
/* Toolbox/WIMP globals */
static MessagesFD messages_desc; /* Messagetrans */
......@@ -600,15 +598,13 @@ static int mode_change(WimpMessage *event, void *handler)
/*---------------------------------------------------------------------------*
* help_enable *
* *
* Message_HelpEnable recieved. *
* Message_HelpEnable received. *
*---------------------------------------------------------------------------*/
static int help_enable(WimpMessage *event, void *handler)
{
int flags = event->data.words[0];
/* Do we disable or enable Help? */
if (flags & HelpEnable_Disable)
if (event->data.help_enable.flags & Wimp_MHelpEnable_Disable)
{
if (help_on) toggle_onoff_status();
}
......@@ -618,7 +614,7 @@ static int help_enable(WimpMessage *event, void *handler)
}
/* Do we re-read settings? */
if (flags & HelpEnable_ReadSettings)
if (event->data.help_enable.flags & Wimp_MHelpEnable_ReadSettings)
{
if (helpbox_font_handle != -1)
{
......@@ -811,11 +807,11 @@ static int main_initialise(void)
Wimp_MHelpEnable,
0};
static int tbox_wanted[] = {Menu_Selection,
FontMenu_Selection,
Iconbar_Clicked,
0};
common_read_screensize(&screen_w, &screen_h);
messages_register(&messages_desc, messages_string);
memset(help_box_message, 0, sizeof(help_box_message));
error_trap(toolbox_initialise(0, 310, messages_wanted, tbox_wanted,
"<Help$Dir>", &messages_desc, &idb,
......@@ -824,7 +820,6 @@ static int main_initialise(void)
error_trap(event_set_mask(Wimp_Poll_RedrawWindowRequestMask +
Wimp_Poll_PointerLeavingWindowMask +
Wimp_Poll_PointerEnteringWindowMask ), 0);
messages_register(&messages_desc, messages_string);
initialise_toolbox_objects();
read_options();
......
......@@ -13,14 +13,14 @@
* limitations under the License.
*/
/*---------------------------------------------------------------------------*/
/* File: h.common */
/* File: common.h */
/*---------------------------------------------------------------------------*/
void error_trap(_kernel_oserror *err, int err_type);
void messages_register(MessagesFD *messagefd_point, char *messagebuff_point);
char* messages_lookup(char *token_string);
char* messages_lookup_with_parameter(char* token_string, char* parameter);
_kernel_oserror *common_read_screensize(int* x, int* y);
_kernel_oserror* common_error(char *s);
int strncmpa(char* str1, char* str2, int size);
char *messages_lookup(const char *token_string);
char *messages_lookup_with_parameter(char *token_string, char *parameter);
_kernel_oserror *common_read_screensize(int *x, int *y);
_kernel_oserror *common_error(char *s);
int strncmpa(char *str1, char *str2, int size);
int read_cmos_value(int location);
......@@ -13,25 +13,16 @@
* limitations under the License.
*/
/*---------------------------------------------------------------------------*/
/* File: h.defines */
/* Purpose: Various #defines used by interactive help */
/* Author: Richard Leggett */
/* History: 05-Jan-98: RML: Created. */
/* File: defines.h */
/*---------------------------------------------------------------------------*/
/* Current version */
#define TaskName "Help"
#include "VersionNum"
#define Version Module_MajorVersion " (" Module_ApplicationDate ")"
/* Compile with support for Choices file? */
#define UseChoicesFile 1
/* New WIMP messages */
#define Wimp_MHelpEnable 0x504
#define HelpEnable_Disable 1
#define HelpEnable_ReadSettings 2
/* Delay from hovering to showing (cs), otherwise use DefaultDelay */
#define MaxDelay 500
/* Delay between help requests (cs) */
......@@ -58,7 +49,7 @@
#define Option_Repeat 1u<<2
/* Strings in the config file */
#define ConfigFile "<Choices$Write>.Help.Config"
#define ConfigFile "Choices:Help.Config"
#define FontConfig "Font"
#define DelayConfig "Delay"
#define SizeConfig "Size"
......
......@@ -12,7 +12,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* h.help */
/*---------------------------------------------------------------------------*/
/* File: help.h */
/*---------------------------------------------------------------------------*/
int return_string_length(int font, char *string);
int break_strings_down(int font, int width, char *buffer);
......
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