home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of A1200
/
World_Of_A1200.iso
/
programs
/
printer
/
graphpaper
/
src
/
src.lha
/
buttons.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-04-06
|
2KB
|
103 lines
#include "graph.h"
struct Gadget *MinorMode;
static void EnableGad(struct Gadget *gad)
{
SnipAllBut(gad);
OnGadget(gad, wG, NULL); /* does a refresh */
RestoreGads();
}
static void DisableGad(struct Gadget *gad)
{
SnipAllBut(gad);
OffGadget(gad, wG, NULL); /* does a refresh */
RestoreGads();
}
void enable_minor_grid(void)
{
EnableGad(&Minor_Thickness);
EnableGad(&minor_x);
EnableGad(&minor_y);
EnableGad(&minor_slider_left);
EnableGad(&minor_slider_middle);
EnableGad(&minor_slider_right);
}
void disable_minor_grid(void)
{
DisableGad(&Minor_Thickness);
DisableGad(&minor_x);
DisableGad(&minor_y);
DisableGad(&minor_slider_left);
DisableGad(&minor_slider_middle);
DisableGad(&minor_slider_right);
}
static void turn_off(struct Gadget *gad)
{
gad->Flags &= ~SELECTED;
RefreshOneGad(gad);
}
void turnoff_others(struct Gadget *which)
{
if (which != &None ) turn_off(&None);
if (which != &Linear) turn_off(&Linear);
if (which != &LogX ) turn_off(&LogX);
if (which != &LogY ) turn_off(&LogY);
if (which != &LogLog) turn_off(&LogLog);
}
void enter(struct Gadget *gad, char *name)
{
MinorMode = gad;
if (!(gad->Flags & SELECTED)) {
/* was on - don't allow direct turn off */
/* turn it back on */
gad->Flags |= SELECTED;
}
sprintf(messagebuf, "Minor Grid: %s", name);
message(messagebuf);
turnoff_others(gad);
}
void MG_None(APTR object)
{
enter(&None, "None");
disable_minor_grid();
}
void MG_Linear(APTR object)
{
enter(&Linear, "Linear");
enable_minor_grid();
}
void MG_LogX(APTR object)
{
enter(&LogX, "LogX");
enable_minor_grid();
}
void MG_LogY(APTR object)
{
enter(&LogY, "LogY");
enable_minor_grid();
}
void MG_LogLog(APTR object)
{
enter(&LogLog, "LogLog");
enable_minor_grid();
}
/* initialize - enable only the Linear button */
void button_init(void)
{
MG_Linear(NULL);
}