G4P GUI Builder  4.4
Visual GUI designer for the G4P v4.3.1 library
 All Classes Namespaces Functions Variables
g4p.tool.gui.GuiControl Class Reference
Inheritance diagram for g4p.tool.gui.GuiControl:

Classes

class  CodeTag
 

Public Member Functions

 GuiControl (Editor editor, CtrlTabView tabs, CtrlSketchView tree, CtrlPropView props)
 
boolean addComponent (DBase comp)
 
boolean removeComponent ()
 
void setScale (int scale)
 
void showGrid (boolean show)
 
void snapGrid (boolean snap)
 
void setGridSize (int gs)
 
void setSketchSize (SketchSizeType sst)
 
SketchSizeType getSketchSizeFromCode ()
 
String scrubComments (String what)
 
void codeCapture ()
 
void codeGeneration ()
 
void saveGuiLayout ()
 
void loadGuiLayout ()
 

Package Attributes

Pattern pSize
 

Private Member Functions

String makeGuiCode ()
 
SketchCode getTab (Sketch s, String tabName)
 
int getTabIndex (Sketch s, String tabName)
 
void makeGUIfromTreeModel (CtrlSketchModel m)
 
CtrlSketchModel getBaseSketchModel ()
 

Private Attributes

Editor editor = null
 
CtrlTabView tabs
 
CtrlSketchView tree
 
CtrlPropView props
 
String guiPdeBase = ""
 
Pattern pCode
 
Matcher m
 

Additional Inherited Members

- Public Attributes inherited from g4p.tool.TFileConstants
final String SEP = File.separator
 
final String PDE_TAB_PRETTY_NAME = "gui"
 
final String PDE_TAB_NAME = PDE_TAB_PRETTY_NAME + ".pde"
 
final String CONFIG_FOLDER = "GUI_BUILDER_DATA"
 
final String GUI_MODEL_FILE_FILTER = "gui.ser."
 
final String GUI_MODEL_FILENAME = GUI_MODEL_FILE_FILTER + G4PTool.getCompatibleVersionNo()
 
final String GUI_MODEL_FILE = CONFIG_FOLDER + SEP + GUI_MODEL_FILENAME
 
final String G4P_TOOL_DATA_FOLDER = "tools" + SEP + "##project.name##" + SEP + "data"
 
final String G4P_LIB = "G4P" + SEP + "library" + SEP + "G4P.jar"
 
final String GUI_PDE_BASE = G4P_TOOL_DATA_FOLDER + SEP + "gui_base.txt"
 
final String TAB0_PDE_BASE = G4P_TOOL_DATA_FOLDER + SEP + "tab0.txt"
 
- Public Attributes inherited from g4p.tool.TDataConstants
int COMPONENT_NAME = 0x00000020
 
int COMPONENT_NAME_0 = 0x00000021
 
int COLOUR_SCHEME = 0x00000022
 
int CURSOR_CHANGER = 0x00000023
 
int SLIDER_SKIN = 0x00000024
 
int RENDERER = 0x00000025
 
int KNOB_CTRL = 0x00000026
 
int ICON_POS = 0x00000027
 
int H_ALIGN = 0x00000028
 
int V_ALIGN = 0x00000029
 
int VALUE_TYPE = 0x0000002A
 
int TEXT_ORIENT = 0x0000002B
 
int STICK_TYPE = 0x0000002C
 
int CLOSE_ACTION = 0x0000002D
 
int SCALE = 0x0000002E
 
int FONT = 0x0000002F
 
int FONT_STYLE = 0x00000030
 
int VALID = 0x00000040
 
int INVALID_LENGTH = 0x00000041
 
int FIRST_CHAR_INVALID = 0x00000042
 
int HAS_A_SPACE = 0x00000043
 
int INVALID_CHAR = 0x00000044
 
int UNAVAILABLE = 0x00000045
 
String CODE_TAG = "(//_CODE_:.*:\\d{6}:)"
 
String SK_SIZE = "(?:^|\\s|;)size\\s*\\(\\s*(\\S+)\\s*,\\s*(\\d+),?\\s*([^\\)]*)\\s*\\)"
 
String ADD_HANDLER = " {0}.addEventHandler({1}, \"{2}\");\n"
 
String ADD_DRAW_HANDLER = " {0}.addDrawHandler({1}, \"{2}\");\n"
 
String ADD_MOUSE_HANDLER = " {0}.addMouseHandler({1}, \"{2}\");\n"
 
String ADD_KEY_HANDLER = " {0}.addKeyHandler({1}, \"{2}\");\n"
 
String ADD_PRE_HANDLER = " {0}.addPreHandler({1}, \"{2}\");\n"
 
String ADD_POST_HANDLER = " {0}.addPostHandler({1}, \"{2}\");\n"
 
String ADD_CLOSE_HANDLER = " {0}.addOnCloseHandler({1}, \"{2}\");\n"
 
String METHOD_START_0 = "public void {0}({1} source) [ //_CODE_:{2}:{3}:\n"
 
String METHOD_START_1 = "public void {0}({1} source, GEvent event) [ //_CODE_:{2}:{3}:\n"
 
String WIN_DRAW = "synchronized public void {0}(PApplet appc, GWinData data) [ //_CODE_:{1}:{2}:\n"
 
String WIN_MOUSE = "synchronized public void {0}(PApplet appc, GWinData data, MouseEvent mevent) [ //_CODE_:{1}:{2}:\n"
 
String WIN_KEY = "synchronized public void {0}(PApplet appc, GWinData data, KeyEvent kevent) [ //_CODE_:{1}:{2}:\n"
 
String WIN_PRE = "synchronized public void {0}(PApplet appc, GWinData data) [ //_CODE_:{1}:{2}:\n"
 
String WIN_POST = "synchronized public void {0}(PApplet appc, GWinData data) [ //_CODE_:{1}:{2}:\n"
 
String ON_CLOSE = "public void {0}(GWindow window) [ //_CODE_:{1}:{2}:\n"
 
String METHOD_END = "] //_CODE_:{0}:{1}:\n\n"
 
String SET_SKETCH_TITLE = " surface.setTitle(\"{0}\");\n"
 
String SET_SKETCH_COLOR = " G4P.setGlobalColorScheme(GCScheme.{0});\n"
 
String SET_G4P_MESSAGES = " G4P.messagesEnabled({0});\n"
 
String SET_CURSOR_OFF = " G4P.setCursor({0});\n"
 
String SET_MOUSE_OVER_ON = " G4P.setMouseOverEnabled({0});\n"
 
String SET_ROUND_CORNERS = " GButton.useRoundCorners({0});\n"
 
String SET_GLOBAL_DISPLAY_FONT = " G4P.setDisplayFont(\"{0}\", {1}, {2});\n"
 
String SET_GLOBAL_INPUT_FONT = " G4P.setInputFont(\"{0}\", {1}, {2});\n"
 
String SET_GLOBAL_SLIDER_FONT = " G4P.setSliderFont(\"{0}\", {1}, {2});\n"
 
String SET_TEXT = " {0}.setText(\"{1}\");\n"
 
String SET_PROMPT_TEXT = " {0}.setPromptText(\"{1}\");\n"
 
String SET_TEXT_ALIGN = " {0}.setTextAlign(GAlign.{1}, GAlign.{2});\n"
 
String SET_ICON = " {0}.setIcon(\"{1}\", {2}, GAlign.{3}, GAlign.{4}, GAlign.{5});\n"
 
String SET_ICON_POS = " {0}.setIconPos(GAlign.{1});\n"
 
String SET_ICON_ALIGN = " {0}.setIconAlign(GAlign.{1}, GAlign.{2});\n"
 
String SET_TEXT_BOLD = " {0}.setTextBold();\n"
 
String SET_TEXT_ITALIC = " {0}.setTextItalic();\n"
 
String SET_OPAQUE = " {0}.setOpaque({1});\n"
 
String SET_ACTION_ON_CLOSE = " {0}.setActionOnClose(G4P.{1});\n"
 
String SET_LOCAL_COLOR = " {0}.setLocalColorScheme(GCScheme.{1});\n"
 
String CTOR_WINDOW = " {0} = GWindow.getWindow({1}, \"{2}\", {3}, {4}, {5}, {6}, {7});\n {0}.noLoop();\n"
 
String LOOP_WINDOW = " {0}.loop();\n"
 
String CTOR_GBUTTON = " {0} = new GButton({1}, {2}, {3}, {4}, {5});\n"
 
String CTOR_IMG_BTN_XYWHFM = " {0} = new GImageButton({1}, {2}, {3}, {4}, {5}, {6}, \"{7}\");\n"
 
String CTOR_IMG_BTN_XYWHF = " {0} = new GImageButton({1}, {2}, {3}, {4}, {5}, {6});\n"
 
String CTOR_IMG_BTN_XYFM = " {0} = new GImageButton({1}, {2}, {3}, {4}, \"{5}\");\n"
 
String CTOR_IMG_BTN_XYF = " {0} = new GImageButton({1}, {2}, {3}, {4});\n"
 
String CTOR_IMG_TOG_BTN_0 = " {0} = new GImageToggleButton({1}, {2}, {3});\n"
 
String CTOR_IMG_TOG_BTN_1 = " {0} = new GImageToggleButton({1}, {2}, {3}, \"{4}\", {5}, {6});\n"
 
String CTOR_IMG_TOG_BTN_2 = " {0} = new GImageToggleButton({1}, {2}, {3}, \"{4}\", \"{5}\", {6}, {7});\n"
 
String CTOR_GSTICK = " {0} = new GStick({1}, {2}, {3}, {4}, {5});\n"
 
String SET_STICK_MODE = " {0}.setMode(G4P.{1});\n"
 
String CTOR_GCHECKBOX = " {0} = new GCheckbox({1}, {2}, {3}, {4}, {5});\n"
 
String CTOR_GLABEL = " {0} = new GLabel({1}, {2}, {3}, {4}, {5});\n"
 
String CTOR_VIEW = " {0} = new GView({1}, {2}, {3}, {4}, {5}, {6});\n"
 
String CTOR_VIEW_PCAM_6 = " {0} = new GViewPeasyCam({1}, {2}, {3}, {4}, {5}, {6});\n"
 
String CTOR_VIEW_PCAM_9 = " {0} = new GViewPeasyCam({1}, {2}, {3}, {4}, {5}, new PVector({6}, {7}, {8}), {9});\n"
 
String CTOR_GOPTION = " {0} = new GOption({1}, {2}, {3}, {4}, {5});\n"
 
String SEL_OPTION = " {0}.setSelected({1});\n"
 
String CTOR_GOPTIONGROUP = " {0} = new GToggleGroup();\n"
 
String CTOR_GPANEL = " {0} = new GPanel({1}, {2}, {3}, {4}, {5}, \"{6}\");\n"
 
String COLLAPSED = " {0}.setCollapsed({1});\n"
 
String COLLAPSIBLE = " {0}.setCollapsible({1});\n"
 
String DRAGGABLE = " {0}.setDraggable({1});\n"
 
String CTOR_GPASSWORD1 = " {0} = new GPassword({1}, {2}, {3}, {4}, {5});\n"
 
String CTOR_GPASSWORD2 = " {0} = new GPassword({1}, {2}, {3}, {4}, {5}, {6});\n"
 
String PWORD_SIZE = " {0}.setMaxWordLength({1});\n"
 
String CTOR_GTEXTFIELD = " {0} = new GTextField({1}, {2}, {3}, {4}, {5}, {6});\n"
 
String CTOR_GTEXTAREA = " {0} = new GTextArea({1}, {2}, {3}, {4}, {5}, {6});\n"
 
String SBAR_POLICY = ""
 
String CTOR_GSLIDER = " {0} = new GSlider({1}, {2}, {3}, {4}, {5}, {6});\n"
 
String CTOR_GSLIDER2D = " {0} = new GSlider2D({1}, {2}, {3}, {4}, {5});\n"
 
String MAKE_VERT = " {0}.setRotation({1}, GControlMode.CORNER);\n"
 
String SET_LIMITS = " {0}.setLimits({1}, {2}, {3});\n"
 
String SET_X_LIMITS = " {0}.setLimitsX({1}, {2}, {3});\n"
 
String SET_Y_LIMITS = " {0}.setLimitsY({1}, {2}, {3});\n"
 
String SET_VALUE_TYPE = " {0}.setNumberFormat(G4P.{1}, {2});\n"
 
String SET_NBR_TICKS = " {0}.setNbrTicks({1});\n"
 
String SET_STICK_TICKS = " {0}.setStickToTicks({1});\n"
 
String SET_SHOW_TICKS = " {0}.setShowTicks({1});\n"
 
String SET_SHOW_VALUE = " {0}.setShowValue({1});\n"
 
String SET_SHOW_LIMITS = " {0}.setShowLimits({1});\n"
 
String SET_TEXT_ORIENT = " {0}.setTextOrientation(G4P.{1});\n"
 
String SET_EASING = " {0}.setEasing({1});\n"
 
String CTOR_GCUSTOMSLIDER = " {0} = new GCustomSlider({1}, {2}, {3}, {4}, {5}, \"{6}\");\n"
 
String CTOR_GTIMER = " {0} = new GTimer({1}, {2}, \"{3}\", {4});\n"
 
String START_TIMER_0 = " {0}.start();\n"
 
String START_TIMER_1 = " {0}.start({1});\n"
 
String INIT_DELAY_TIMER = " {0}.setInitialDelay({1});\n"
 
String CTOR_GKNOB = " {0} = new GKnob({1}, {2}, {3}, {4}, {5}, {6});\n"
 
String SET_TURN_RANGE = " {0}.setTurnRange({1}, {2});\n"
 
String SET_CONTROLLER = " {0}.setTurnMode(GKnob.CTRL_{1});\n"
 
String SET_DRAG_SENSITIVITY = " {0}.setSensitivity({1});\n"
 
String SET_SHOW_TRACK = " {0}.setShowTrack({1});\n"
 
String SET_SHOW_ARC_ONLY = " {0}.setShowArcOnly({1});\n"
 
String SET_OVER_ARC_ONLY = " {0}.setOverArcOnly({1});\n"
 
String SET_OVER_GRIP_ONLY = " {0}.setIncludeOverBezel({1});\n"
 
String CTOR_DROPLIST = " {0} = new GDropList({1}, {2}, {3}, {4}, {5}, {6}, {7});\n"
 
String CTOR_SET_LIST = " {0}.setItems(loadStrings(\"{1}\"), {2});\n"
 
String TIME = "+ millis());\n"
 
String EVENT_TYPE_TIME = "+ event + \" @ \" + millis());\n"
 
String CODE_ANY = " println(\"{0} - {1} >> GEvent.\" " + EVENT_TYPE_TIME
 
String CODE_NO_EVENT_PARAM = " println(\"{0} - {1} >> an event occured @ \" " + TIME
 
String CODE_GWINDOW_DRAW = " appc.background(230);\n"
 
String CODE_GWINDOW_MOUSE = " println(\"{0} - mouse event \" " + TIME
 
String CODE_GWINDOW_KEY = " println(\"{0} - key event \" " + TIME
 
String CODE_GWINDOW_PRE = " println(\"{0} - pre method called \" " + TIME
 
String CODE_GWINDOW_POST = " println(\"{0} - post method called \" " + TIME
 
String CODE_GWINDOW_CLOSE = " println(\"{0} - window closed at \" " + TIME
 
String INDENT = " "
 
String ADD_A_CHILD = " {0}.addControl({1});\n"
 

Detailed Description

Provides main functionality for using the tool.

Includes code generation functionality and event handling code capture.

Author
Peter Lager

Constructor & Destructor Documentation

g4p.tool.gui.GuiControl.GuiControl ( Editor  editor,
CtrlTabView  tabs,
CtrlSketchView  tree,
CtrlPropView  props 
)
Parameters
tabs
tree
props

Member Function Documentation

void g4p.tool.gui.GuiControl.codeCapture ( )

Capture user code in the event handlers

void g4p.tool.gui.GuiControl.codeGeneration ( )

Create the code when then the editor loses focus.

CtrlSketchModel g4p.tool.gui.GuiControl.getBaseSketchModel ( )
private

Create a blank sketch. Starts with a DAplication for the root and a single DWindow child to represent the main

Returns
SketchSizeType g4p.tool.gui.GuiControl.getSketchSizeFromCode ( )

Get the size of the sketch from the code

Returns
null if no size found
SketchCode g4p.tool.gui.GuiControl.getTab ( Sketch  s,
String  tabName 
)
private

For a particular sketch get the SketchCode for a given tab name.

Parameters
s
tabName
Returns
int g4p.tool.gui.GuiControl.getTabIndex ( Sketch  s,
String  tabName 
)
private

For a particular sketch get the index number of a tab with a given name.

Parameters
s
tabName
Returns
void g4p.tool.gui.GuiControl.loadGuiLayout ( )

This method loads the serialised GUI layout (tree model) if available otherwise it creates a blank model.

void g4p.tool.gui.GuiControl.makeGUIfromTreeModel ( CtrlSketchModel  m)
private

This method is to prove that the entire GUI can be created from a Tree data model

Parameters
m
void g4p.tool.gui.GuiControl.saveGuiLayout ( )

This saves the GUI (tree) model) layout using serialisation.

String g4p.tool.gui.GuiControl.scrubComments ( String  what)

Replace all commented portions of a given String as spaces.
Copied from processing.mode.java.preproc.PdePreprocessor;
so that it will be compatible with 1.5.1

void g4p.tool.gui.GuiControl.setSketchSize ( SketchSizeType  sst)

Set the sketch size in the designer window if one is provided

Parameters
sstwidth and height

The documentation for this class was generated from the following file: