Commit 023b529f authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Sanitisation of window setup plugin

The window setup plugin is now concerned only with behavioural aspects of the window manager.
* Iconbar settings move here from the mouse setup plugin.
* Textured window backgrounds move out.
The taller window now also gains a scroll bar if too tall to fit on 640x480.

Version 0.15. Tagged as 'WindSetup-0_15'
parent 38311b72
......@@ -6,3 +6,4 @@ _ConfigText:Windows
_ConfigHelp:Click SELECT to open the windows and icon bar configuration window.
_ConfigSprite:co_windows
Err_NoDefCMOS:Cannot find default CMOS file
Err_BadClass:Resource file is corrupt
No preview for this file type
/* (0.14)
/* (0.15)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.14
#define Module_MajorVersion_CMHG 0.15
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 20 Jul 2013
#define Module_Date_CMHG 03 Aug 2013
#define Module_MajorVersion "0.14"
#define Module_Version 14
#define Module_MajorVersion "0.15"
#define Module_Version 15
#define Module_MinorVersion ""
#define Module_Date "20 Jul 2013"
#define Module_Date "03 Aug 2013"
#define Module_ApplicationDate "20-Jul-13"
#define Module_ApplicationDate "03-Aug-13"
#define Module_ComponentName "WindSetup"
#define Module_ComponentPath "castle/RiscOS/Sources/SystemRes/Configure2/PlugIns/WindSetup"
#define Module_FullVersion "0.14"
#define Module_HelpVersion "0.14 (20 Jul 2013)"
#define Module_LibraryVersionInfo "0:14"
#define Module_FullVersion "0.15"
#define Module_HelpVersion "0.15 (03 Aug 2013)"
#define Module_LibraryVersionInfo "0:15"
......@@ -28,13 +28,17 @@ Date Who Change
/* CLib */
#include <stdlib.h>
#include <string.h>
/* Toolbox */
#include "event.h"
#include "toolbox.h"
#include "window.h"
/* Common */
#include "error.h"
#include "misc.h"
#include "message.h"
/* Local headers */
#include "Settings.h"
#include "Main.h" /* includes prototypes for this file */
#include "ToolboxE.h"
#include "WimpE.h"
......@@ -63,17 +67,50 @@ In: Command line option:
int main (int argc, char *argv[])
{
int screeny;
ObjectTemplateHeader *objtemplate;
WindowTemplate *wintemplate;
WimpWindow *windef;
error_initialise ();
throw (toolbox_initialise (0, WimpVersion, wimpm_messages, toolboxe_events,
"<WindSetup$Dir>", &messages, &id_block, NULL, NULL, NULL));
misc_parsearguments (argc, argv);
throw (event_initialise (&id_block));
throw (event_set_mask (wimpe_mask));
//
/* Register for messages and events */
wimpm_register ();
wimpe_register ();
toolboxe_register ();
//
/* Read the window object in by hand */
throw (toolbox_template_lookup (0, "Windows", (void **)&objtemplate));
if (objtemplate->object_class != Window_ObjectClass) {
_kernel_oserror e = { 0, "" };
strcpy (e.errmess, message_lookup_direct (messages,"Err_BadClass"));
_swi (OS_GenerateError, _IN(0), &e);
}
wintemplate = objtemplate->body;
windef = &wintemplate->window;
screeny = _swi (OS_ReadModeVariable, _INR(0,1) | _RETURN(2), -1, 12) <<
_swi (OS_ReadModeVariable, _INR(0,1) | _RETURN(2), -1, 5);
/* Calculate the window height compared with the screen and
* turn the vertical scrollbar on if it doesn't fit
*/
if ((windef->visible_area.ymax - windef->visible_area.ymin) >= screeny) {
windef->flags |= WimpWindow_VScroll;
}
else {
windef->flags &= ~WimpWindow_VScroll;
}
throw (toolbox_create_object (Toolbox_CreateObject_InCore, objtemplate, &mainwindow_id));
misc_openwindow (mainwindow_id, TRUE);
settings_read (cmos_read);
/* Go */
error_recover_point();
while (!quit) {
throw (event_poll (NULL, &poll_block, NULL));
......
......@@ -44,19 +44,27 @@ Date Who Change
#include "Main.h"
#include "Settings.h" /* includes prototypes for this file */
const cmos cmos_details [14] ={ { 0xDE, 7, 1 }, /* WimpIconiseButton */
{ 0x8C, 5, 1 }, /* WimpSpritePrecedence */
const cmos cmos_details [19] ={ { 0xDE, 7, 1 }, /* IconiseButton */
{ 0x1C, 4, 1 }, /* WimpShiftToggle */
{ 0x8C, 7, 1 }, /* DesktopTileStatus */
{ 0xC5, 0, 1 }, /* WimpFlagsInstantDragMove */
{ 0xC5, 1, 1 }, /* WimpFlagsInstantDragResize */
{ 0xC5, 2, 1 }, /* WimpFlagsInstantDragHScroll */
{ 0xC5, 3, 1 }, /* WimpFlagsInstantDragVScroll */
{ 0xC5, 5, 1 }, /* WimpFlagsConfinementBR */
{ 0xC5, 6, 1 }, /* WimpFlagsConfinementTL */
{ 0x17, 5, 3 }, /* (WimpIconBarSpeed index) EOR 4 */
{ 0x1B, 5, 3 }, /* (WimpIconBarAcceleration index) EOR 3 */
{ 0x8C, 6, 1 } }; /* WimpButtonType */
{ 0x17, 5, 3 }, /* (IconBarSpeed index) EOR 4 */
{ 0x1B, 5, 3 }, /* (IconBarAcceleration index) EOR 3 */
{ 0x8C, 6, 1 }, /* ClickReleaseButtons */
{ 0xC5, 7, 1 }, /* WimpFlagsSubMenus */
{ 0x17, 0, 4 }, /* (WimpAutoMenuDelay EOR 10) */
{ 0x17, 4, 1 }, /* WimpAutoMenuDelayUnit */
{ 0x1B, 0, 4 }, /* (WimpMenuDragDelay EOR 10) */
{ 0x1B, 4, 1 }, /* WimpMenuDragDelayUnit */
{ 0x16, 7, 1 }, /* WimpAutoFrontIconBar */
{ 0xDF, 4, 4 }, /* (WimpAutoFrontDelay EOR 5) */
{ 0x16, 1, 1 } }; /* WimpAutoFrontDelayUnit */
/****** settings_read() ***************************************************\
......@@ -76,6 +84,17 @@ void settings_read (int(*get)(cmos item, void *messages))
//
throw (optionbutton_set_state (0, mainwindow_id, mainwindow_bandr, get (WimpFlagsConfinementBR, &messages)));
throw (optionbutton_set_state (0, mainwindow_id, mainwindow_tandl, get (WimpFlagsConfinementTL, &messages)));
throw (optionbutton_set_state (0, mainwindow_id, mainwindow_clickrelease, !get (ClickReleaseButtons, &messages)));
throw (optionbutton_set_state (0, mainwindow_id, mainwindow_iconise, get (IconiseButton, &messages)));
//
throw (optionbutton_set_state (0, mainwindow_id, mainwindow_submenuauto, value = get (WimpFlagsSubMenus, &messages)));
misc_shadecomponents (!value, mainwindow_id, mainwindow_submenuauto_shademin, mainwindow_submenuauto_shademax);
value = get (WimpAutoMenuDelay, &messages) ^ 10;
if (1 == get (WimpAutoMenuDelayUnit, &messages)) value *= 10;
throw (numberrange_set_value (0, mainwindow_id, mainwindow_submenuopen, value));
value = get (WimpMenuDragDelay, &messages) ^ 10;
if (1 == get (WimpMenuDragDelayUnit, &messages)) value *= 10;
throw (numberrange_set_value (0, mainwindow_id, mainwindow_submenuclose, value));
//
value = get (IconBarSpeed, &messages) ^ 4;
throw (numberrange_set_value (0, mainwindow_id, mainwindow_speed, value));
......@@ -85,10 +104,13 @@ void settings_read (int(*get)(cmos item, void *messages))
settings_update_display (mainwindow_id, mainwindow_accel2, value);
//
throw (optionbutton_set_state (0, mainwindow_id, mainwindow_shifttoggle, !get (WimpShiftToggle, &messages)));
throw (optionbutton_set_state (0, mainwindow_id, mainwindow_textures, !get (DesktopTileStatus, &messages)));
throw (optionbutton_set_state (0, mainwindow_id, mainwindow_clickrelease, !get (ClickReleaseButtons, &messages)));
throw (optionbutton_set_state (0, mainwindow_id, mainwindow_icons, get (ROMIconProtect, &messages)));
throw (optionbutton_set_state (0, mainwindow_id, mainwindow_iconise, get (IconiseButton, &messages)));
//
throw (optionbutton_set_state (0, mainwindow_id, mainwindow_iconbarfwd, value = !get (WimpAutoFrontIconBar, &messages)));
misc_shadecomponents (!value, mainwindow_id, mainwindow_iconbarfwd_shademin, mainwindow_iconbarfwd_shademax);
value = get (WimpAutoFrontDelay, &messages) ^ 5;
if (1 == get (WimpAutoFrontDelayUnit, &messages)) value *= 10;
throw (numberrange_set_value (0, mainwindow_id, mainwindow_iconbardelay, value));
//
}
/****** settings_write() **************************************************\
......@@ -117,6 +139,28 @@ BOOL settings_write (void)
cmos_write (WimpFlagsConfinementBR, value);
throw (optionbutton_get_state (0, mainwindow_id, mainwindow_tandl, &value));
cmos_write (WimpFlagsConfinementTL, value);
throw (optionbutton_get_state (0, mainwindow_id, mainwindow_clickrelease, &value));
sprintf (string, "Configure WimpButtonType %s", 0 == value ? "Release" : "Click");
_swi (OS_CLI, _IN(0), string);
ovalue = cmos_read (IconiseButton, NULL);
throw (optionbutton_get_state (0, mainwindow_id, mainwindow_iconise, &value));
sprintf (string, "Configure WimpIconiseButton %s", 0 == value ? "Off" : "On");
_swi (OS_CLI, _IN(0), string);
if (value != ovalue) reassert_mode = TRUE;
//
throw (optionbutton_get_state (0, mainwindow_id, mainwindow_submenuauto, &value));
if (value) {
cmos_write (WimpFlagsSubMenus, TRUE);
throw (numberrange_get_value (0, mainwindow_id, mainwindow_submenuopen, &value));
sprintf (string, "Configure WimpAutoMenuDelay %i", value);
_swi (OS_CLI, _IN(0), string);
throw (numberrange_get_value (0, mainwindow_id, mainwindow_submenuclose, &value));
sprintf (string, "Configure WimpMenuDragDelay %i", value);
_swi (OS_CLI, _IN(0), string);
}
else {
cmos_write (WimpFlagsSubMenus, FALSE);
}
//
throw (displayfield_get_value (0, mainwindow_id, mainwindow_speed2, buffer, sizeof(buffer), NULL));
sprintf (string, "Configure WimpIconBarSpeed %s", buffer);
......@@ -128,44 +172,16 @@ BOOL settings_write (void)
throw (optionbutton_get_state (0, mainwindow_id, mainwindow_shifttoggle, &value));
cmos_write (WimpShiftToggle, !value);
//
ovalue = !cmos_read (DesktopTileStatus, NULL);
throw (optionbutton_get_state (0, mainwindow_id, mainwindow_textures, &value));
cmos_write (DesktopTileStatus, !value);
if (value != ovalue) reassert_mode = TRUE;
//
throw (optionbutton_get_state (0, mainwindow_id, mainwindow_clickrelease, &value));
if (0 == value)
{
_swi (OS_CLI, _IN(0), "Configure WimpButtonType Release");
}
else
{
_swi (OS_CLI, _IN(0), "Configure WimpButtonType Click");
}
//
ovalue = cmos_read (ROMIconProtect, NULL);
throw (optionbutton_get_state (0, mainwindow_id, mainwindow_icons, &value));
if (0 == value)
{
_swi (OS_CLI, _IN(0), "Configure WimpSpritePrecedence RAM");
}
else
{
_swi (OS_CLI, _IN(0), "Configure WimpSpritePrecedence ROM");
throw (optionbutton_get_state (0, mainwindow_id, mainwindow_iconbarfwd, &value));
if (value) {
_swi (OS_CLI, _IN(0), "Configure WimpAutoFrontIconBar On");
throw (numberrange_get_value (0, mainwindow_id, mainwindow_iconbardelay, &value));
sprintf (string, "Configure WimpAutoFrontDelay %i", value);
_swi (OS_CLI, _IN(0), string);
}
if (value != ovalue) reassert_mode = TRUE;
//
ovalue = cmos_read (IconiseButton, NULL);
throw (optionbutton_get_state (0, mainwindow_id, mainwindow_iconise, &value));
if (0 == value)
{
_swi (OS_CLI, _IN(0), "Configure WimpIconiseButton Off");
}
else
{
_swi (OS_CLI, _IN(0), "Configure WimpIconiseButton On");
else {
_swi (OS_CLI, _IN(0), "Configure WimpAutoFrontIconBar Off");
}
if (value != ovalue) reassert_mode = TRUE;
//
misc_applywimpflags ();
if (reassert_mode) _swi (Wimp_SetMode, _IN(0), _swi (OS_ScreenMode, _IN(0)|_RETURN(1), 1));
......
......@@ -41,19 +41,19 @@ Date Who Change
#include "ToolboxE.h" /* includes prototypes for this file */
static int toolboxe_actionbuttonselected (int event_code, ToolboxEvent *event, IdBlock *id_block, void *handle);
static int toolboxe_optionbuttonstatechanged (int event_code, ToolboxEvent *event, IdBlock *id_block, void *handle);
static int toolboxe_numberrangevaluechanged (int event_code, ToolboxEvent *event, IdBlock *id_block, void *handle);
static int toolboxe_objectautocreated (int event_code, ToolboxEvent *event, IdBlock *id_block, void *handle);
int toolboxe_events [4] = { ActionButton_Selected,
OptionButton_StateChanged,
NumberRange_ValueChanged,
Toolbox_ObjectAutoCreated,
0 };
void toolboxe_register (void)
{
throw (event_register_toolbox_handler (-1, ActionButton_Selected, toolboxe_actionbuttonselected, NULL));
throw (event_register_toolbox_handler (-1, OptionButton_StateChanged, toolboxe_optionbuttonstatechanged, NULL));
throw (event_register_toolbox_handler (-1, NumberRange_ValueChanged, toolboxe_numberrangevaluechanged, NULL));
throw (event_register_toolbox_handler (-1, Toolbox_ObjectAutoCreated, toolboxe_objectautocreated, NULL));
}
/****** toolboxe_actionbuttonselected() ***********************************\
......@@ -86,6 +86,23 @@ static int toolboxe_actionbuttonselected (int event_code, ToolboxEvent *event, I
return 1;
}
/****** toolboxe_optionbuttonstatechanged() *******************************\
Purpose: Handles OptionButton_StateChanged event
\**************************************************************************/
static int toolboxe_optionbuttonstatechanged (int event_code, ToolboxEvent *event, IdBlock *id_block, void *handle)
{
if (id_block->self_component == mainwindow_submenuauto)
misc_shadecomponents (!((OptionButtonStateChangedEvent *) event)->new_state,
mainwindow_id, mainwindow_submenuauto_shademin, mainwindow_submenuauto_shademax);
if (id_block->self_component == mainwindow_iconbarfwd)
misc_shadecomponents (!((OptionButtonStateChangedEvent *) event)->new_state,
mainwindow_id, mainwindow_iconbarfwd_shademin, mainwindow_iconbarfwd_shademax);
return 1;
}
/****** toolboxe_numberrangevaluechanged() ********************************\
Purpose: Handles NumberRange_ValueChanged event
......@@ -114,17 +131,3 @@ static int toolboxe_numberrangevaluechanged (int event_code, ToolboxEvent *event
return 1;
}
/****** toolboxe_objectautocreated() **************************************\
Purpose: Handles Toolbox_ObjectAutoCreated event
\**************************************************************************/
static int toolboxe_objectautocreated (int event_code, ToolboxEvent *event, IdBlock *id_block, void *handle)
{
mainwindow_id = id_block->self_id;
misc_openwindow (mainwindow_id, TRUE);
settings_read (cmos_read);
return 1;
}
......@@ -40,42 +40,57 @@ Date Who Change
/* Constants */
#define IconiseButton ((cmos) cmos_details[0])
#define ROMIconProtect ((cmos) cmos_details[1])
#define WimpShiftToggle ((cmos) cmos_details[2])
#define DesktopTileStatus ((cmos) cmos_details[3])
#define WimpFlagsInstantDragMove ((cmos) cmos_details[4])
#define WimpFlagsInstantDragResize ((cmos) cmos_details[5])
#define WimpFlagsInstantDragHScroll ((cmos) cmos_details[6])
#define WimpFlagsInstantDragVScroll ((cmos) cmos_details[7])
#define WimpFlagsConfinementBR ((cmos) cmos_details[8])
#define WimpFlagsConfinementTL ((cmos) cmos_details[9])
#define IconBarSpeed ((cmos) cmos_details[10])
#define IconBarAcceleration ((cmos) cmos_details[11])
#define ClickReleaseButtons ((cmos) cmos_details[12])
#define WimpShiftToggle ((cmos) cmos_details[1])
#define WimpFlagsInstantDragMove ((cmos) cmos_details[2])
#define WimpFlagsInstantDragResize ((cmos) cmos_details[3])
#define WimpFlagsInstantDragHScroll ((cmos) cmos_details[4])
#define WimpFlagsInstantDragVScroll ((cmos) cmos_details[5])
#define WimpFlagsConfinementBR ((cmos) cmos_details[6])
#define WimpFlagsConfinementTL ((cmos) cmos_details[7])
#define IconBarSpeed ((cmos) cmos_details[8])
#define IconBarAcceleration ((cmos) cmos_details[9])
#define ClickReleaseButtons ((cmos) cmos_details[10])
#define WimpFlagsSubMenus ((cmos) cmos_details[11])
#define WimpAutoMenuDelay ((cmos) cmos_details[12])
#define WimpAutoMenuDelayUnit ((cmos) cmos_details[13])
#define WimpMenuDragDelay ((cmos) cmos_details[14])
#define WimpMenuDragDelayUnit ((cmos) cmos_details[15])
#define WimpAutoFrontIconBar ((cmos) cmos_details[16])
#define WimpAutoFrontDelay ((cmos) cmos_details[17])
#define WimpAutoFrontDelayUnit ((cmos) cmos_details[18])
#define mainwindow_dragmove ((ComponentId) 0x001)
#define mainwindow_dragmove ((ComponentId) 0x001) /* Redraw */
#define mainwindow_dragresize ((ComponentId) 0x002)
#define mainwindow_draghscroll ((ComponentId) 0x003)
#define mainwindow_dragvscroll ((ComponentId) 0x004)
#define mainwindow_dragall ((ComponentId) 0x006)
#define mainwindow_dragnone ((ComponentId) 0x007)
#define mainwindow_bandr ((ComponentId) 0x009)
#define mainwindow_bandr ((ComponentId) 0x009) /* Behaviour */
#define mainwindow_tandl ((ComponentId) 0x00a)
#define mainwindow_speed ((ComponentId) 0x00d)
#define mainwindow_clickrelease ((ComponentId) 0x018)
#define mainwindow_iconise ((ComponentId) 0x016)
#define mainwindow_submenuauto ((ComponentId) 0x019)
#define mainwindow_submenuopen ((ComponentId) 0x021)
#define mainwindow_submenuclose ((ComponentId) 0x023)
#define mainwindow_speed ((ComponentId) 0x00d) /* Iconbar */
#define mainwindow_speed2 ((ComponentId) 0x017)
#define mainwindow_accel ((ComponentId) 0x010)
#define mainwindow_accel2 ((ComponentId) 0x01a)
#define mainwindow_shifttoggle ((ComponentId) 0x012)
#define mainwindow_textures ((ComponentId) 0x013)
#define mainwindow_clickrelease ((ComponentId) 0x018)
#define mainwindow_icons ((ComponentId) 0x015)
#define mainwindow_iconise ((ComponentId) 0x016)
#define mainwindow_set ((ComponentId) 0x100)
#define mainwindow_iconbarfwd ((ComponentId) 0x030)
#define mainwindow_iconbardelay ((ComponentId) 0x032)
#define mainwindow_set ((ComponentId) 0x100) /* Actions */
#define mainwindow_cancel ((ComponentId) 0x101)
#define mainwindow_default ((ComponentId) 0x102)
/* Groups for shading/selecting */
#define mainwindow_dragmin ((ComponentId) 0x001)
#define mainwindow_dragmax ((ComponentId) 0x004)
#define mainwindow_submenuauto_shademin ((ComponentId) 0x020)
#define mainwindow_submenuauto_shademax ((ComponentId) 0x025)
#define mainwindow_iconbarfwd_shademin ((ComponentId) 0x031)
#define mainwindow_iconbarfwd_shademax ((ComponentId) 0x033)
/* Global variables */
......
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