diff --git a/Libraries/ads1292r/examples/ads1292rProcessingSketch/ads1292rProcessingSketch.ino b/Libraries/ads1292r/examples/ads1292rProcessingSketch/ads1292rProcessingSketch.ino deleted file mode 100644 index 6d1d7e9..0000000 --- a/Libraries/ads1292r/examples/ads1292rProcessingSketch/ads1292rProcessingSketch.ino +++ /dev/null @@ -1,124 +0,0 @@ -#include -#include - -uint8_t DataPacketHeader[16]; -ads1292r ADS1292; -//Packet format -#define CES_CMDIF_PKT_START_1 0x0A -#define CES_CMDIF_PKT_START_2 0xFA -#define CES_CMDIF_TYPE_DATA 0x02 -#define CES_CMDIF_PKT_STOP 0x0B - -uint8_t data_len = 8; -unsigned long time; - -volatile byte SPI_RX_Buff[15] ; -volatile static int SPI_RX_Buff_Count = 0; -volatile char *SPI_RX_Buff_Ptr; -volatile int Responsebyte = false; -volatile unsigned int pckt =0 , buff=0,t=0 , j1=0,j2=0; -volatile unsigned long int RESP_Ch1_Data[150],ECG_Ch2_Data[150]; -volatile unsigned char datac[150]; -unsigned long uecgtemp = 0,Pkt_Counter=0; -signed long secgtemp=0; -volatile int i; -volatile long packet_counter=0; - - -void setup() -{ - // initalize the data ready and chip select pins: - pinMode(ADS1292_DRDY_PIN, INPUT); //6 - pinMode(ADS1292_CS_PIN, OUTPUT); //7 - pinMode(ADS1292_START_PIN, OUTPUT); //5 - pinMode(ADS1292_PWDN_PIN, OUTPUT); //4 - - Serial.begin(57600); // Baudrate for serial communica - //initalize ADS1292 slave - ADS1292.ads1292_Init(); - //ADS1292.ads1292_Reset(); - - -} - -void loop() -{ - if((digitalRead(ADS1292_DRDY_PIN)) == LOW) - { - SPI_RX_Buff_Ptr = ADS1292.ads1292_Read_Data(); - Responsebyte = true; - //Serial.print("DRDY low: "); - } - - if(Responsebyte == true) - { - /*Serial.print("start Time: "); - time = millis(); - //prints time since program started - Serial.println(time); - */ - for(i = 0; i < 9; i++) - { - SPI_RX_Buff[SPI_RX_Buff_Count++] = *(SPI_RX_Buff_Ptr + i); - } - Responsebyte = false; - } - - if(SPI_RX_Buff_Count >= 9) - { - pckt = 0; j1=0; j2=0; - for(i=3;i<9;i+=9) - { - //udi_cdc_putc(SPI_RX_Buff[i]); - //RESP_Ch1_Data[j1++]= SPI_RX_Buff[i+0]; - //RESP_Ch1_Data[j1++]= SPI_RX_Buff[i+1]; - //RESP_Ch1_Data[j1++]= SPI_RX_Buff[i+2]; - - ECG_Ch2_Data[j2++]= (unsigned char)SPI_RX_Buff[i+3]; - ECG_Ch2_Data[j2++]= (unsigned char)SPI_RX_Buff[i+4]; - ECG_Ch2_Data[j2++]= (unsigned char)SPI_RX_Buff[i+5]; - - RESP_Ch1_Data[j1++]= (unsigned char)SPI_RX_Buff[i+0]; - RESP_Ch1_Data[j1++]= (unsigned char)SPI_RX_Buff[i+1]; - RESP_Ch1_Data[j1++]= (unsigned char)SPI_RX_Buff[i+2]; - } - - packet_counter++; - - uecgtemp = (unsigned long) ((ECG_Ch2_Data[0]<<16)|(ECG_Ch2_Data[1]<<8)|ECG_Ch2_Data[2]); - uecgtemp = (unsigned long) (uecgtemp<<8); - secgtemp = (signed long) (uecgtemp); - secgtemp = (signed long) (secgtemp>>8); - - DataPacketHeader[0] = 0x0A; - DataPacketHeader[1] = 0xFA; - DataPacketHeader[2] = (uint8_t) (data_len); - DataPacketHeader[3] = (uint8_t) (data_len>>8); - DataPacketHeader[4] = 0x02; - - DataPacketHeader[5] = secgtemp; - DataPacketHeader[6] = secgtemp>>8; - DataPacketHeader[7] = secgtemp>>16; - DataPacketHeader[8] = secgtemp>>24; - - uecgtemp = (unsigned long) ((RESP_Ch1_Data[0]<<16)|(RESP_Ch1_Data[1]<<8)|RESP_Ch1_Data[2]); - uecgtemp = (unsigned long) (uecgtemp<<8); - secgtemp = (signed long) (uecgtemp); - secgtemp = (signed long) (secgtemp>>8); - - DataPacketHeader[9] = secgtemp; - DataPacketHeader[10] = secgtemp>>8; - DataPacketHeader[11] = secgtemp>>16; - DataPacketHeader[12] = secgtemp>>24; - - DataPacketHeader[13] = 0x00; - DataPacketHeader[14] = 0x0b; - - for(i=0; i<15; i++) // transmit the data - { - Serial.write(DataPacketHeader[i]); - } - } - - SPI_RX_Buff_Count = 0; -} diff --git a/Libraries/ads1292r/examples/ads_1292r_breakout_brainbay/ads_1292r_breakout_brainbay.ino b/Libraries/ads1292r/examples/ads_1292r_breakout_brainbay/ads_1292r_breakout_brainbay.ino deleted file mode 100644 index 7e58fe0..0000000 --- a/Libraries/ads1292r/examples/ads_1292r_breakout_brainbay/ads_1292r_breakout_brainbay.ino +++ /dev/null @@ -1,169 +0,0 @@ -#include -#include - -ads1292r ADS1292; -//Packet format -#define CES_CMDIF_PKT_START_1 0x0A -#define CES_CMDIF_PKT_START_2 0xFA -#define CES_CMDIF_TYPE_DATA 0x02 -#define CES_CMDIF_PKT_STOP 0x0B - -volatile char DataPacketHeader[5]; -volatile char DataPacketFooter[2]; -volatile int datalen = 135; -unsigned long time; - -volatile byte SPI_RX_Buff[150] ; -volatile static int SPI_RX_Buff_Count = 0; -volatile char *SPI_RX_Buff_Ptr; -volatile int Responsebyte = false; -volatile unsigned int pckt =0 , buff=0,t=0 , j1=0,j2=0; -volatile unsigned long int EEG_Ch1_Data[150],EEG_Ch2_Data[150]; -volatile unsigned char datac[150]; -unsigned long ueegtemp = 0,Pkt_Counter=0; -signed long seegtemp=0; -volatile int i; - -void setup() -{ - // initalize the data ready and chip select pins: - pinMode(ADS1292_DRDY_PIN, INPUT); //6 - pinMode(ADS1292_CS_PIN, OUTPUT); //7 - pinMode(ADS1292_START_PIN, OUTPUT); //5 - pinMode(ADS1292_PWDN_PIN, OUTPUT); //4 - - // Serial.begin(9600); // Baudrate for serial communica - //initalize ADS1292 slave - ADS1292.ads1292_Init(); - //ADS1292.ads1292_Reset(); - - DataPacketHeader[0] = CES_CMDIF_PKT_START_1; - DataPacketHeader[1] = CES_CMDIF_PKT_START_2; - DataPacketHeader[2] = (datalen); - DataPacketHeader[3] = (datalen >> 8); - DataPacketHeader[4] = CES_CMDIF_TYPE_DATA; - - DataPacketFooter[0] = 0x00; - DataPacketFooter[1] = CES_CMDIF_PKT_STOP; -} - -void loop() -{ - if((digitalRead(ADS1292_DRDY_PIN)) == LOW) - { - SPI_RX_Buff_Ptr = ADS1292.ads1292_Read_Data(); - Responsebyte = true; - //Serial.print("DRDY low: "); - } - - if(Responsebyte == true) - { - /*Serial.print("start Time: "); - time = millis(); - //prints time since program started - Serial.println(time); - */ - for(i = 0; i < 9; i++) - { - SPI_RX_Buff[SPI_RX_Buff_Count++] = *(SPI_RX_Buff_Ptr + i); - } - Responsebyte = false; - } - - if(SPI_RX_Buff_Count >= 9) - { - pckt = 0; j1=0; j2=0; - for(i=3;i<9;i+=9) - { - //udi_cdc_putc(SPI_RX_Buff[i]); - //EEG_Ch1_Data[j1++]= SPI_RX_Buff[i+0]; - //EEG_Ch1_Data[j1++]= SPI_RX_Buff[i+1]; - //EEG_Ch1_Data[j1++]= SPI_RX_Buff[i+2]; - - - - EEG_Ch2_Data[j2++]= (unsigned char)SPI_RX_Buff[i+3]; - EEG_Ch2_Data[j2++]= (unsigned char)SPI_RX_Buff[i+4]; - EEG_Ch2_Data[j2++]= (unsigned char)SPI_RX_Buff[i+5]; - - } - //seegtemp = -89485; - - for(t=0; t< 1 ; t++) - { - buff = 0; - Pkt_Counter++; //if(Pkt_Counter > 0) Pkt_Counter = 0x00; - - datac[buff++] = 0xA0; // sync0 - datac[buff++] = 36; //sync1 - - datac[buff++] = (unsigned char)(Pkt_Counter >> 24); - datac[buff++] = (unsigned char)(Pkt_Counter >> 16); - datac[buff++] = (unsigned char)(Pkt_Counter >> 8); - datac[buff++] = (unsigned char)(Pkt_Counter ); - - //EEG_Ch1_Data = 1000; - //Serial.println("Hai"); - /*Serial.print(EEG_Ch2_Data[pckt],HEX); - Serial.print(" "); - Serial.print(EEG_Ch2_Data[pckt+1],HEX); - Serial.print(" "); - Serial.print(EEG_Ch2_Data[pckt+2],HEX); - Serial.print(" "); - */ - - ueegtemp = (unsigned long) ((EEG_Ch2_Data[pckt]<<16)|(EEG_Ch2_Data[pckt+1]<<8)|EEG_Ch2_Data[pckt+2]); - //Serial.print(ueegtemp,HEX); - //Serial.print(" "); - ueegtemp = (unsigned long) (ueegtemp<<8); - seegtemp = (signed long) (ueegtemp); - seegtemp = (signed long) (seegtemp>>8); - - //Serial.println(seegtemp,HEX); - //delay(100); - // seegtemp = 1000; - - pckt+= 3; - - datac[buff++] = (unsigned char) (seegtemp); - datac[buff++] = (unsigned char) (seegtemp>>8); //>>8 - datac[buff++] = ( unsigned char) (seegtemp >> 16); //>>16 - datac[buff++] = (unsigned char) (seegtemp >>24); - - // Serial.print(seegtemp); - - for(i=0;i<28;i++) // fill channel 1 buff - { - //ueegtemp = (uint16_t) ( (EEG_Ch1_Data[pckt+1]<<8)| EEG_Ch1_Data[pckt]); - //seegtemp = (int16_t) (ueegtemp); - //pckt++ - //datac[buff++] = EEG_Ch1_Data[pckt++] ; - datac[buff++] = 0x00 ; - } - - datac[buff++] = 0xc0;//(uint8_t)seegtemp ; - - //Serial.println(seegtemp); - - for(i=0; i<39; i++) // transmit the data - { - Serial.write(datac[i]); - //udi_cdc_putc(datac[i]); - //cpu_delay_us(90, 48000000); - } - // cpu_delay_us(100, 48000000); - } - - SPI_RX_Buff_Count = 0; - /* - Serial.print("Stop Time: "); - time = millis(); - //prints time since program started - Serial.println(time); - */ - } -} - - - - diff --git a/Libraries/ads1292r/examples/ads_1292r_breakout_brainbay_lineanddcfiltered/ads_1292r_breakout_brainbay_lineanddcfiltered.ino b/Libraries/ads1292r/examples/ads_1292r_breakout_brainbay_lineanddcfiltered/ads_1292r_breakout_brainbay_lineanddcfiltered.ino deleted file mode 100644 index 5bc4477..0000000 --- a/Libraries/ads1292r/examples/ads_1292r_breakout_brainbay_lineanddcfiltered/ads_1292r_breakout_brainbay_lineanddcfiltered.ino +++ /dev/null @@ -1,171 +0,0 @@ -#include -#include -#include - -#define FILTERTAPS 5 -#define CES_CMDIF_PKT_START_1 0x0A -#define CES_CMDIF_PKT_START_2 0xFA -#define CES_CMDIF_TYPE_DATA 0x02 -#define CES_CMDIF_PKT_STOP 0x0B - -ads1292r ADS1292; -FIR fir; - -volatile char DataPacketHeader[5]; -volatile char DataPacketFooter[2]; -volatile int datalen = 135; -unsigned long time; - -volatile byte SPI_RX_Buff[150] ; -volatile static int SPI_RX_Buff_Count = 0; -volatile char *SPI_RX_Buff_Ptr; -volatile int Responsebyte = false; -volatile unsigned int pckt =0 , buff=0,t=0 , j1=0,j2=0; - volatile unsigned long int EEG_Ch1_Data[150],EEG_Ch2_Data[150]; -volatile unsigned char datac[150]; -unsigned long ueegtemp = 0,Pkt_Counter=0; -signed long seegtemp=0; - volatile int i; - float feegtemp ,output; - -void setup() { - - // initalize the data ready and chip select pins: - pinMode(ADS1292_DRDY_PIN, INPUT); //6 - pinMode(ADS1292_CS_PIN, OUTPUT); //7 - pinMode(ADS1292_START_PIN, OUTPUT); //5 - pinMode(ADS1292_PWDN_PIN, OUTPUT); //4 - - //initalize ADS1292 slave - ADS1292.ads1292_Init(); - //ADS1292.ads1292_Reset(); - - DataPacketHeader[0] = CES_CMDIF_PKT_START_1; - DataPacketHeader[1] = CES_CMDIF_PKT_START_2; - DataPacketHeader[2] = (datalen); - DataPacketHeader[3] = (datalen >> 8); - DataPacketHeader[4] = CES_CMDIF_TYPE_DATA; - - DataPacketFooter[0] = 0x00; - DataPacketFooter[1] = CES_CMDIF_PKT_STOP; - - // declare variables for coefficients - // these should be calculated by hand, or using a tool - // in case a phase linear filter is required, the coefficients are symmetric - // for time optimization it seems best to enter symmetric values like below - float coef[FILTERTAPS] = { 0.021, 0.096, 0.146, 0.096, 0.021}; - fir.setCoefficients(coef); - - //declare gain coefficient to scale the output back to normal - float gain = 1; // set to 1 and input unity to see what this needs to be - fir.setGain(gain); -} - -void loop() { - - - ReadAdc(); - -} - -float Filter(float fInput) { - static float fLast = 0.0f; - int a = -1; - float fResult = fInput+a*fLast; - fLast = fInput; - return 0.5*fResult; - } - -void ReadAdc() -{ - if((digitalRead(ADS1292_DRDY_PIN)) == LOW) - { - SPI_RX_Buff_Ptr = ADS1292.ads1292_Read_Data(); - Responsebyte = true; - - } - - if(Responsebyte == true) - { - for(i = 0; i < 9; i++) - { - SPI_RX_Buff[SPI_RX_Buff_Count++] = *(SPI_RX_Buff_Ptr + i); - } - Responsebyte = false; - } - - if(SPI_RX_Buff_Count >= 9) - { - - - pckt = 0; j1=0; j2=0; - for(i=3;i<9;i+=9) - { - - EEG_Ch2_Data[j2++]= (unsigned char)SPI_RX_Buff[i+3]; - EEG_Ch2_Data[j2++]= (unsigned char)SPI_RX_Buff[i+4]; - EEG_Ch2_Data[j2++]= (unsigned char)SPI_RX_Buff[i+5]; - - } - - for(t=0; t< 1 ; t++) - { - buff = 0; - Pkt_Counter++; //if(Pkt_Counter > 0) Pkt_Counter = 0x00; - - datac[buff++] = 0xA0; // sync0 - datac[buff++] = 36; //sync1 - - datac[buff++] = (unsigned char)(Pkt_Counter >> 24); - datac[buff++] = (unsigned char)(Pkt_Counter >> 16); - datac[buff++] = (unsigned char)(Pkt_Counter >> 8); - datac[buff++] = (unsigned char)(Pkt_Counter ); - - ueegtemp = (unsigned long) ((EEG_Ch2_Data[pckt]<<16)|(EEG_Ch2_Data[pckt+1]<<8)|EEG_Ch2_Data[pckt+2]); - - - ueegtemp = (unsigned long) (ueegtemp<<8); - seegtemp = (signed long) (ueegtemp); - seegtemp = (signed long) (seegtemp>>8); - //feegtemp = (float)((seegtemp)* 2.23517E-05 ); - feegtemp = (float)((seegtemp*50)); - - output = fir.process(feegtemp); - //output = Filter(output); - //seegtemp = (signed long)((output)/ 2.23517E05 ); - seegtemp = (signed long)((output)); - //seegtemp = abs(seegtemp); - - pckt+= 3; - - datac[buff++] = (unsigned char) (seegtemp); - datac[buff++] = (unsigned char) (seegtemp>>8); //>>8 - datac[buff++] = ( unsigned char) (seegtemp >> 16); //>>16 - datac[buff++] = (unsigned char) (seegtemp >>24); - - // Serial.print(seegtemp); - - for(i=0;i<28;i++) // fill channel 1 buff - { - datac[buff++] = 0x00 ; - } - - datac[buff++] = 0xc0;//(uint8_t)seegtemp ; - - - for(i=0; i<39; i++) // transmit the data - { - - Serial.write(datac[i]); - - } - - } - - SPI_RX_Buff_Count = 0; - - - } - - -} diff --git a/Libraries/firfilter/FIR.cpp b/Libraries/firfilter/FIR.cpp deleted file mode 100644 index cf20073..0000000 --- a/Libraries/firfilter/FIR.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "FIR.h" - -FIR::FIR() { - k = 0; //initialize so that we start to read at index 0 - for (int i=0; i -#define FILTERTAPS 5 -FIR fir; - -void setup() { - - Serial.begin(115200); // open the serial port, I like them fast ;-) - - // declare variables for coefficients - // these should be calculated by hand, or using a tool - // in case a phase linear filter is required, the coefficients are symmetric - // for time optimization it seems best to enter symmetric values like below - float coef[FILTERTAPS] = { 0.021, 0.096, 0.146, 0.096, 0.021}; - fir.setCoefficients(coef); - - //declare gain coefficient to scale the output back to normal - float gain = 0.38; // set to 1 and input unity to see what this needs to be - fir.setGain(gain); -} - -void loop() { - - // declare input and output variables - float input = 1; // without a real input, looking at the step respons (input at unity, 1) would be nice to see - float output = 0; // output as a 0, but that doesn't really matter - - // This is the loop that takes care of calling the FIR filter for some samples - - for (byte n = 0; n < FILTERTAPS + 2; n++) { // If you like to see the step response, take at least as many cycles as the length of your FIR filter (FILTERTAPS + 1 or 2) - Serial.print("n= "); // print the sample number - Serial.println(n, DEC); - Serial.println("Now calling fir..."); - output = fir.process(input); // here we call the fir routine with the input. The value 'fir' spits out is stored in the output variable. - Serial.print("fir presented the following value= "); - Serial.println(output); // just for debugging or to understand what it does, print the output value - } - - while (true) {}; // endless loop -} \ No newline at end of file diff --git a/Processing/ces_view_ecg/BPM.pde b/Processing/ces_view_ecg/BPM.pde deleted file mode 100644 index 3d0393f..0000000 --- a/Processing/ces_view_ecg/BPM.pde +++ /dev/null @@ -1,78 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////// -// -// BPM: -// - This Class calculates the Heart Rate According to the ecg data received -// -// Created : Balasundari, May 2016 -// -///////////////////////////////////////////////////////////////////////////////////////// - -class BPM -{ - - float min, max; // Stores Minimum and Maximum Value - double threshold; // Stores the threshold - float minimizedVolt[] = new float[pSize]; // Stores the absoulte values in the buffer - int beats = 0, bpm = 0; // Variables to store the no.of peaks and bpm - - //////////////////////////////////////////////////////////////////////////////////////////// - // - Heart Value is calculated by: - // * Setting a threshold value which is between the minimum and maximum value - // * Calculating no.of peaks crossing, the threshold value. - // * Calculate the Heart rate with the no.of peaks achieved with the no.of seconds - // - //////////////////////////////////////////////////////////////////////////////////////////// - - void bpmCalc(float[] recVoltage) - { - - int j = 0, n = 0, cntr = 0; - - // Making the array into absolute (positive values only) - - for (int i=0; i threshold) // ECG threshold crossed - { - beats++; - n = n+30; // skipping the some samples to avoid repeatation - } else - n++; - } - bpm = (beats*60)/8; - - bpm1.setText(bpm+""); // Calculated BPM is displayed - beats = 0; - } else - { - bpm1.setText("0"); - } - } - } -}; \ No newline at end of file diff --git a/Processing/ces_view_ecg/GUI_BUILDER_DATA/gui.ser.4.2 b/Processing/ces_view_ecg/GUI_BUILDER_DATA/gui.ser.4.2 deleted file mode 100644 index 2e3eeb7..0000000 Binary files a/Processing/ces_view_ecg/GUI_BUILDER_DATA/gui.ser.4.2 and /dev/null differ diff --git a/Processing/ces_view_ecg/Graph.pde b/Processing/ces_view_ecg/Graph.pde deleted file mode 100644 index 2fb9564..0000000 --- a/Processing/ces_view_ecg/Graph.pde +++ /dev/null @@ -1,67 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////// -// -// Graph Class -// - Draw Axes Lines -// - Set the Limits for each axes -// - Function to plot the current pressure value -// -// Created : Balasundari, May 2016 -// -// -///////////////////////////////////////////////////////////////////////////////////////// - -class Graph -{ - int xDiv=5, yDiv=5; // Number of sub divisions - int xPos, yPos; // location of the top left corner of the graph - int Width, Height; // Width and height of the graph - color GraphColor; // Color for the trace - float yMax=1024, yMin=0; // Default axis dimensions - float xMax=10, xMin=0; - PFont Font; // Selected font used for text - - /******************** The main declaration function ************************************/ - - Graph(int x, int y, int w, int h) { - xPos = x; - yPos = y; - Width = w; - Height = h; - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // - // The LineGraph() is called repeatedly by the main draw function - // This module trace the graph with the buffer values passed from the main function - // Functions: - // - stroke(int color) : Sets the color used to draw lines and borders around shapes. - // - strokeWeight(int value) : Sets the width of the stroke used for lines, points, and the border around shapes. - // - smooth() : Draws all geometry with smooth (anti-aliased) edges. - // - line(x1,y1,x2,y2) : Draws a line (a direct path between two points) to the screen. The two points are taken from the parameter. - // - rect(x,y,w,h) : Draws a rectangle to the screen in the position specified in the parameters. - // - fill(int color) : Sets the color used to fill shapes - // - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - void LineGraph(float[] x, float[] y) { - - for (int i=0; i<(x.length-1); i++) - { - smooth(); - strokeWeight(3); - stroke(GraphColor); - // x & y points to draw line - line( - xPos+(x[i]-x[0])/(x[x.length-1]-x[0])*Width, - yPos+(Height)-(y[i]/(yMax-yMin)*Height)+(yMin)/(yMax-yMin)*Height, - xPos+(x[i+1]-x[0])/(x[x.length-1]-x[0])*Width, - yPos+(Height)-(y[i+1]/(yMax-yMin)*Height)+(yMin)/(yMax-yMin)*Height - ); - } - - stroke(0); - fill(0); - // Rectangle is drawn to differentiate previous line and current line - rect(xPos-22+((time-2)-x[0])/(x[x.length-1]-x[0])*Width, 0, 50, height); - } -} \ No newline at end of file diff --git a/Processing/ces_view_ecg/HeaderButton.pde b/Processing/ces_view_ecg/HeaderButton.pde deleted file mode 100644 index 9700d0e..0000000 --- a/Processing/ces_view_ecg/HeaderButton.pde +++ /dev/null @@ -1,51 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// HeadWidgets -// - This class differentiate the header from the whole application -// -// Created: Balasundari, May 2016 -// -////////////////////////////////////////////////////////////////////////////// - -class HeaderButton { - - public float x, y, w, h; - int padding = 5; - - //////////////////////////////////////////////////////////////////////////////// - // - // This Constructor gets the co-ordinate points likes x, y, width and height - // The values are passed from the setup function in the main class - // and it is set in this constructor - // - /////////////////////////////////////////////////////////////////////////////// - - HeaderButton(float _xPos, float _yPos, float _width, float _height) { - x = _xPos; - y = _yPos; - w = _width; - h = _height; - } - - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // - // This draw method is called repeatedly by the main draw function - // This function creates a rectangle which shows the differentiation like a Header. - // InBuilt Functions: - // - fill(int color) : Sets the color used to fill shapes - // - rect(x,y,w,h) : Draws a rectangle to the screen in the position specified in the parameters. - // - noStroke() : Disables drawing the stroke (outline) - // - pushStyle() : Saves the current style settings - // - popStyle() : Restores the prior settings - // - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - public void draw() { - - pushStyle(); - noStroke(); - fill(0, 102, 204); - rect(x, y, width, h); - popStyle(); - } -}; \ No newline at end of file diff --git a/Processing/ces_view_ecg/HelpWidget.pde b/Processing/ces_view_ecg/HelpWidget.pde deleted file mode 100644 index bebdb99..0000000 --- a/Processing/ces_view_ecg/HelpWidget.pde +++ /dev/null @@ -1,67 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// HelpWidget -// - This class differentiate the footer from the whole application -// - Shows the status and threshold values of the alarm -// -// Created : Balasundari, May 2016 -// -////////////////////////////////////////////////////////////////////////////// - -class HelpWidget { - - public float x, y, w, h; // location of the top left corner of the widget with width and height - String currentOutput = "Click Start button"; // current text shown in help widget, based on most recent command - int padding = 5; // Constant value to fix the position of the Label - - //////////////////////////////////////////////////////////////////////////////// - // - // This Constructor gets the co-ordinate points likes x, y, width and height - // The values are passed from the setup function in the main class - // and it is set in this constructor - // - /////////////////////////////////////////////////////////////////////////////// - - - HelpWidget(float _xPos, float _yPos, float _width, float _height) { - x = _xPos; - y = _yPos; - w = _width; - h = _height; - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // - // This draw method is called repeatedly by the main draw function - // This function creates a rectangle which shows the differentiation like a Footer. - // Functions: - // - text(string txt,x,y) : Draws text to the screen. - // Displays the information specified in the first parameter on the screen in the position specified by the additional parameters - // - textSize(int size) : Sets the current font size - // - fill(int color) : Sets the color used to fill shapes - // - rect(x,y,w,h) : Draws a rectangle to the screen in the position specified in the parameters. - // - stroke(int color) : Sets the color used to draw lines and borders around shapes. - // - strokeWeight(int value) : Sets the width of the stroke used for lines, points, and the border around shapes. - // - noStroke() : Disables drawing the stroke (outline) - // - pushStyle() : Saves the current style settings - // - popStyle() : Restores the prior settings - // - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - public void draw() { - - pushStyle(); - noStroke(); - fill(0, 102, 204); - rect(x, height-h, width, h); - strokeWeight(1); - stroke(color(0, 5, 11)); - fill(color(0, 5, 11)); - rect(x + padding, height-h + padding, width - padding*23, h - padding *2); - textSize(14); - fill(255); - textAlign(LEFT, TOP); - text(currentOutput, padding*2, height - h + padding + 4); - popStyle(); - } -}; \ No newline at end of file diff --git a/Processing/ces_view_ecg/data/logo.png b/Processing/ces_view_ecg/data/logo.png deleted file mode 100644 index 9b0acd3..0000000 Binary files a/Processing/ces_view_ecg/data/logo.png and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_CoolSliders/G4P_CoolSliders.pde b/Processing/libraries/G4P/examples/G4P_CoolSliders/G4P_CoolSliders.pde deleted file mode 100644 index 61a7758..0000000 --- a/Processing/libraries/G4P/examples/G4P_CoolSliders/G4P_CoolSliders.pde +++ /dev/null @@ -1,117 +0,0 @@ -/* - The GCustomSlider control replaces the GWSlider, a control - created as part of the Processing library `gwoptics' - http://www.gwoptics.org/processing/gwoptics_p5lib/ - - The GCustomSlider has all the capabilities of the original - control but also has the capabilities of the GSlider in that - it can be rotated to any angle and user controllable text - orientation. - - This sketch simply demonstrates some of the features and - skins available with this library. - - To try out different configurations trye the example - G4P_CustomSlider_Config. - - for Processing V2 and V3 - (c) 2015 Peter Lager - - */ - -import g4p_controls.*; - -GCustomSlider sdr1, sdr2, sdr3, sdr4, sdr5, sdr6, sdr7; - -void setup() { - size(600, 280); - - //============================================================= - // Simple default slider, - // constructor is `Parent applet', the x, y position and length - sdr1 = new GCustomSlider(this, 20, 20, 260, 50, null); - // show opaque ticks value limits - sdr1.setShowDecor(false, true, true, true); - sdr1.setNbrTicks(5); - sdr1.setLimits(40, -100, 100); - //============================================================= - // Slider with a custom skin, check the data folder to find - // the `blue18px' folder which stores the used image files. - sdr2 = new GCustomSlider(this, 20, 80, 260, 50, "blue18px"); - // show opaque ticks value limits - sdr2.setShowDecor(false, true, false, true); - // there are 3 types - // GCustomSlider.DECIMAL e.g. 0.002 - // GCustomSlider.EXPONENT e.g. 2E-3 - // GCustomSlider.INTEGER - sdr2.setNumberFormat(G4P.DECIMAL, 3); - sdr2.setLimits(0.5f, 0f, 1.0f); - sdr2.setShowValue(false); - - //============================================================= - // Slider with another custom skin - sdr3 = new GCustomSlider(this, 20, 140, 260, 50, "red_yellow18px"); - // show opaque ticks value limits - sdr3.setShowDecor(false, true, false, true); - sdr3.setEasing(25); - - //============================================================= - // Slider with another custom skin - sdr4 = new GCustomSlider(this, 20, 200, 260, 50, "purple18px"); - // show opaque ticks value limits - sdr4.setShowDecor(false, true, true, true); - sdr4.setNbrTicks(6); - sdr4.setStickToTicks(true); - sdr4.setEasing(20); - - //============================================================= - // Standard slider with labels switched off - sdr5 = new GCustomSlider(this, 320, 20, 260, 80, null); - // show opaque ticks value limits - sdr5.setShowDecor(false, true, false, false); - sdr5.setNumberFormat(GCustomSlider.DECIMAL, 2); - sdr5.setLimits(0.5f, 0f, 1.0f); - sdr5.setNbrTicks(6); - sdr5.setStickToTicks(true); //false by default - // `Stick to ticks' enforces that the handle can only rest - // at a tick position. - - //============================================================= - // This example shows small float numbers used and settings - // the accuracy of the display labels - sdr6 = new GCustomSlider(this, 320, 80, 260, 80, null); - // show opaque ticks value limits - sdr6.setShowDecor(false, true, true, true); - sdr6.setNumberFormat(G4P.EXPONENT, 1); - sdr6.setLimits(3E-2f, 2.0E-2f, 3.5E-2f); - sdr6.setNbrTicks(16); - sdr6.setEasing(15); - sdr6.setStickToTicks(true); - - //============================================================= - // We can also add custom labels to ticks - // Note: - // setTickLabels() changes the number of ticks previously - // set with setTickCount() to match the - // number of labels in the array. - // setTickCount() cancels labels that were previously set - // with setTickLabels() - String[] tickLabels = new String[] { - "A", "B", "C", "D", "E" - }; - sdr7 = new GCustomSlider(this, 320, 160, 260, 70, "green_red20px"); - // show opaque ticks value limits - sdr7.setShowDecor(false, true, false, false); - sdr7.setTickLabels(tickLabels); - // notice that we are setting a value that is not - // exactly a tick when `stick to tick' is true, - // setValue will stick to nearest tick value -} - -void draw() { - background(200, 200, 255); -} - -void handleSliderEvents(GSlider slider) { - println("integer value:" + slider.getValueI() + " float value:" + slider.getValueF()); -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_CustomSlider_Config/G4P_CustomSlider_Config.pde b/Processing/libraries/G4P/examples/G4P_CustomSlider_Config/G4P_CustomSlider_Config.pde deleted file mode 100644 index 39322d3..0000000 --- a/Processing/libraries/G4P/examples/G4P_CustomSlider_Config/G4P_CustomSlider_Config.pde +++ /dev/null @@ -1,110 +0,0 @@ -/* - This program demonstrates the various configuration options - available for the custom slider control (GCustomSlider). - - The only thing not set is the range limits. By default the - slider returns values in the range 0.0 to 1.0 inclusive. - Use setLimits() to set your own range. - - for Processing V2 and V3 - (c) 2015 Peter Lager - - */ - -import g4p_controls.*; - -GCustomSlider sdr; -int bgcol = 128; - -public void setup() { - size(500, 360); - G4P.setCursor(CROSS); - sdr = new GCustomSlider(this, 55, 70, 200, 120, "blue18px"); - makeSliderConfigControls(); -} - -public void draw() { - background(bgcol); - fill(227, 230, 255); - noStroke(); - rect(width - 190, 0, 200, height); - rect(0, height - 84, width - 190, 84); -} - -public void handleSliderEvents(GValueControl slider, GEvent event) { - if (slider == sdr) // The slider being configured? - println(sdr.getValueS() + " " + event); - if (slider == sdrEasing) - sdr.setEasing(slider.getValueF()); - else if (slider == sdrNbrTicks) - sdr.setNbrTicks(slider.getValueI()); - else if (slider == sdrBack) - bgcol = slider.getValueI(); -} - -public void handleKnobEvents(GValueControl knob, GEvent event) { - if (knbAngle == knob) - this.sdr.setRotation(knbAngle.getValueF(), GControlMode.CENTER); -} - -public void handleButtonEvents(GButton button, GEvent event) { - if (button.tagNo >= 1000) - sdr.setLocalColorScheme(button.tagNo - 1000); - else if (btnMakeCode == button) - placeCodeOnClipboard(); -} - -public void handleToggleControlEvents(GToggleControl option, GEvent event) { - if (option == optLeft) - sdr.setTextOrientation(G4P.ORIENT_LEFT); - else if (option == optRight) - sdr.setTextOrientation(G4P.ORIENT_RIGHT); - else if (option == optTrack) - sdr.setTextOrientation(G4P.ORIENT_TRACK); - else if (option == cbxOpaque) - sdr.setOpaque(option.isSelected()); - else if (option == cbxValue) - sdr.setShowValue(option.isSelected()); - else if (option == cbxShowTicks) - sdr.setShowTicks(option.isSelected()); - else if (option == cbxLimits) - sdr.setShowLimits(option.isSelected()); - else if (option == cbxSticky) - sdr.setStickToTicks(option.isSelected()); -} - -public void handleDropListEvents(GDropList list, GEvent event) { - if (list == dplStyle) - sdr.setStyle(dplStyle.getSelectedText()); -} - - -private void placeCodeOnClipboard() { - StringBuilder s = new StringBuilder(); - s.append("// Generated by the GKnob example program\n\n"); - s.append("import g4p_controls.*;\n\n"); - s.append("GCustomSlider sdr; \n\n"); - s.append("void setup() { \n"); - s.append(" size(300, 300); \n"); - s.append(" sdr = new GCustomSlider(this, 55, 70, 200, 120, \"" + dplStyle.getSelectedText() + "\"); \n"); - s.append(" // Some of the following statements are not actually\n"); - s.append(" // required because they are setting the default value. \n"); - s.append(" sdr.setLocalColorScheme(" + sdr.getLocalColorScheme() + "); \n"); - s.append(" sdr.setOpaque(" + sdr.isOpaque() + "); \n"); - s.append(" sdr.setValue(" + sdr.getValueF() + "); \n"); - s.append(" sdr.setNbrTicks(" + sdr.getNbrTicks() + "); \n"); - s.append(" sdr.setShowLimits(" + sdr.isShowLimits() + "); \n"); - s.append(" sdr.setShowValue(" + sdr.isShowValue() + "); \n"); - s.append(" sdr.setShowTicks(" + sdr.isShowTicks() + "); \n"); - s.append(" sdr.setStickToTicks(" + sdr.isStickToTicks() + "); \n"); - s.append(" sdr.setEasing(" + sdr.getEasing() + "); \n"); - s.append(" sdr.setRotation(" + knbAngle.getValueF() + ", PApplet.CENTER); \n"); - s.append("} \n\n"); - s.append("void draw(){ \n"); - s.append(" background(" + bgcol + "); \n"); - s.append("} \n"); - if (GClip.copy(s.toString())) - println("Paste code into empty Processing sketch"); - else - System.err.println("UNABLE TO ACCESS CLIPBOARD"); -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_CustomSlider_Config/configcontrols.pde b/Processing/libraries/G4P/examples/G4P_CustomSlider_Config/configcontrols.pde deleted file mode 100644 index 601be74..0000000 --- a/Processing/libraries/G4P/examples/G4P_CustomSlider_Config/configcontrols.pde +++ /dev/null @@ -1,95 +0,0 @@ -// The code in this tab is used to create all the other -// controls needed to configure the slider control. - -GToggleGroup tg = new GToggleGroup(); -GOption optLeft, optRight, optTrack; -GCheckbox cbxOpaque, cbxShowTicks, cbxValue, cbxLimits, cbxSticky; -GSlider sdrBack, sdrNbrTicks, sdrEasing; -GLabel lblOrient, lblVisible, lblNbrTicks, lblEasing, lblSkin; -GKnob knbAngle; -GButton btnMakeCode; -GButton[] btnColours = new GButton[8]; -GDropList dplStyle; - -public void makeSliderConfigControls() { - // Create colour scheme selectors - int x = width - 42, y = 2; - for (int i = 0; i < btnColours.length; i++) { - btnColours[i] = new GButton(this, x, y + i * 20, 40, 18, "" + (i+1)); - btnColours[i].tag = "Button: " + (i+1); - btnColours[i].setLocalColorScheme(i); - btnColours[i].tagNo = 1000+i; - } - // Create sliders - x = width-100; - y = 162; - bgcol = 200; - sdrBack = new GSlider(this, x, y, 162, 80, 12); - sdrBack.setLimits(bgcol, 0, 255); - sdrBack.setRotation(-PI/2); - sdrBack.setTextOrientation(G4P.ORIENT_RIGHT); - sdrBack.setEasing(20); - sdrBack.setShowValue(true); - sdrBack.setShowTicks(true); - - x = width - 180; - y = 250; - - sdrEasing = new GSlider(this, x, y + 34, 80, 40, 12); - sdrEasing.setLimits(1.0f, 1.0f, 30.0f); - sdrEasing.setShowValue(true); - lblEasing = new GLabel(this, x + 82, y + 34, 80, 40, "Easing"); - lblEasing.setTextAlign(GAlign.LEFT, null); - lblEasing.setTextItalic(); - - sdrNbrTicks = new GSlider(this, x, y + 68, 80, 40, 12); - sdrNbrTicks.setLimits(2, 2, 15); - sdrNbrTicks.setShowValue(true); - lblNbrTicks = new GLabel(this, x + 82, y + 68, 80, 40, "No. of ticks"); - lblNbrTicks.setTextAlign(GAlign.LEFT, null); - lblNbrTicks.setTextItalic(); - - x = width - 180; - y = 164; - lblOrient = new GLabel(this, x, y, 80, 18, "Orient Text"); - lblOrient.setTextAlign(GAlign.LEFT, null); - lblOrient.setTextBold(); - optLeft = new GOption(this, x, y + 20, 80, 18, "Left"); - optRight = new GOption(this, x, y + 40, 80, 18, "Right"); - optTrack = new GOption(this, x, y + 60, 80, 18, "Track"); - tg.addControls(optLeft, optRight, optTrack); - optTrack.setSelected(true); - - x = width - 94; - y = 164; - lblSkin = new GLabel(this, x, y, 80, 18, "Skin"); - lblSkin.setTextBold(); - String[] items = new String[] { - "blue18px", "green_red20px", "grey_blue", "purple18px", "red_yellow18px" - }; - dplStyle = new GDropList(this, x, y + 20, 90, 96, 5); - dplStyle.setItems(items, 0); - - - x = width - 180; - y = 2; - lblVisible = new GLabel(this, x, y, 70, 18, "Visible"); - lblVisible.setTextBold(); - cbxShowTicks = new GCheckbox(this, x, y + 20, 70, 18, "Ticks"); - cbxLimits = new GCheckbox(this, x, y + 40, 70, 18, "Limits"); - cbxValue = new GCheckbox(this, x, y + 60, 70, 18, "Value"); - cbxOpaque = new GCheckbox(this, x, y + 80, 70, 18, "Opaque"); - cbxSticky = new GCheckbox(this, x, y + 110, 70, 40, "Stick to ticks"); - - x = 10; - y = height - 80; - knbAngle = new GKnob(this, x, y, 70, 70, 0.6f); - knbAngle.setTurnRange(0, 360); - knbAngle.setLimits(0.0f, 0.0f, TWO_PI); - knbAngle.setTurnMode(G4P.CTRL_ANGULAR); - knbAngle.setIncludeOverBezel(true); - knbAngle.setNbrTicks(13); - knbAngle.setStickToTicks(true); - - btnMakeCode = new GButton(this, x + 100, y + 20, 182, 38, "Place code for existing configuration on clipboard"); -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_Dialogs/G4P_Dialogs.pde b/Processing/libraries/G4P/examples/G4P_Dialogs/G4P_Dialogs.pde deleted file mode 100644 index 299772a..0000000 --- a/Processing/libraries/G4P/examples/G4P_Dialogs/G4P_Dialogs.pde +++ /dev/null @@ -1,367 +0,0 @@ -/* - Simple sketch to experiment with the different dialogs - available to you in the G4P library. - - The file diaologs will not work in an applet hosted on - a website unless you digitally sign the jars. - - The file dialogs match the behaviour of those in Processing - V1.5.1 i.e. immediate mode rather than on a seperate thread - as in V2 and V3 - - for Processing V2 and V3 - (c) 2015 Peter Lager - - */ - -import java.awt.Rectangle; -import java.util.ArrayList; - -import g4p_controls.*; - -public void setup() { - size(660, 420); - rects = new ArrayList (); - createFileSystemGUI(340, 220, 300, 130, 6); - createOptionDialogGUI(20, 20, 440, 184, 6); - createMessageDialogGUI(20, 220, 300, 184, 6); - createColorChooserGUI(480, 20, 160, 60, 6); -} - -public void draw() { - background(200, 200, 255); - for (Rectangle r : rects) - showFrame(r); -} - -public void handleButtonEvents(GButton button, GEvent event) { - // Folder selection - if (button == btnFolder || button == btnInput || button == btnOutput) - handleFileDialog(button); - else if (button == btnMdialog) - handleMessageDialog(); - // Option dialog - else if (button == btnOdialog) - handleOptionDialog(); - // Color chooser - else if (button == btnColor) - handleColorChooser(); -} - -// G4P code for folder and file dialogs -public void handleFileDialog(GButton button) { - String fname; - // Folder selection - if (button == btnFolder) { - fname = G4P.selectFolder("Folder Dialog"); - lblFile.setText(fname); - } - // File input selection - else if (button == btnInput) { - // Use file filter if possible - fname = G4P.selectInput("Input Dialog", "png,gif,jpg,jpeg", "Image files"); - lblFile.setText(fname); - } - // File output selection - else if (button == btnOutput) { - fname = G4P.selectOutput("Output Dialog"); - lblFile.setText(fname); - } -} - -// G4P code for message dialogs -public void handleMessageDialog() { - // Determine message type - int mtype; - switch(md_mtype) { - default: - case 0: - mtype = G4P.PLAIN; - break; - case 1: - mtype = G4P.ERROR; - break; - case 2: - mtype = G4P.INFO; - break; - case 3: - mtype = G4P.WARNING; - break; - case 4: - mtype = G4P.QUERY; - break; - } - String message = txfSMMessage.getText(); - String title = txfMdTitle.getText(); - G4P.showMessage(this, message, title, mtype); -} - -// G4P code for option dialogs -public void handleOptionDialog() { - // Determine message type - int mtype, otype; - switch(od_mtype) { - default: - case 0: - mtype = G4P.PLAIN; - break; - case 1: - mtype = G4P.ERROR; - break; - case 2: - mtype = G4P.INFO; - break; - case 3: - mtype = G4P.WARNING; - break; - case 4: - mtype = G4P.QUERY; - break; - } - // Determine the option type - switch(od_otype) { - default: - case 0: - otype = G4P.YES_NO; - break; - case 1: - otype = G4P.YES_NO_CANCEL; - break; - case 2: - otype = G4P.OK_CANCEL; - break; - } - String message = txfOdMessage.getText(); - String title = txfOdTitle.getText(); - int reply = G4P.selectOption(this, message, title, mtype, otype); - switch(reply) { - case G4P.OK: - lblReply.setText("OK / YES"); - break; - case G4P.NO: - lblReply.setText("NO"); - break; - case G4P.CANCEL: - lblReply.setText("CANCEL"); - break; - case G4P.CLOSED: - lblReply.setText("CLOSED"); - break; - } - /* - * Some comments on the returned value: - * G4P.OK and G4P.YES have the same integer value so can - * be used interchangeably. - * G4P.CLOSED maybe returned if the dialog box is closed - * although on some systems G4P.NO or G4P.CANCEL may be - * returned instead. - * It is safer to tested for a positive response because - * they have the same value. If you must test for a negative - * response use !G4P.OK or !G4P.YES - */ -} - -// G4P code for colour chooser -public void handleColorChooser() { - sel_col = G4P.selectColor(); - pg.beginDraw(); - pg.background(sel_col); - pg.endDraw(); -} - -// Handles events from checkbox and option controls. -public void handleToggleControlEvents(GToggleControl checkbox, GEvent event) { - if (checkbox.tagNo >= 6000 ) { - switch(checkbox.tagNo / 1000) { - case 6: - od_mtype = checkbox.tagNo % 6000; - break; - case 7: - od_otype = checkbox.tagNo % 7000; - break; - case 9: - md_mtype = checkbox.tagNo % 9000; - break; - } - } -} - -// Simple graphical frame to group controls -public void showFrame(Rectangle r) { - noFill(); - strokeWeight(1); - stroke(color(240, 240, 255)); - rect(r.x, r.y, r.width, r.height); - stroke(color(0)); - rect(r.x+1, r.y+1, r.width, r.height); -} - -// The next 4 methods are simply to create the GUI. So there is -// no more code related to the various dialogs. -public void createColorChooserGUI(int x, int y, int w, int h, int border) { - // Store picture frame - rects.add(new Rectangle(x, y, w, h)); - // Set inner frame position - x += border; - y += border; - w -= 2*border; - h -= 2*border; - GLabel title = new GLabel(this, x, y, w, 20); - title.setText("Color picker dialog", GAlign.LEFT, GAlign.MIDDLE); - title.setOpaque(true); - title.setTextBold(); - btnColor = new GButton(this, x, y+26, 80, 20, "Choose"); - sel_col = color(255); - pg = createGraphics(60, 20, JAVA2D); - pg.beginDraw(); - pg.background(sel_col); - pg.endDraw(); - spad = new GSketchPad(this, x+88, y+26, pg.width, pg.height); - spad.setGraphic(pg); -} - -public void createMessageDialogGUI(int x, int y, int w, int h, int border) { - // Store picture frame - rects.add(new Rectangle(x, y, w, h)); - // Set inner frame position - x += border; - y += border; - w -= 2*border; - h -= 2*border; - GLabel title = new GLabel(this, x, y, w, 20); - title.setText("Message dialogs", GAlign.LEFT, GAlign.MIDDLE); - title.setOpaque(true); - title.setTextBold(); - btnMdialog = new GButton(this, x, y+26, 80, 20, "Show"); - String[] t = new String[] { - "Plain", "Error", "Information", "Warning", "Question" - }; - opgMmessType = new GToggleGroup(); - optMmessType = new GOption[t.length]; - for (int i = 0; i < optMmessType.length; i++) { - optMmessType[i] = new GOption(this, x, y+60+i*18, 94, 18); - optMmessType[i].setText(t[i]); - optMmessType[i].tagNo = 9000 + i; - opgMmessType.addControl(optMmessType[i]); - } - md_mtype = 0; - optMmessType[md_mtype].setSelected(true); - GLabel dtitle = new GLabel(this, x+w-190, y+20, 190, 20); - dtitle.setText("Dialog title", GAlign.LEFT, GAlign.MIDDLE); - txfMdTitle = new GTextField(this, x+w-190, y+40, 190, 20); - txfMdTitle.setPromptText("Enter dialog title"); - GLabel dmess = new GLabel(this, x+w-190, y+60, 190, 20); - dmess.setText("Dialog message", GAlign.LEFT, GAlign.MIDDLE); - txfSMMessage = new GTextArea(this, x+w-193, y+75, 196, 100); - txfSMMessage.setOpaque(false); - txfSMMessage.setPromptText("Enter dialog message"); -} - -public void createOptionDialogGUI(int x, int y, int w, int h, int border) { - // Store picture frame - rects.add(new Rectangle(x, y, w, h)); - // Set inner frame position - x += border; - y += border; - w -= 2*border; - h -= 2*border; - GLabel title = new GLabel(this, x, y, w, 20); - title.setText("Option dialogs", GAlign.LEFT, GAlign.MIDDLE); - title.setOpaque(true); - title.setTextBold(); - btnOdialog = new GButton(this, x, y+26, 80, 20, "Show"); - String[] t = new String[] { - "Plain", "Error", "Information", "Warning", "Question" - }; - opgOmessType = new GToggleGroup(); - optOmessType = new GOption[t.length]; - for (int i = 0; i < optOmessType.length; i++) { - optOmessType[i] = new GOption(this, x, y+60+i*18, 94, 18); - optOmessType[i].setText(t[i]); - optOmessType[i].tagNo = 6000 + i; - opgOmessType.addControl(optOmessType[i]); - } - od_mtype = 0; - optOmessType[md_mtype].setSelected(true); - t = new String[] { - "Yes / No", "Yes / No / Cancel", "Ok / Cancel" - }; - opgOoptType = new GToggleGroup(); - optOoptType = new GOption[t.length]; - for (int i = 0; i < optOoptType.length; i++) { - optOoptType[i] = new GOption(this, x+104, y+60+i*18, 140, 18); - optOoptType[i].setText(t[i]); - optOoptType[i].tagNo = 7000 + i; - opgOoptType.addControl(optOoptType[i]); - } - od_otype = 0; - optOoptType[md_mtype].setSelected(true); - lblReply = new GLabel(this, x+104, y+26, 120, 20); - lblReply.setLocalColorScheme(G4P.GREEN_SCHEME); - lblReply.setOpaque(true); - lblReply.setTextAlign(GAlign.CENTER, GAlign.MIDDLE); - GLabel dtitle = new GLabel(this, x+w-190, y+20, 190, 20); - dtitle.setText("Dialog title", GAlign.LEFT, GAlign.MIDDLE); - txfOdTitle = new GTextField(this, x+w-190, y+40, 190, 20); - txfOdTitle.setPromptText("Enter dialog title"); - GLabel dmess = new GLabel(this, x+w-190, y+60, 190, 20); - dmess.setText("Dialog message", GAlign.LEFT, GAlign.MIDDLE); - txfOdMessage = new GTextArea(this, x+w-193, y+75, 196, 100); - txfOdMessage.setOpaque(false); - txfOdMessage.setPromptText("Enter dialog message"); -} - -public void createFileSystemGUI(int x, int y, int w, int h, int border) { - // Store picture frame - rects.add(new Rectangle(x, y, w, h)); - // Set inner frame position - x += border; - y += border; - w -= 2*border; - h -= 2*border; - GLabel title = new GLabel(this, x, y, w, 20); - title.setText("File system dialogs", GAlign.LEFT, GAlign.MIDDLE); - title.setOpaque(true); - title.setTextBold(); - // Create buttons - int bgap = 8; - int bw = round((w - 2 * bgap) / 3.0f); - int bs = bgap + bw; - btnFolder = new GButton(this, x, y+30, bw, 20, "Folder"); - btnInput = new GButton(this, x+bs, y+30, bw, 20, "Input"); - btnOutput = new GButton(this, x+2*bs, y+30, bw, 20, "Output"); - lblFile = new GLabel(this, x, y+60, w, 60); - lblFile.setTextAlign(GAlign.LEFT, GAlign.MIDDLE); - lblFile.setOpaque(true); - lblFile.setLocalColorScheme(G4P.GREEN_SCHEME); -} - -// Controls used for file dialog GUI -GButton btnFolder, btnInput, btnOutput; -GLabel lblFile; - -// Controls used for message dialog GUI -GButton btnMdialog; -GOption[] optMmessType; -GToggleGroup opgMmessType; -GTextField txfMdTitle; -GTextArea txfSMMessage; -int md_mtype; - -// Controls used for option dialog GUI -GButton btnOdialog; -GOption[] optOmessType, optOoptType; -GToggleGroup opgOmessType, opgOoptType; -GTextField txfOdTitle; -GTextArea txfOdMessage; -GLabel lblReply; -int od_mtype, od_otype; - -// Controls used for colour chooser dialog GUI -GButton btnColor; -GSketchPad spad; -PGraphics pg; -int sel_col = -1; - -// Graphic frames used to group controls -ArrayList rects ; diff --git a/Processing/libraries/G4P/examples/G4P_EditTextControls/G4P_EditTextControls.pde b/Processing/libraries/G4P/examples/G4P_EditTextControls/G4P_EditTextControls.pde deleted file mode 100644 index 9e4c3d2..0000000 --- a/Processing/libraries/G4P/examples/G4P_EditTextControls/G4P_EditTextControls.pde +++ /dev/null @@ -1,112 +0,0 @@ -/* - This sketch is to demonstrate some features of the GPassword, - GTextField and GTextArea controls. - - These features include - - Tabbing between controls - - Hidden text in password control between controls - - Default text - - Copy and paste text - - for Processing V2 and V3 - (c) 2015 Peter Lager - - */ - -import g4p_controls.*; - -GTextField txf1, txf2; -GTextArea txa1, txa2; -GPassword pwd1; -GTabManager tt; -GLabel lblPwd; - -public void setup() { - size(500, 300); - G4P.setGlobalColorScheme(GCScheme.PURPLE_SCHEME); - // Some start text - String[] paragraphs = loadStrings("book3.txt"); - String startTextA = PApplet.join(paragraphs, '\n'); - String startTextF = "G4P is a GUI control library created by Peter Lager"; - - txf1 = new GTextField(this, 10, 10, 200, 20); - txf1.tag = "txf1"; - txf1.setPromptText("Text field 1"); - - txf2 = new GTextField(this, 290, 10, 200, 30, G4P.SCROLLBARS_HORIZONTAL_ONLY); - txf2.tag = "txf2"; - txf2.setPromptText("Text field 2"); - txf2.setText(startTextF); - - pwd1 = new GPassword(this, 10, 70, 200, 20); - pwd1.tag = "pwd1"; - // Change the maximum word length from the default value of 10 - pwd1.setMaxWordLength(20); - - lblPwd = new GLabel(this, 10, pwd1.getY()-20, 200, 18); - lblPwd.setAlpha(190); - lblPwd.setTextAlign(GAlign.LEFT, null); - lblPwd.setOpaque(true); - - txa1 = new GTextArea(this, 10, 120, 200, 160); - txa1.tag = "txa1"; - txa1.setPromptText("Text area 1"); - - txa2 = new GTextArea(this, 290, 100, 200, 180, G4P.SCROLLBARS_BOTH); - txa2.tag = "txa2"; - txa2.setPromptText("Text area 2"); - txa2.setText(startTextA, 300); - - txf1.setFocus(true); - // Create the tab manager and add these controls to it - tt = new GTabManager(); - tt.addControls(txf1, pwd1, txa1, txf2, txa2); -} - -public void draw() { - background(200, 128, 200); - // Draw tab order - stroke(0); - strokeWeight(2); - line(txf1.getCX()/2, txf1.getCY(), txa1.getCX()/2, lblPwd.getY()); - line(txf1.getCX()/2, pwd1.getCY(), txa1.getCX()/2, txa1.getCY()); - - line(txa1.getCX(), txa1.getCY(), txf2.getCX(), txf2.getCY()); - line(txf2.getCX(), txf2.getCY(), txa2.getCX(), txa2.getCY()); - if(pwd1.getPassword().length() == 0) - lblPwd.setText("Enter password below"); - else - lblPwd.setText(pwd1.getPassword()); -} - -public void displayEvent(String name, GEvent event) { - String extra = " event fired at " + millis() / 1000.0 + "s"; - print(name + " "); - switch(event) { - case CHANGED: - println("CHANGED " + extra); - break; - case SELECTION_CHANGED: - println("SELECTION_CHANGED " + extra); - break; - case LOST_FOCUS: - println("LOST_FOCUS " + extra); - break; - case GETS_FOCUS: - println("GETS_FOCUS " + extra); - break; - case ENTERED: - println("ENTERED " + extra); - break; - default: - println("UNKNOWN " + extra); - } -} - -public void handleTextEvents(GEditableTextControl textControl, GEvent event) { - displayEvent(textControl.tag, event); -} - -public void handlePasswordEvents(GPassword pwordControl, GEvent event) { - displayEvent(pwordControl.tag, event); -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_EditTextControls/data/book3.txt b/Processing/libraries/G4P/examples/G4P_EditTextControls/data/book3.txt deleted file mode 100644 index 3d343d3..0000000 --- a/Processing/libraries/G4P/examples/G4P_EditTextControls/data/book3.txt +++ /dev/null @@ -1,3 +0,0 @@ -Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. -Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. -It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like) \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_GroupControls/G4P_GroupControls.pde b/Processing/libraries/G4P/examples/G4P_GroupControls/G4P_GroupControls.pde deleted file mode 100644 index 4250f99..0000000 --- a/Processing/libraries/G4P/examples/G4P_GroupControls/G4P_GroupControls.pde +++ /dev/null @@ -1,120 +0,0 @@ -/* - This sketch demonstrates how to use the GGroup control - to make a collection of controls that can be manipulated - as a single entity. - - There is support for - enabling/disabling controls - making theme visible/invisible - fading in / out (make fully opaque / fully transparent) - fade to a particular opacity, - - for Processing V3 - (c) 2015 Peter Lager - - */ - -import g4p_controls.*; - -GGroup grpMain, grpWin, grpSelected; - -int groupID = 1; -int delay = 0, duration = 1000, alpha = 255; -int col = 0; - -public void setup() { - size(480, 320, JAVA2D); - createGUI(); - // Create the groups and add controls - grpSelected = grpMain = new GGroup(this); - grpWin = new GGroup(window); - grpMain.addControls(grp1_a, grp1_b, grp1_c, grp1_d); - grpMain.addControls(grp1_e, grp1_f, grp1_g); - grpWin.addControls(grp2_a, grp2_b, grp2_c, grp2_d, grp2_e); -} - -public void draw() { - background(213, 245, 213); - stroke(0); - strokeWeight(2); - fill(200, 210, 200); - rect(width - 220, 10, 210, height - 20); - lblDurationLeft.setText("" + grpSelected.timeLeftFading()); -} - -// ######## Event handlers for action group controls - -// Select group 1 -public void optGroup1Select(GOption source, GEvent event) { - grpSelected = grpMain; -} - -// Select group 2 -public void optGroup2Select(GOption source, GEvent event) { - grpSelected = grpWin; -} - -// Enable all controls in selected group (if alpha >= 128) -public void btnEnableClick(GButton source, GEvent event) { - grpSelected.setEnabled(delay, true); -} - -// Disable all controls in selected group -public void btnDisableClick(GButton source, GEvent event) { - grpSelected.setEnabled(delay, false); -} - -// Make all controls in selected group visible -// (opacity depends on last used alpha value) -public void btnVisibleClick(GButton source, GEvent event) { - grpSelected.setVisible(delay, true); -} - -// Make all controls in selected group invisible -public void btnInvisibleClick(GButton source, GEvent event) { - grpSelected.setVisible(delay, false); -} - -// Fade in to max opacity -public void btnFadeInClick(GButton source, GEvent event) { - grpSelected.fadeIn(delay, duration); -} - -// Change the colour sceme used for all controls in selected group -public void btnColorClick(GButton source, GEvent event) { - grpSelected.setLocalColorScheme(delay, col); -} - -// Fade in to min opacity (fully transparent) -public void btnFadeOutClick(GButton source, GEvent event) { - grpSelected.fadeOut(delay, duration); -} - -// Fade to current alpha value -public void btnFadeToClick(GButton source, GEvent event) { - grpSelected.fadeTo(delay, duration, alpha); -} - -// Update delay value -public void sdrDelayChange(GSlider source, GEvent event) { - delay = source.getValueI(); - lblDelay.setText("" + delay); -} - -// Update fade duration value -public void sdrDurationChange(GSlider source, GEvent event) { - duration = source.getValueI(); - lblDuration.setText("" + duration); -} - -// Update the alpha value to be used -public void sdrAlphaChange(GSlider source, GEvent event) { - alpha = source.getValueI(); - if (alpha > 255) alpha = 255; - lblAlpha.setText("" + alpha); -} - -// Pick one of the 8 predefined colour schemes -public void drpColorSelect(GDropList source, GEvent event) { - col = source.getSelectedIndex(); -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_GroupControls/data/ghost2.png b/Processing/libraries/G4P/examples/G4P_GroupControls/data/ghost2.png deleted file mode 100644 index b3efec2..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_GroupControls/data/ghost2.png and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_GroupControls/data/list_493061 b/Processing/libraries/G4P/examples/G4P_GroupControls/data/list_493061 deleted file mode 100644 index 02e61b2..0000000 --- a/Processing/libraries/G4P/examples/G4P_GroupControls/data/list_493061 +++ /dev/null @@ -1,9 +0,0 @@ -Red -Green -Yellow -Purple -Orange -Cyan -Blue -Gold - diff --git a/Processing/libraries/G4P/examples/G4P_GroupControls/data/list_679847 b/Processing/libraries/G4P/examples/G4P_GroupControls/data/list_679847 deleted file mode 100644 index 63cf5ad..0000000 --- a/Processing/libraries/G4P/examples/G4P_GroupControls/data/list_679847 +++ /dev/null @@ -1,8 +0,0 @@ -Aardvark -Butterfly -Cat -Donkey -Elephant -Flamingo -Giraffe - diff --git a/Processing/libraries/G4P/examples/G4P_GroupControls/data/tjdown.jpg b/Processing/libraries/G4P/examples/G4P_GroupControls/data/tjdown.jpg deleted file mode 100644 index c0240a2..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_GroupControls/data/tjdown.jpg and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_GroupControls/data/tjmask.png b/Processing/libraries/G4P/examples/G4P_GroupControls/data/tjmask.png deleted file mode 100644 index 2b127d8..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_GroupControls/data/tjmask.png and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_GroupControls/data/tjoff.jpg b/Processing/libraries/G4P/examples/G4P_GroupControls/data/tjoff.jpg deleted file mode 100644 index dca694d..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_GroupControls/data/tjoff.jpg and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_GroupControls/data/tjover.jpg b/Processing/libraries/G4P/examples/G4P_GroupControls/data/tjover.jpg deleted file mode 100644 index 39b7493..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_GroupControls/data/tjover.jpg and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_GroupControls/gui.pde b/Processing/libraries/G4P/examples/G4P_GroupControls/gui.pde deleted file mode 100644 index 514df57..0000000 --- a/Processing/libraries/G4P/examples/G4P_GroupControls/gui.pde +++ /dev/null @@ -1,215 +0,0 @@ -// Action controls -GLabel lblDelay, lblDuration, LblPromptDur, lblDurationLeft; -GLabel lblAlpha, lblGroup1Controls, lblActionControls, lblPromptDelay; -GButton btnFadeIn, btnFadeOut, btnEnable, btnDisable, btnInvisible; -GButton btnVisible, btnColor, btnFadeTo; -GDropList drpColor; -GSlider sdrDelay, sdrDuration, sdrAlpha; -GToggleGroup togGroupSelect; -GOption optPickGroup1, optPickGroup2; - -// Group 1 controls -GToggleGroup togG1Options; -GOption grp1_a, grp1_b, grp1_c; -GDropList grp1_d; -GKnob grp1_e; -GButton grp1_f; -GCustomSlider grp1_g; - -// Group 2 controls -GWindow window; -GLabel lblGroup2Controls; -GImageToggleButton grp2_a; -GButton grp2_b; -GPanel grp2_c; -GTextArea grp2_textArea; -GLabel grp2_d; -GImageButton grp2_e; - -synchronized public void drawWin(PApplet appc, GWinData data) { //_CODE_:window:378292: - appc.background(213, 213, 245); - appc.stroke(0); - appc.strokeWeight(2); - appc.fill(200, 200, 210); - appc.rect(10, 10, appc.width-20, appc.height-20); -} //_CODE_:window:378292: - - -// Create all the GUI controls. -public void createGUI() { - G4P.messagesEnabled(false); - G4P.setGlobalColorScheme(GCScheme.BLUE_SCHEME); - G4P.setCursor(ARROW); - surface.setTitle("Test Group Actions in G4P"); - createGroup1Controls(); - createGroup2Controls(); - createGroupActionControls(); -} - -public void createGroup1Controls() { - togG1Options = new GToggleGroup(); - grp1_a = new GOption(this, 270, 50, 120, 20); - grp1_a.setTextAlign(GAlign.LEFT, GAlign.MIDDLE); - grp1_a.setText("option text"); - grp1_b = new GOption(this, 270, 70, 120, 20); - grp1_b.setTextAlign(GAlign.LEFT, GAlign.MIDDLE); - grp1_b.setText("option text"); - - grp1_c = new GOption(this, 270, 90, 120, 20); - grp1_c.setTextAlign(GAlign.LEFT, GAlign.MIDDLE); - grp1_c.setText("option text"); - togG1Options.addControl(grp1_a); - grp1_a.setSelected(true); - togG1Options.addControl(grp1_b); - togG1Options.addControl(grp1_c); - grp1_d = new GDropList(this, 270, 120, 120, 110, 5); - grp1_d.setItems(loadStrings("list_679847"), 0); - grp1_g = new GCustomSlider(this, 460, 50, 250, 50, "grey_blue"); - grp1_g.setRotation(PI/2, GControlMode.CORNER); - grp1_g.setLimits(0.5, 0.0, 1.0); - grp1_g.setNbrTicks(20); - grp1_g.setShowTicks(true); - grp1_g.setEasing(6.0); - grp1_g.setNumberFormat(G4P.DECIMAL, 2); - grp1_e = new GKnob(this, 270, 150, 120, 110, 0.8); - grp1_e.setTurnRange(110, 70); - grp1_e.setTurnMode(GKnob.CTRL_HORIZONTAL); - grp1_e.setSensitivity(1); - grp1_e.setShowArcOnly(false); - grp1_e.setOverArcOnly(false); - grp1_e.setIncludeOverBezel(false); - grp1_e.setShowTrack(true); - grp1_e.setLimits(0.5, 0.0, 1.0); - grp1_e.setShowTicks(true); - grp1_f = new GButton(this, 270, 270, 120, 30); - grp1_f.setText("Go For It !"); -} - -public void createGroup2Controls() { - window = GWindow.getWindow(this, "Window created by G4P", 0, 0, 480, 230, JAVA2D); - window.addDrawHandler(this, "drawWin"); - grp2_a = new GImageToggleButton(window, 20, 50); - String[] imgs = new String[] { - "data/tjoff.jpg", "data/tjover.jpg", "data/tjdown.jpg" - }; - grp2_e = new GImageButton(window, 250, 50, imgs, "data/tjmask.png"); - grp2_c = new GPanel(window, 70, 50, 174, 80, "Tab bar text"); - grp2_c.setText("Tab bar text"); - grp2_textArea = new GTextArea(window, 4, 23, 164, 50, G4P.SCROLLBARS_NONE); - grp2_textArea.setPromptText("Why not enter some text?"); - grp2_c.addControl(grp2_textArea); - grp2_d = new GLabel(window, 70, 140, 170, 61); - grp2_d.setIcon("ghost2.png", 1, GAlign.RIGHT, GAlign.MIDDLE); - grp2_d.setText("Casperov"); - grp2_d.setTextBold(); - grp2_b = new GButton(window, 20, 110, 40, 90); - grp2_b.setText("OK!"); - lblGroup2Controls = new GLabel(window, 20, 20, 440, 20); - lblGroup2Controls.setText("GROUP 2 CONTROLS"); - lblGroup2Controls.setTextBold(); -} - -public void createGroupActionControls() { - lblGroup1Controls = new GLabel(this, 270, 20, 190, 20); - lblGroup1Controls.setText("GROUP 1 CONTROLS"); - lblGroup1Controls.setTextBold(); - togGroupSelect = new GToggleGroup(); - optPickGroup1 = new GOption(this, 160, 20, 30, 20); - optPickGroup1.setTextAlign(GAlign.LEFT, GAlign.MIDDLE); - optPickGroup1.setText("1"); - optPickGroup1.setLocalColorScheme(GCScheme.GREEN_SCHEME); - optPickGroup1.addEventHandler(this, "optGroup1Select"); - optPickGroup2 = new GOption(this, 190, 20, 30, 20); - optPickGroup2.setTextAlign(GAlign.LEFT, GAlign.MIDDLE); - optPickGroup2.setText("2"); - optPickGroup2.setLocalColorScheme(GCScheme.GREEN_SCHEME); - optPickGroup2.addEventHandler(this, "optGroup2Select"); - togGroupSelect.addControl(optPickGroup1); - optPickGroup1.setSelected(true); - togGroupSelect.addControl(optPickGroup2); - lblActionControls = new GLabel(this, 40, 20, 120, 20); - lblActionControls.setTextAlign(GAlign.LEFT, GAlign.MIDDLE); - lblActionControls.setText("Action for Group -"); - lblActionControls.setTextBold(); - lblActionControls.setLocalColorScheme(GCScheme.GREEN_SCHEME); - lblPromptDelay = new GLabel(this, 10, 50, 110, 20); - lblPromptDelay.setText("Delay (ms)"); - lblPromptDelay.setLocalColorScheme(GCScheme.GREEN_SCHEME); - sdrDelay = new GSlider(this, 10, 70, 230, 20, 10.0); - sdrDelay.setLimits(1, 0, 5000); - sdrDelay.setNbrTicks(26); - sdrDelay.setStickToTicks(true); - sdrDelay.setShowTicks(true); - sdrDelay.setEasing(5.0); - sdrDelay.setNumberFormat(G4P.INTEGER, 0); - sdrDelay.setLocalColorScheme(GCScheme.GREEN_SCHEME); - sdrDelay.addEventHandler(this, "sdrDelayChange"); - lblDelay = new GLabel(this, 130, 50, 50, 20); - lblDelay.setText("0"); - lblDelay.setLocalColorScheme(GCScheme.GREEN_SCHEME); - btnFadeIn = new GButton(this, 10, 240, 110, 20); - btnFadeIn.setText("Fade In"); - btnFadeIn.setLocalColorScheme(GCScheme.GREEN_SCHEME); - btnFadeIn.addEventHandler(this, "btnFadeInClick"); - btnFadeOut = new GButton(this, 130, 240, 110, 20); - btnFadeOut.setText("Fade Out"); - btnFadeOut.setLocalColorScheme(GCScheme.GREEN_SCHEME); - btnFadeOut.addEventHandler(this, "btnFadeOutClick"); - btnEnable = new GButton(this, 10, 100, 110, 20); - btnEnable.setText("Enable"); - btnEnable.setLocalColorScheme(GCScheme.GREEN_SCHEME); - btnEnable.addEventHandler(this, "btnEnableClick"); - btnDisable = new GButton(this, 130, 100, 110, 20); - btnDisable.setText("Disable"); - btnDisable.setLocalColorScheme(GCScheme.GREEN_SCHEME); - btnDisable.addEventHandler(this, "btnDisableClick"); - btnInvisible = new GButton(this, 130, 130, 110, 20); - btnInvisible.setText("Visible - false"); - btnInvisible.setLocalColorScheme(GCScheme.GREEN_SCHEME); - btnInvisible.addEventHandler(this, "btnInvisibleClick"); - btnVisible = new GButton(this, 10, 130, 110, 20); - btnVisible.setText("Visible - true"); - btnVisible.setLocalColorScheme(GCScheme.GREEN_SCHEME); - btnVisible.addEventHandler(this, "btnVisibleClick"); - LblPromptDur = new GLabel(this, 10, 190, 110, 20); - LblPromptDur.setText("Duration (ms)"); - LblPromptDur.setLocalColorScheme(GCScheme.GREEN_SCHEME); - btnColor = new GButton(this, 10, 160, 110, 20); - btnColor.setText("Color Scheme"); - btnColor.setLocalColorScheme(GCScheme.GREEN_SCHEME); - btnColor.addEventHandler(this, "btnColorClick"); - drpColor = new GDropList(this, 130, 160, 110, 80, 3); - drpColor.setItems(loadStrings("list_493061"), 0); - drpColor.setLocalColorScheme(GCScheme.GREEN_SCHEME); - drpColor.addEventHandler(this, "drpColorSelect"); - lblDuration = new GLabel(this, 130, 190, 50, 20); - lblDuration.setText("1000"); - lblDuration.setLocalColorScheme(GCScheme.GREEN_SCHEME); - sdrDuration = new GSlider(this, 10, 210, 230, 20, 10.0); - sdrDuration.setLimits(1000, 0, 5000); - sdrDuration.setNbrTicks(11); - sdrDuration.setStickToTicks(true); - sdrDuration.setShowTicks(true); - sdrDuration.setEasing(5.0); - sdrDuration.setNumberFormat(G4P.INTEGER, 0); - sdrDuration.setLocalColorScheme(GCScheme.GREEN_SCHEME); - sdrDuration.addEventHandler(this, "sdrDurationChange"); - btnFadeTo = new GButton(this, 10, 270, 110, 20); - btnFadeTo.setText("Fade To >"); - btnFadeTo.setLocalColorScheme(GCScheme.GREEN_SCHEME); - btnFadeTo.addEventHandler(this, "btnFadeToClick"); - lblAlpha = new GLabel(this, 130, 270, 50, 20); - lblAlpha.setText("255"); - lblAlpha.setLocalColorScheme(GCScheme.GREEN_SCHEME); - sdrAlpha = new GSlider(this, 10, 290, 230, 20, 10.0); - sdrAlpha.setLimits(255, 0, 256); - sdrAlpha.setNbrTicks(17); - sdrAlpha.setStickToTicks(true); - sdrAlpha.setEasing(5.0); - sdrAlpha.setNumberFormat(G4P.INTEGER, 0); - sdrAlpha.setLocalColorScheme(GCScheme.GREEN_SCHEME); - sdrAlpha.addEventHandler(this, "sdrAlphaChange"); - lblDurationLeft = new GLabel(this, 180, 190, 60, 20); - lblDurationLeft.setText("0"); - lblDurationLeft.setLocalColorScheme(GCScheme.GREEN_SCHEME); -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_ImageButtons/G4P_ImageButtons.pde b/Processing/libraries/G4P/examples/G4P_ImageButtons/G4P_ImageButtons.pde deleted file mode 100644 index 1f2278a..0000000 --- a/Processing/libraries/G4P/examples/G4P_ImageButtons/G4P_ImageButtons.pde +++ /dev/null @@ -1,66 +0,0 @@ -/** - Demonstration of image buttons available in the G4P (GUI for - Processing) library. The button face comes from user supplied - image files. - - for Processing V2 and V3 - (c) 2015 Peter Lager - */ - -import g4p_controls.*; - -GImageButton btnGhost, btnCoins, btnTJ, btnInfo; -GLabel lblOut; -long timer; - -void setup() { - size(580, 220); - cursor(CROSS); - String[] files; - - files = new String[] { - "infooff.png", "infoover.png", "infodown.png" - }; - btnInfo = new GImageButton(this, 20, 14, files, "infomask.png"); - - files = new String[] { - "ghost0.png", "ghost1.png", "ghost2.png" - }; - btnGhost = new GImageButton(this, 40, 90, files); - - files = new String[] { - "tjoff.jpg", "tjover.jpg", "tjdown.jpg" - }; - btnTJ = new GImageButton(this, 150, 10, files, "tjmask.png"); - - files = new String[] { - "coins0.png", "coins1.png", "coins2.png" - }; - btnCoins = new GImageButton(this, 400, 20, files); - - lblOut = new GLabel(this, 10, 190, 560, 20, ""); - lblOut.setTextAlign(GAlign.CENTER, null); - timer = millis() - 5000; -} - -void draw() { - background(220, 220, 255); - // Only display button info for 4 seconds - if (millis() - timer > 4000) { - lblOut.setText("CLICK ON A BUTTON"); - } -} - -// When a button has been clicked give information aout the -// button -void handleButtonEvents(GImageButton button, GEvent event) { - if (button == btnGhost) - lblOut.setText("Ghosts - png images using transparency"); - else if (button == btnCoins) - lblOut.setText("Coins - png images using transparency"); - else if (button == btnTJ) - lblOut.setText("Tom & Jerry - jpg images using png mask"); - else if (button == btnInfo) - lblOut.setText("Info - png images using png mask"); - timer = millis(); -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/coins0.png b/Processing/libraries/G4P/examples/G4P_ImageButtons/data/coins0.png deleted file mode 100644 index ed31c5e..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/coins0.png and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/coins1.png b/Processing/libraries/G4P/examples/G4P_ImageButtons/data/coins1.png deleted file mode 100644 index 4e7b0f9..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/coins1.png and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/coins2.png b/Processing/libraries/G4P/examples/G4P_ImageButtons/data/coins2.png deleted file mode 100644 index c72cdd9..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/coins2.png and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/ghost0.png b/Processing/libraries/G4P/examples/G4P_ImageButtons/data/ghost0.png deleted file mode 100644 index 535f64d..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/ghost0.png and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/ghost1.png b/Processing/libraries/G4P/examples/G4P_ImageButtons/data/ghost1.png deleted file mode 100644 index 9dffa60..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/ghost1.png and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/ghost2.png b/Processing/libraries/G4P/examples/G4P_ImageButtons/data/ghost2.png deleted file mode 100644 index b3efec2..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/ghost2.png and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/infodown.png b/Processing/libraries/G4P/examples/G4P_ImageButtons/data/infodown.png deleted file mode 100644 index d54f417..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/infodown.png and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/infomask.png b/Processing/libraries/G4P/examples/G4P_ImageButtons/data/infomask.png deleted file mode 100644 index 840f27a..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/infomask.png and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/infooff.png b/Processing/libraries/G4P/examples/G4P_ImageButtons/data/infooff.png deleted file mode 100644 index 0a21163..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/infooff.png and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/infoover.png b/Processing/libraries/G4P/examples/G4P_ImageButtons/data/infoover.png deleted file mode 100644 index f0e1313..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/infoover.png and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/tjdown.jpg b/Processing/libraries/G4P/examples/G4P_ImageButtons/data/tjdown.jpg deleted file mode 100644 index c0240a2..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/tjdown.jpg and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/tjmask.png b/Processing/libraries/G4P/examples/G4P_ImageButtons/data/tjmask.png deleted file mode 100644 index 2b127d8..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/tjmask.png and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/tjoff.jpg b/Processing/libraries/G4P/examples/G4P_ImageButtons/data/tjoff.jpg deleted file mode 100644 index dca694d..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/tjoff.jpg and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/tjover.jpg b/Processing/libraries/G4P/examples/G4P_ImageButtons/data/tjover.jpg deleted file mode 100644 index 39b7493..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_ImageButtons/data/tjover.jpg and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_ImgTogButton/G4P_ImgTogButton.pde b/Processing/libraries/G4P/examples/G4P_ImgTogButton/G4P_ImgTogButton.pde deleted file mode 100644 index 154e1c3..0000000 --- a/Processing/libraries/G4P/examples/G4P_ImgTogButton/G4P_ImgTogButton.pde +++ /dev/null @@ -1,66 +0,0 @@ -/* - This program demonstrates how to create image toggle buttons. - - If G4P is unable to create the button using the information - i.e. images then it will create the default two state switch - button. - - for Processing V3 - (c) 2015 Peter Lager - - */ - -import g4p_controls.*; - -GImageToggleButton btnToggle0, btnToggle1, btnToggle2, btnToggle3; -GLabel label1, label2, label3, label4, label5; - -public void setup() { - size(480, 220, JAVA2D); - G4P.setGlobalColorScheme(GCScheme.ORANGE_SCHEME); - G4P.setCursor(ARROW); - // Create image toggle buttons - btnToggle0 = new GImageToggleButton(this, 10, 10); - btnToggle0.tag = "Library default button "; - btnToggle1 = new GImageToggleButton(this, 190, 70, "s2.png", 4, 4); - btnToggle1.tag = "User 16 state button "; - btnToggle2 = new GImageToggleButton(this, 340, 70, "s2.png", "s3.png", 4, 4); - btnToggle2.tag = "User 16 state button with over image "; - btnToggle3 = new GImageToggleButton(this, 10, 90, "bulb.png", 2, 1); - btnToggle3.tag = "Light bulb 2 state button "; - // Create description labels - createLabels(); -} - -public void draw() { - background(250, 225, 200); -} - -// Event handler for image toggle buttons -public void handleToggleButtonEvents(GImageToggleButton button, GEvent event) { - println(button + " State: " + button.getState()); -} - -// Create the labels syaing what-is-what -public void createLabels() { - label1 = new GLabel(this, 60, 10, 110, 50); - label1.setText("Library default 2 state button"); - label1.setTextBold(); - label1.setOpaque(true); - label2 = new GLabel(this, 190, 10, 270, 20); - label2.setText("Smiley 16 state button"); - label2.setTextBold(); - label2.setOpaque(true); - label3 = new GLabel(this, 190, 30, 120, 40); - label3.setText("Off image only"); - label3.setTextBold(); - label3.setOpaque(true); - label4 = new GLabel(this, 340, 30, 120, 40); - label4.setText("With mouse over image"); - label4.setTextBold(); - label4.setOpaque(true); - label5 = new GLabel(this, 60, 170, 100, 40); - label5.setText("User defined 2 state button"); - label5.setTextBold(); - label5.setOpaque(true); -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_ImgTogButton/data/bulb.png b/Processing/libraries/G4P/examples/G4P_ImgTogButton/data/bulb.png deleted file mode 100644 index 75a43c2..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_ImgTogButton/data/bulb.png and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_ImgTogButton/data/s2.png b/Processing/libraries/G4P/examples/G4P_ImgTogButton/data/s2.png deleted file mode 100644 index b96a33e..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_ImgTogButton/data/s2.png and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_ImgTogButton/data/s3.png b/Processing/libraries/G4P/examples/G4P_ImgTogButton/data/s3.png deleted file mode 100644 index f328950..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_ImgTogButton/data/s3.png and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_Knob_Config/G4P_Knob_Config.pde b/Processing/libraries/G4P/examples/G4P_Knob_Config/G4P_Knob_Config.pde deleted file mode 100644 index 3ca3af6..0000000 --- a/Processing/libraries/G4P/examples/G4P_Knob_Config/G4P_Knob_Config.pde +++ /dev/null @@ -1,125 +0,0 @@ -/* - This program demonstrates the various configuration options available - for the knob control (GKnob). - - The only thing not set is the range limits. By default the knob returns - vales in the range 0.0 to 1.0 inclusive. Use setLimits() to set your - own range. - - for Processing V2 and V3 - (c) 2015 Peter Lager - - */ - -import g4p_controls.*; - -GKnob kb; -int bgcol = 128; - -public void setup() { - size(500, 360); - G4P.setCursor(CROSS); - // Create the knob using default settings - kb = new GKnob(this, 60, 60, 180, 180, 0.8f); - // Now make the configuration controls - makeKnobConfigControls(); -} - -public void draw() { - background(bgcol); - fill(227, 230, 255); - noStroke(); - rect(width - 190, 0, 200, height); - rect(0, height - 84, width - 190, 84); -} - -public void handleKnobEvents(GValueControl knob, GEvent event) { - // Has the demo knob turned? - if (kb == knob) - lblValue.setText("" + knob.getValueS()); - // These 2 knobs are part to configure the demo - else if (knbStart == knob || knbEnd == knob) - this.kb.setTurnRange(knbStart.getValueF(), knbEnd.getValueF()); -} - - -public void handleButtonEvents(GButton button, GEvent event) { - if (button.tagNo >= 1000) { - kb.setLocalColorScheme(button.tagNo - 1000); - lblValue.setLocalColorScheme(button.tagNo - 1000); - } else if (btnMakeCode == button) - placeCodeOnClipboard(); -} - -public void handleSliderEvents(GValueControl slider, GEvent event) { - if (slider == sdrSense) - kb.setSensitivity(slider.getValueF()); - else if (slider == sdrSense) - kb.setSensitivity(slider.getValueF()); - else if (slider == sdrEasing) - kb.setEasing(slider.getValueF()); - else if (slider == sdrNbrTicks) - kb.setNbrTicks(slider.getValueI()); - else if (slider == sdrBack) - bgcol = slider.getValueI(); - else if (slider == sdrGripRatio) - kb.setGripAmount(slider.getValueF()); -} - -public void handleToggleControlEvents(GToggleControl option, GEvent event) { - if (option == optAngular) - kb.setTurnMode(G4P.CTRL_ANGULAR); - else if (option == optXdrag) - kb.setTurnMode(G4P.CTRL_HORIZONTAL); - else if (option == optYdrag) - kb.setTurnMode(G4P.CTRL_VERTICAL); - else if (option == cbxOverArc) - kb.setOverArcOnly(option.isSelected()); - else if (option == cbxOverAll) - kb.setIncludeOverBezel(option.isSelected()); - else if (option == cbxOpaque) - kb.setOpaque(option.isSelected()); - else if (option == cbxShowArcOnly) - kb.setShowArcOnly(option.isSelected()); - else if (option == cbxShowTicks) - kb.setShowTicks(option.isSelected()); - else if (option == cbxShowTrack) - kb.setShowTrack(option.isSelected()); - else if (option == cbxSticky) - kb.setStickToTicks(option.isSelected()); -} - - -private void placeCodeOnClipboard() { - StringBuilder s = new StringBuilder(); - s.append("// Generated by the GKnob example program\n\n"); - s.append("import g4p_controls.*;\n\n"); - s.append("GKnob kb; \n\n"); - s.append("void setup() { \n"); - s.append(" size(300, 300); \n"); - s.append(" kb = new GKnob(this, 60, 60, 180, 180, " + sdrGripRatio.getValueF() + "); \n"); - s.append(" // Some of the following statements are not actually\n"); - s.append(" // required because they are setting the default value. \n"); - s.append(" kb.setTurnRange("+knbStart.getValueF()+", " + knbEnd.getValueF() + "); \n"); - s.append(" kb.setLocalColorScheme(" + kb.getLocalColorScheme() + "); \n"); - s.append(" kb.setOpaque(" + kb.isOpaque() + "); \n"); - s.append(" kb.setValue(" + kb.getValueF() + "); \n"); - s.append(" kb.setNbrTicks(" + kb.getNbrTicks() + "); \n"); - s.append(" kb.setShowTicks(" + kb.isShowTicks() + "); \n"); - s.append(" kb.setShowTrack(" + kb.isShowTrack() + "); \n"); - s.append(" kb.setShowArcOnly(" + kb.isShowArcOnly() +"); \n"); - s.append(" kb.setStickToTicks(" + kb.isStickToTicks() + "); \n"); - s.append(" kb.setTurnMode(" + kb.getTurnMode() + "); \n"); - s.append(" kb.setIncludeOverBezel(" + kb.isIncludeOverBezel() + "); \n"); - s.append(" kb.setOverArcOnly(" + kb.isOverArcOnly() + "); \n"); - s.append(" kb.setSensitivity(" + kb.getSensitivity() + "); \n"); - s.append(" kb.setEasing(" + kb.getEasing() + "); \n"); - s.append("} \n\n"); - s.append("void draw(){ \n"); - s.append(" background(" + bgcol + "); \n"); - s.append("} \n"); - if (GClip.copy(s.toString())) - println("Paste code into empty Processing sketch"); - else - System.err.println("UNABLE TO ACCESS CLIPBOARD"); -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_Knob_Config/configcontrols.pde b/Processing/libraries/G4P/examples/G4P_Knob_Config/configcontrols.pde deleted file mode 100644 index 302cf23..0000000 --- a/Processing/libraries/G4P/examples/G4P_Knob_Config/configcontrols.pde +++ /dev/null @@ -1,107 +0,0 @@ -// The code in this tab is used to create all the other -// controls needed to configure the knob control. - -GToggleGroup tg = new GToggleGroup(); -GOption optAngular, optXdrag, optYdrag; -GCheckbox cbxOpaque, cbxOverArc, cbxOverAll; -GCheckbox cbxShowTicks, cbxShowArcOnly, cbxShowTrack; -GCheckbox cbxSticky; -GSlider sdrBack, sdrSense, sdrNbrTicks, sdrEasing, sdrGripRatio; -GLabel lblMC, lblVisible, lblSense, lblNbrTicks; -GLabel lblEasing, lblValue, lblAngles, lblGripAmount; -GKnob knbStart, knbEnd; -GButton btnMakeCode; -GButton[] btnColours = new GButton[8]; - -public void makeKnobConfigControls() { - // Create colour scheme selectors - int x = width - 42, y = 2; - for (int i = 0; i < btnColours.length; i++) { - btnColours[i] = new GButton(this, x, y + i * 20, 40, 18, "" + (i+1)); - btnColours[i].tag = "Button: " + (i+1); - btnColours[i].setLocalColorScheme(i); - btnColours[i].tagNo = 1000+i; - } - // Create sliders - x = width-100; - y = 162; - bgcol = 200; - sdrBack = new GSlider(this, x, y, 162, 80, 12); - sdrBack.setLimits(bgcol, 0, 255); - sdrBack.setRotation(-PI/2); - sdrBack.setTextOrientation(G4P.ORIENT_RIGHT); - sdrBack.setEasing(20); - sdrBack.setShowValue(true); - sdrBack.setShowTicks(true); - - x = width - 180; - y = 250; - sdrSense = new GSlider(this, x, y, 80, 40, 12); - sdrSense.setLimits(1.0f, 0.2f, 5.0f); - sdrSense.setShowValue(true); - lblSense = new GLabel(this, x + 82, y, 100, 40, "XY drag rate"); - lblSense.setTextAlign(GAlign.LEFT, null); - lblSense.setTextItalic(); - - sdrEasing = new GSlider(this, x, y + 34, 80, 40, 12); - sdrEasing.setLimits(1.0f, 1.0f, 30.0f); - sdrEasing.setShowValue(true); - lblEasing = new GLabel(this, x + 82, y + 34, 80, 40, "Easing"); - lblEasing.setTextAlign(GAlign.LEFT, null); - lblEasing.setTextItalic(); - - sdrNbrTicks = new GSlider(this, x, y + 68, 80, 40, 12); - sdrNbrTicks.setLimits(2, 2, 15); - sdrNbrTicks.setShowValue(true); - lblNbrTicks = new GLabel(this, x + 82, y + 68, 80, 40, "No. of ticks"); - lblNbrTicks.setTextAlign(GAlign.LEFT, null); - lblNbrTicks.setTextItalic(); - - x = width - 180; - y = 164; - lblMC = new GLabel(this, x, y, 178, 18, "Knob turning control"); - lblMC.setTextAlign(GAlign.LEFT, null); - lblMC.setTextBold(); - optAngular = new GOption(this, x, y + 20, 80, 18, "Angular"); - optXdrag = new GOption(this, x, y + 40, 80, 18, "X drag"); - optYdrag = new GOption(this, x, y + 60, 80, 18, "Y drag"); - tg.addControls(optAngular, optXdrag, optYdrag); - optXdrag.setSelected(true); - cbxOverArc = new GCheckbox(this, x + 90, y + 20, 90, 18, "Arc only"); - cbxOverAll = new GCheckbox(this, x + 90, y + 40, 90, 18, "Incl. Bezel"); - - x = width - 180; - y = 2; - lblVisible = new GLabel(this, x, y, 70, 18, "Visible"); - lblVisible.setTextBold(); - cbxShowTicks = new GCheckbox(this, x, y + 20, 70, 18, "Ticks"); - cbxShowTicks.setSelected(true); - cbxShowTrack = new GCheckbox(this, x, y + 40, 70, 18, "Track"); - cbxShowTrack.setSelected(true); - cbxShowArcOnly = new GCheckbox(this, x, y + 60, 80, 18, "Arc Only"); - cbxOpaque = new GCheckbox(this, x, y + 80, 70, 18, "Opaque"); - cbxSticky = new GCheckbox(this, x, y + 110, 70, 40, "Stick to ticks"); - - x = (int) (kb.getCX() - 40); - y = (int) (kb.getY() -40); - lblValue = new GLabel(this, x, y, 80, 30); - lblValue.setOpaque(true); - lblValue.setText("" + kb.getValueS()); - - x = 5; - y = height - 80; - knbStart = new GKnob(this, x, y, 50, 50, 1); - knbStart.setTurnRange(0, 360); - knbStart.setLimits(110, 0, 360); - knbStart.setTurnMode(G4P.CTRL_ANGULAR); - knbEnd = new GKnob(this, x + 50, y, 50, 50, 1); - knbEnd.setTurnRange(0, 360); - knbEnd.setLimits(70, 0, 360); - knbEnd.setTurnMode(G4P.CTRL_ANGULAR); - lblAngles = new GLabel(this, 0, y + 55, 110, 20, "Turn Limits"); - sdrGripRatio = new GSlider(this, x + 110, y, 120, 40, 12); - sdrGripRatio.setShowDecor(false, false, true, false); - sdrGripRatio.setValue(0.8f); - lblGripAmount = new GLabel(this, x + 226, y, 80, 40, "Grip Ratio"); - btnMakeCode = new GButton(this, x + 110, y + 36, 182, 38, "Place code for existing configuration on clipboard"); -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_Mandelbrot/G4P_Mandelbrot.pde b/Processing/libraries/G4P/examples/G4P_Mandelbrot/G4P_Mandelbrot.pde deleted file mode 100644 index b55136a..0000000 --- a/Processing/libraries/G4P/examples/G4P_Mandelbrot/G4P_Mandelbrot.pde +++ /dev/null @@ -1,317 +0,0 @@ -/* - The most complicated example so far. This will display the Mandelbrot - set in a separate window. Draw a rectangle over the image to create - a new Mandelbrot in a new window ... - - for Processing V3 - (c) 2015 Peter Lager - - */ - -import g4p_controls.*; -import java.awt.Color; - -final int MAX_ITERATE = 128; - -final int MAX_WIDTH = 400; -final int MAX_HEIGHT = 400; - -final int MIN_WIDTH = 30; -final int MIN_HEIGHT = 30; - -int[] colors = new int[MAX_ITERATE]; - -GButton btnStart; -GLabel label; - -int locX = 100, locY = 100; - -String t0, t1, t2; - - -public void setup() { - size(300, 160); - G4P.setGlobalColorScheme(G4P.ORANGE_SCHEME); - btnStart = new GButton(this, (width - 80)/2, height - 30, 80, 20, "START"); - t0 = "MANDELBROT GALORE\n"; - t1 = "Click on the START button to see the Mandelbrot set in a separate window. "; - t2 = " To zoom into the set drag a box on the area you are interested in and "; - t2 += "he enlarged image will appear in a new window."; - label = new GLabel(this, 20, 20, 260, 200, t0 + t1 + t2); - label.setTextAlign(GAlign.CENTER, GAlign.TOP); - createColours(); -} - -/** - * Draw for the main sketch window - */ -public void draw() { - background(230, 230, 230); -} - -/** - Create the colours to be used. - */ -public void createColours() { - colors[MAX_ITERATE-1] = color(0); - float hue = 0.0f; - float bright = 1.0f; - float binc = 0.009f/MAX_ITERATE; - for (int i = 0; i < MAX_ITERATE - 2; i++) { - colors[i] = Color.HSBtoRGB(hue, 1.0f, bright); - hue = (hue + 0.1309f) % 1.0f ; - bright -= binc; - } -} - -/** - * Create a PImage of the correct size and using the data - * for a window create the Mandelbrot image. Signal when - * complete by setting imgDone = true - * - * @param data - */ -public void calcMandlebrot(MyWinData data) { - double x0, x1, y0, y1, deltaX, deltaY; - double colX, rowY; - x0 = data.sx; - x1 = data.ex; - y0 = data.sy; - y1 = data.ey; - deltaX = (x1 - x0)/data.w; - deltaY = (y1 - y0)/data.h; - data.img.loadPixels(); - int count = 0; - Complex c = new Complex(); - Complex z = new Complex(); - - colX = x0; - rowY = y0; - int minC = 999, maxC = -999; - for (int row = 0; row < data.h; row++) { - colX = x0; - for (int col = 0; col < data.w; col++) { - count = 0; - c.set(colX, rowY); - z.set(colX, rowY); - while (count < MAX_ITERATE-1 && z.sizeSquared () < 4.0) { - z = z.squared().add(c); - count++; - } - if (count < minC) minC = count; - if (count > maxC) maxC = count; - data.img.pixels[col + row * data.w] = colors[count]; - colX += deltaX; - } - rowY += deltaY; - } - data.img.updatePixels(); - data.imgDone = true; -} - -/** - * Create and display a new Frame for a Mandelbrot - * make it as big as possible to fit MAX_WIDTH and MAX_HEIGHT - * but reject if this results in the width or height being less - * than the minimum vales (MIN_WIDTH, MIN_HEIGHT. - * - * @param nsx - * @param nex - * @param nsy - * @param ney - * @return - */ -public boolean makeNewBrotWindow(double nsx, double nex, double nsy, double ney, int action) { - MyWinData mydata = new MyWinData(); - GWindow window = null; - // Using doubles for greater magnification range - double mag = 2.5 / (nex-nsx); - String s = String.format("%.2E", mag); - String title = "Mandelbrot (x "+s+")"; - float ratio = (float) ((nex-nsx)/(ney-nsy)); - if (ratio > MAX_WIDTH/MAX_HEIGHT) { - mydata.w = MAX_WIDTH; - mydata.h = (int)( MAX_HEIGHT / ratio); - } else { - mydata.h = MAX_HEIGHT; - mydata.w = (int)( MAX_WIDTH * ratio); - } - mydata.sx = nsx; - mydata.sy = nsy; - mydata.ex = nex; - mydata.ey = ney; - mydata.imgDone = false; - - if (mydata.w >= MIN_WIDTH && mydata.h >= MIN_HEIGHT) { - mydata.img = new PImage(mydata.w, mydata.h); - window = GWindow.getWindow(this, title, locX, locY, mydata.w, mydata.h, JAVA2D); - // Need to replace with screen.width and screen.height for - // Processing 1.5.1 - locX = (locX + mydata.w + 20)%(displayWidth - MAX_WIDTH); - locY = (locY + 20)%(displayHeight - MAX_HEIGHT); - window.addData(mydata); - window.addDrawHandler(this, "windowDraw"); - window.addMouseHandler(this, "windowMouse"); - window.setActionOnClose(action); - calcMandlebrot(mydata); - return true; - } - return false; -} - - -/** - * Click the button to create the windows. - * @param button - */ -public void handleButtonEvents(GButton button, GEvent event) { - if (btnStart == button) { - makeNewBrotWindow(-2.0f, 0.5f, -1.25f, 1.25f, GWindow.KEEP_OPEN); - btnStart.setVisible(false); - label.setText(t0 + t2); - } -} - -/** - * Handles mouse events for ALL GWindow objects - * - * @param appc the PApplet object embeded into the frame - * @param data the data for the GWindow being used - * @param event the mouse event - */ -public void windowMouse(PApplet appc, GWinData data, MouseEvent event) { - MyWinData d = (MyWinData)data; - if (d.imgDone == false) - return; - switch(event.getAction()) { - case MouseEvent.PRESS: - d.msx = d.mex = appc.mouseX; - d.msy = d.mey = appc.mouseY; - appc.loop(); - appc.frameRate(30); - break; - case MouseEvent.RELEASE: - d.mex = appc.mouseX; - d.mey = appc.mouseY; - // Make sure the coordinates are top left / bottom left - int temp; - if (d.msx > d.mex) { - temp = d.msx; - d.msx = d.mex; - d.mex = temp; - } - if (d.msy > d.mey) { - temp = d.msy; - d.msy = d.mey; - d.mey = temp; - } - // Calculate the new Mandelbrot plane coordinates - double nsx, nex, nsy, ney; - nsx = dmap((double)d.msx, (double)0, (double)d.w, d.sx, d.ex); - nex = dmap((double)d.mex, (double)0, (double)d.w, d.sx, d.ex); - nsy = dmap((double)d.msy, (double)0, (double)d.h, d.sy, d.ey); - ney = dmap((double)d.mey, (double)0, (double)d.h, d.sy, d.ey); - makeNewBrotWindow(nsx, nex, nsy, ney, GWindow.CLOSE_WINDOW); - d.msx = d.mex = d.msy = d.mey = 0; - appc.noLoop(); - break; - case MouseEvent.DRAG: - d.mex = appc.mouseX; - d.mey = appc.mouseY; - break; - } -} - -/** - * Copied from PApplet and converted floats to doubles - * @param value - * @param istart - * @param istop - * @param ostart - * @param ostop - * @return - */ -double dmap(double value, double istart, double istop, double ostart, double ostop) { - return ostart + (ostop - ostart) * ((value - istart) / (istop - istart)); -} - -/** - * Handles drawing to the windows PApplet area - * - * @param appc the PApplet object embeded into the frame - * @param data the data for the GWindow being used - */ -public void windowDraw(PApplet appc, GWinData data) { - MyWinData d = (MyWinData)data; - if (d.imgDone) { - appc.image(d.img, 0, 0); - if (d.msx != d.mex || d.msy != d.mey) { - appc.strokeWeight(2); - appc.stroke(255); - appc.noFill(); - appc.rectMode(CORNERS); - appc.rect(d.msx, d.msy, d.mex, d.mey); - } - } -} - -/** - A basic complex number class. - */ -class Complex { - public double real; - public double img; - - Complex() { - real = img = 0.0f; - } - - public Complex(float r, float i) { - super(); - this.real = r; - this.img = i; - } - - public void set(double colX, double rowY) { - real = colX; - img = rowY; - } - - public Complex add(Complex c) { - real += c.real; - img += c.img; - return this; - } - - public void mult(Complex c) { - double nReal = real * c.real - img * c.img; - double nImg = real * c.img + img * c.real; - real = nReal; - img = nImg; - } - - public Complex squared() { - double nReal = (real - img)*(real + img); - double nImg = 2 * real * img; - real = nReal; - img = nImg; - return this; - } - - public double sizeSquared() { - return real * real + img * img; - } -} - -/** - * Simple class that extends GWinData and holds the data that is specific - * to a particular window. - */ -class MyWinData extends GWinData { - - public int msx, msy, mex, mey; - public double sx, sy, ex, ey; - public int w, h; - public PImage img; - public boolean imgDone; -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_RGBmixer/G4P_RGBmixer.pde b/Processing/libraries/G4P/examples/G4P_RGBmixer/G4P_RGBmixer.pde deleted file mode 100644 index 7c8c147..0000000 --- a/Processing/libraries/G4P/examples/G4P_RGBmixer/G4P_RGBmixer.pde +++ /dev/null @@ -1,76 +0,0 @@ -/** - Demonstration of the GKnob component which is part of - the G4P (GUI for Processing) library. - - Simple program that creates 3 knobs but only shows a third - of each one. They are used to control the RGB balance for - the rectangle fill. - - for Processing V2 and V3 - (c) 2015 Peter Lager - - */ - -import g4p_controls.*; - -GKnob knbRed, knbGreen, knbBlue; -GLabel label; - -int r, g, b; -int kx, ky; - -void setup() { - size(400, 220); - r = g = b = 160; - kx = 20; - ky = 20; - - label = new GLabel(this, 0, height - 26, width, 26, - "Drag mouse in a circular movement around the knobs centre"); - label.setOpaque(true); - label.setLocalColorScheme(G4P.CYAN_SCHEME); - - knbRed = new GKnob(this, kx, ky, 150, 150, 0.8); - knbRed.setTurnRange(150, 270); - knbRed.setTurnMode(G4P.CTRL_ANGULAR); - knbRed.setArcPolicy(true, true, true); - knbRed.setLimits(r, 0, 255); - knbRed.setNbrTicks(9); - knbRed.setLocalColorScheme(G4P.RED_SCHEME); - - knbGreen = new GKnob(this, kx + 8, ky, 150, 150, 0.8); - knbGreen.setTurnRange(270, 30); - knbGreen.setTurnMode(G4P.CTRL_ANGULAR); - knbGreen.setArcPolicy(true, true, true); - knbGreen.setLimits(g, 0, 255); - knbGreen.setNbrTicks(9); - knbGreen.setLocalColorScheme(G4P.GREEN_SCHEME); - - knbBlue = new GKnob(this, kx + 4, ky + 9, 150, 150, 0.8); - knbBlue.setTurnRange(30, 150); - knbBlue.setTurnMode(G4P.CTRL_ANGULAR); - knbBlue.setArcPolicy(true, true, true); - knbBlue.setLimits(b, 0, 255); - knbBlue.setNbrTicks(9); - knbBlue.setLocalColorScheme(G4P.BLUE_SCHEME); - - stroke(0); - strokeWeight(3); - rectMode(CORNERS); -} - -void draw() { - background(220, 220, 255); - // Color sampler - fill(r, g, b); - rect(kx + 190, 40, width - 40, height - 40); -} - -void handleKnobEvents(GValueControl knob, GEvent event) { - if (knob == knbRed) - r = knob.getValueI(); - else if (knob == knbGreen) - g = knob.getValueI(); - else if (knob == knbBlue) - b = knob.getValueI(); -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_Showcase/G4P_Showcase.pde b/Processing/libraries/G4P/examples/G4P_Showcase/G4P_Showcase.pde deleted file mode 100644 index 01c2dc0..0000000 --- a/Processing/libraries/G4P/examples/G4P_Showcase/G4P_Showcase.pde +++ /dev/null @@ -1,164 +0,0 @@ -/** - This example showcases many of the controls available. Click - on the 'G4P config window' button to open the control window - for more options. - - Some of the other examples demonstrate individual controls - in more detail. - - for Processing V3 - (c) 2015 Peter Lager - */ - -import g4p_controls.*; - - -// G4P components for main window -GPanel pnlControls; -GLabel lblAction; -GTextField txfDemo; -GTextArea txaDemo; -GKnob knbDemo; -GTimer tmrTimer; -GButton btnTimer; -GTabManager tt; -GCheckbox cbxSticky; -GButton btnControl; // Used to start controller window -GStick astick; -String startText; -PImage imgBgImage; - -int count = 0; -GLabel lblMC; -GOption optAngular, optYdrag, optXdrag; -GToggleGroup tg; -GSketchPad spad; -PGraphics pg; - -public void setup() { - size(600, 440); - // Load the background image - imgBgImage = loadImage("castle.jpg"); - makeDemoControls(); -} - -public void updateGraphic(int n) { - n = (n < 0) ? 0 : n % 30; - pg.beginDraw(); - pg.background(0); - pg.noStroke(); - pg.fill(255); - pg.ellipseMode(CENTER); - if (n >= 0) { - for (int i = 0; i < n; i++) { - int r = i / 10; - int c = i % 10; - pg.ellipse(5 + c * 10, 7 + r * 15, 6, 10); - } - } - pg.endDraw(); -} - -public void draw() { - background(imgBgImage); - updateGraphic(count); -} - -public void handleTextEvents(GEditableTextControl textcontrol, GEvent event) { - if (textcontrol == txaDemo) - lblAction.setText("TextArea: " + event); - if (textcontrol == txfDemo) - lblAction.setText("TextField: " + event); -} - -public void handlePanelEvents(GPanel panel, GEvent event) { - lblAction.setText("Panel: " + event); - if (event == GEvent.DRAGGED && sdrPanelPos != null) { - sdrPanelPos.setValueX(pnlControls.getX()); - sdrPanelPos.setValueY(pnlControls.getY()); - } -} - -public void handleSliderEvents(GValueControl slider, GEvent event) { - if (slider == sdrAlpha) { - int alpha = sdrAlpha.getValueI(); - if (alpha >= G4P.ALPHA_BLOCK) - slider.setLocalColorScheme(G4P.BLUE_SCHEME); - else - slider.setLocalColorScheme(G4P.RED_SCHEME); - G4P.setWindowAlpha(this, alpha); - } -} - -public void handleToggleControlEvents(GToggleControl option, GEvent event) { - if (option == optAngular) { - lblAction.setText("Knob is now using angular drag for rotation"); - knbDemo.setTurnMode(G4P.CTRL_ANGULAR); - } - if (option == optXdrag) { - lblAction.setText("Knob is now using horizontal drag for rotation"); - knbDemo.setTurnMode(G4P.CTRL_HORIZONTAL); - } - if (option == optYdrag) { - lblAction.setText("Knob is now using vertical drag for rotation"); - knbDemo.setTurnMode(G4P.CTRL_VERTICAL); - } - if (option == cbxSticky) { - lblAction.setText("Stick to ticks option changed"); - knbDemo.setStickToTicks(cbxSticky.isSelected()); - } -} - -public void handleStickEvents(GStick stick, GEvent event) { - String pos = ""; - // 4-way stick so forget 1,3,5 & 7 positions - switch(stick.getPosition()) { - case 0: - pos = "RIGHT"; - break; - case 2: - pos = "DOWN"; - break; - case 4: - pos = "LEFT"; - break; - case 6: - pos = "UP"; - break; - } - lblAction.setText("Stick control is in " + pos + " position"); -} - -public void handleSlider2DEvents(GSlider2D slider2d, GEvent event) { - pnlControls.moveTo(slider2d.getValueXI(), slider2d.getValueYI()); -} - -public void handleKnobEvents(GValueControl knob, GEvent event) { - if (knob == knbDemo) - lblAction.setText("Knob value is now " + knbDemo.getValueS()); - if (knob == knbAngle) { - pnlControls.setRotation(knbAngle.getValueF(), GControlMode.CENTER); - } -} - -public void handleButtonEvents(GButton button, GEvent event) { - // Create the control window? - if (button == btnControl && event == GEvent.CLICKED) { - lblAction.setText("Open control window and disable the button"); - createControlWindow(); - btnControl.setEnabled(false); - } - // Change the colour scheme - if (button.tagNo >= 1000 && event == GEvent.CLICKED) - G4P.setWindowColorScheme(this, button.tagNo - 1000); - if (button == btnTimer && event == GEvent.CLICKED) { - if (tmrTimer.isRunning()) - tmrTimer.stop(); - else - tmrTimer.start(); - } -} - -public void myTimerFunction(GTimer timer) { - count++; -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_Showcase/cinfigwindowcontrols.pde b/Processing/libraries/G4P/examples/G4P_Showcase/cinfigwindowcontrols.pde deleted file mode 100644 index 38bda01..0000000 --- a/Processing/libraries/G4P/examples/G4P_Showcase/cinfigwindowcontrols.pde +++ /dev/null @@ -1,61 +0,0 @@ -// ============================================= -// Create the configuration window and controls -// ============================================= - -GWindow windControl; -GButton[] btnColours = new GButton[8]; -GSlider sdrAlpha; -GKnob knbAngle; -GLabel lblAlpha1, lblAlpha2; -GSlider2D sdrPanelPos; - -public void createControlWindow() { - windControl = GWindow.getWindow(this, "Controls", 600, 400, 400, 300, JAVA2D); - PApplet app = windControl; // save some typing - // Create colour scheme selectors - int x = 8; - int y = 50; // app.height - 24; - for (int i = 0; i < btnColours.length; i++) { - btnColours[i] = new GButton(app, x + i * 34, y, 30, 18, "" + (i+1)); - btnColours[i].tag = "Button: " + (i+1); - btnColours[i].setLocalColorScheme(i); - btnColours[i].tagNo = 1000+i; - } - y = 0; //app.height - 90; - sdrAlpha = new GSlider(app, x, y, 268, 60, 12); - sdrAlpha.setLimits(255, 0, 255); -// sdrAlpha.setRotation(-PI/2); -// sdrAlpha.setTextOrientation(G4P.ORIENT_RIGHT); - sdrAlpha.setEasing(20); - sdrAlpha.setShowValue(true); - sdrAlpha.setShowTicks(true); - - x = 290; - y = 16; - lblAlpha1 = new GLabel(app, x, y, 120, 26, "Alpha Slider"); - lblAlpha1.setTextBold(); - lblAlpha2 = new GLabel(app, x, y + 30, 110, 80, "When alpha falls below " + G4P.ALPHA_BLOCK + " it will disable the controls in the main sketch."); - - x = app.width - 120; - y = app.height - 120; - knbAngle = new GKnob(app, x, y, 100, 100, 0.75f); - knbAngle.setTurnRange(0, 360); - knbAngle.setLimits(0.0f, 0.0f, TWO_PI); - knbAngle.setTurnMode(G4P.CTRL_ANGULAR); - knbAngle.setIncludeOverBezel(true); - knbAngle.setNbrTicks(13); - knbAngle.setStickToTicks(true); - - sdrPanelPos = new GSlider2D(app, 40, 84, 200, 200); - sdrPanelPos.setLimitsX(pnlControls.getX(), 0, 200); - sdrPanelPos.setLimitsY(pnlControls.getY(), 0, 200); - - windControl.addDrawHandler(this, "drawController"); -} - -/* - * The draw handler for the control window - */ -public void drawController(PApplet appc, GWinData data) { - appc.background(227, 230, 255); -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_Showcase/data/book.txt b/Processing/libraries/G4P/examples/G4P_Showcase/data/book.txt deleted file mode 100644 index a5acc27..0000000 --- a/Processing/libraries/G4P/examples/G4P_Showcase/data/book.txt +++ /dev/null @@ -1 +0,0 @@ -Game AI has undergone a quiet revolution in the past few years. No longer is it something that most developers consider only towards the end of a project when shipping deadlines loom and the publisher is pushing to have the game ship before the next holiday milestone. Now game AI is something that is planned for, soemthing that developers are deliberately making as important a part of a game's development as the graphics or the sound effects. The market is rife with games of all kinds and developers are looking for every edge they can get to get the game noticed. \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_Showcase/data/castle.jpg b/Processing/libraries/G4P/examples/G4P_Showcase/data/castle.jpg deleted file mode 100644 index 9d42b35..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_Showcase/data/castle.jpg and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_Showcase/data/time.png b/Processing/libraries/G4P/examples/G4P_Showcase/data/time.png deleted file mode 100644 index a07af7f..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_Showcase/data/time.png and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_Showcase/showcasecontrols.pde b/Processing/libraries/G4P/examples/G4P_Showcase/showcasecontrols.pde deleted file mode 100644 index 6f37af3..0000000 --- a/Processing/libraries/G4P/examples/G4P_Showcase/showcasecontrols.pde +++ /dev/null @@ -1,82 +0,0 @@ -// ============================================ -// Create the showcase controls -// ============================================ - -public void makeDemoControls() { - // Create the panel of this size - int pX = 10, pY = 30, pHeight = 240, pWidth = 400; - pnlControls = new GPanel(this, pX, pY, pWidth, pHeight, "Panel Tab Text (drag to move : click to open/close)"); - pnlControls.setOpaque(true); - pnlControls.setCollapsed(false); - // Create the user action feedback label - lblAction = new GLabel(this, 0, pHeight-20, pWidth, 20, "This is a GLabel control - for status info"); - lblAction.setOpaque(true); - pnlControls.addControl(lblAction); - - //Load some sample text - String[] paragraphs = loadStrings("book.txt"); - startText = PApplet.join(paragraphs, '\n'); - - // Create a text area with both horizontal and - // vertical scrollbars that automatically hide - // when not needed. - txaDemo = new GTextArea(this, 4, 24, 220, 96, G4P.SCROLLBARS_BOTH | G4P.SCROLLBARS_AUTOHIDE); - txaDemo.setText(startText, 250); - txaDemo.setPromptText("Please enter some text"); - pnlControls.addControl(txaDemo); - // Create a text field with horizontal scrollbar - txfDemo = new GTextField(this, 4, 126, 220, 30, G4P.SCROLLBARS_HORIZONTAL_ONLY | G4P.SCROLLBARS_AUTOHIDE); - txfDemo.setPromptText("This is prompt text"); - pnlControls.addControl(txfDemo); - // Add tab controls - tt = new GTabManager(); - tt.addControls(txaDemo, txfDemo); - - // Checkbox - cbxSticky = new GCheckbox(this, 230, 130, 120, 20, "Stick to ticks"); - pnlControls.addControl(cbxSticky); - - // Knob - knbDemo = new GKnob(this, 230, 30, 90, 90, 0.76f); - knbDemo.setLimits(0.0f, 0.0f, TWO_PI); - knbDemo.setNbrTicks(10); - knbDemo.setEasing(5); - knbDemo.setShowArcOnly(true); - knbDemo.setOverArcOnly(true); - knbDemo.setSensitivity(2.0f); - pnlControls.addControl(knbDemo); - - lblMC = new GLabel(this, 310, 22, 100, 50, "Knob turning control"); - lblMC.setTextAlign(GAlign.LEFT, null); - lblMC.setTextAlign(GAlign.CENTER, GAlign.TOP); - lblMC.setTextBold(); - optAngular = new GOption(this, 326, 60, 80, 18, "Angular"); - optXdrag = new GOption(this, 326, 80, 80, 18, "X drag"); - optYdrag = new GOption(this, 326, 100, 80, 18, "Y drag"); - tg = new GToggleGroup(); - tg.addControls(optAngular, optXdrag, optYdrag); - optXdrag.setSelected(true); - pnlControls.addControls(lblMC, optAngular, optXdrag, optYdrag); - - // Create timer button - btnTimer = new GButton(this, pWidth-100, pHeight-60, 100, 40, "Start"); - btnTimer.setIcon("time.png", 1, null, null); - tmrTimer = new GTimer(this, this, "myTimerFunction", 300); - pnlControls.addControl(btnTimer); - // When the timer is on we will see it in a GSketchPad control - // Create the GSkethPad control to position and display the graphic - spad = new GSketchPad(this, pWidth-210, pHeight-60, 100, 40); - // Now create and clear graphic to be used (JAVA parameter - // parameter is only needed for Processing 1.5.1) - pg = createGraphics(100, 46, JAVA2D); - // Add the graphic to the control. - spad.setGraphic(pg); - updateGraphic(3); // Method for drawing the graphic - pnlControls.addControl(spad); - // 4-way stick control - astick = new GStick(this, pWidth - 290, pHeight - 80, 60, 60); - pnlControls.addControl(astick); - // Create button to open the control window - btnControl = new GButton(this, 2, pHeight - 60, 100, 40, "G4P config window"); - pnlControls.addControl(btnControl); -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_Sketchpad/G4P_Sketchpad.pde b/Processing/libraries/G4P/examples/G4P_Sketchpad/G4P_Sketchpad.pde deleted file mode 100644 index 4bddf35..0000000 --- a/Processing/libraries/G4P/examples/G4P_Sketchpad/G4P_Sketchpad.pde +++ /dev/null @@ -1,73 +0,0 @@ -/* - This program demonstrates the the GSketchPad control. This control enables - drawings to be displayed on panels. - - for Processing V2 and V3 - (c) 2015 Peter Lager - - */ - -import g4p_controls.*; - -GPanel pnl; -GSketchPad spad; -GButton btnClear; -PGraphics pg; - -void setup() { - size(400, 300); - // Now create and clear graphic to be used (JAVA parameter - // parameter is only needed for Processing 1.5.1) - pg = createGraphics(200, 160, JAVA2D); - clearGraphic(); - // Create the G4P control to position and display the graphic - spad = new GSketchPad(this, 0, 0, 100, 80); - // Set the graphic for this control. - // The graphic will be scaled to fit the control. - spad.setGraphic(pg); - // Create the button to clear the graphic - btnClear = new GButton(this, 0, 0, 80, 20, "Clear"); - // Create the panel and add the controls - pnl = new GPanel(this, 20, 30, 160, 140, "Sketch Test"); - pnl.addControl(btnClear, 10, 24); - pnl.addControl(spad, 10, 50); - // Expand the panel - pnl.setCollapsed(false); -} - -void draw() { - background(240); - // Every 10th frame update the sketchpad graphic - if (frameCount % 10 == 0) - updateGraphic(); -} - -void handleButtonEvents(GButton button, GEvent event) { - clearGraphic(); -} - -// Clear the sketchpad graphic -void clearGraphic() { - pg.beginDraw(); - pg.background(255, 255, 200); - pg.noFill(); - pg.ellipseMode(CORNERS); - pg.endDraw(); -} - -// Add a line or ellipse to the sketchpad graphic -void updateGraphic() { - float x0 = random(10, pg.width-10); - float x1 = random(10, pg.width-10); - float y0 = random(10, pg.height-10); - float y1 = random(10, pg.height-10); - int col = color(random(64, 255), random(64, 255), random(64, 255)); - pg.beginDraw(); - pg.stroke(col); - pg.strokeWeight(random(2, 5)); - if (random(0, 1) < 0.5f) - pg.line(x0, y0, x1, y1); - else - pg.ellipse(x0, y0, x1, y1); - pg.endDraw(); -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_Slider2D/G4P_Slider2D.pde b/Processing/libraries/G4P/examples/G4P_Slider2D/G4P_Slider2D.pde deleted file mode 100644 index d126a41..0000000 --- a/Processing/libraries/G4P/examples/G4P_Slider2D/G4P_Slider2D.pde +++ /dev/null @@ -1,72 +0,0 @@ -/* - Demonstration of the GSlider2D control to position a - gun-sight over a street scene. - - for Processing V2 and V3 - (c) 2015 Peter Lager - - */ - -import g4p_controls.*; - - -GSlider2D sdrSniper; - -PImage imgScene, imgSight; -// Lens properties -int lsize = 40, lsize2 = lsize * lsize; -float mag = 2.0f; -float k = -0.00002; - -int sightX, sightY; -int border, borderViaLens; - -public void setup() { - size(540, 460); - cursor(CROSS); - imageMode(CENTER); - imgScene = loadImage("backdrop.jpg"); - imgSight = loadImage("sight.png"); - - // border colours - borderViaLens = color(0, 80, 0); - sdrSniper = new GSlider2D(this, 180, 340, 180, 100); - sdrSniper.setLimitsX(180, 60, 480); - sdrSniper.setLimitsY(150, 60, 280); - sdrSniper.setEasing(8); - // sdrSniper.setOpaque(false); - sightX = sdrSniper.getValueXI(); - sightY = sdrSniper.getValueYI(); -} - -public void draw() { - background(imgScene); - showLens(sightX, sightY); - image(imgSight, sightX, sightY); -} - -public void handleSlider2DEvents(GSlider2D slider2d, GEvent event) { - if (slider2d == sdrSniper) { - sightX = sdrSniper.getValueXI(); - sightY = sdrSniper.getValueYI(); - } -} - -public void showLens(int x, int y) { - int u, v, r2; - float f; - for (int vd = - lsize; vd < lsize; vd++) { - for (int ud = - lsize; ud < lsize; ud++) { - r2 = ud*ud + vd*vd; - if (r2 <= lsize2) { - f = mag + k * r2; - u = floor(ud/f) + x; - v = floor(vd/f) + y; - if (u >= 0 && u < imgScene.width && v >=0 && v < imgScene.height) - set(ud + x, vd + y, imgScene.get(u, v)); - else - set(ud + x, vd + y, borderViaLens); - } - } - } -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_Slider2D/data/backdrop.jpg b/Processing/libraries/G4P/examples/G4P_Slider2D/data/backdrop.jpg deleted file mode 100644 index e2963fa..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_Slider2D/data/backdrop.jpg and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_Slider2D/data/sight.png b/Processing/libraries/G4P/examples/G4P_Slider2D/data/sight.png deleted file mode 100644 index 6031f87..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_Slider2D/data/sight.png and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_Slider2D/data/street-scene.jpg b/Processing/libraries/G4P/examples/G4P_Slider2D/data/street-scene.jpg deleted file mode 100644 index d739344..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_Slider2D/data/street-scene.jpg and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_Slider_Config/G4P_Slider_Config.pde b/Processing/libraries/G4P/examples/G4P_Slider_Config/G4P_Slider_Config.pde deleted file mode 100644 index 6778bde..0000000 --- a/Processing/libraries/G4P/examples/G4P_Slider_Config/G4P_Slider_Config.pde +++ /dev/null @@ -1,106 +0,0 @@ -/* - This program demonstrates the various configuration options - available for the slider control (GSlider). - - The only thing not set is the range limits. By default the - slider returns values in the range 0.0 to 1.0 inclusive. - Use setLimits() to set your own range. - - for Processing V2 and V3 - (c) 2015 Peter Lager - - */ - -import g4p_controls.*; - -GSlider sdr; -int bgcol = 128; - -public void setup() { - size(500, 360); - G4P.setCursor(CROSS); - sdr = new GSlider(this, 55, 80, 200, 100, 15); - makeSliderConfigControls(); -} - -public void draw() { - background(bgcol); - fill(227, 230, 255); - noStroke(); - rect(width - 190, 0, 200, height); - rect(0, height - 84, width - 190, 84); -} - -public void handleSliderEvents(GValueControl slider, GEvent event) { - if (slider == sdr) // The slider being configured? - println(sdr.getValueS() + " " + event); - if (slider == sdrEasing) - sdr.setEasing(slider.getValueF()); - else if (slider == sdrNbrTicks) - sdr.setNbrTicks(slider.getValueI()); - else if (slider == sdrBack) - bgcol = slider.getValueI(); -} - -public void handleKnobEvents(GValueControl knob, GEvent event) { - if (knbAngle == knob) - this.sdr.setRotation(knbAngle.getValueF(), GControlMode.CENTER); -} - -public void handleButtonEvents(GButton button, GEvent event) { - if (button.tagNo >= 1000) - sdr.setLocalColorScheme(button.tagNo - 1000); - else if (btnMakeCode == button) - placeCodeOnClipboard(); -} - - -public void handleToggleControlEvents(GToggleControl option, GEvent event) { - if (option == optLeft) - sdr.setTextOrientation(G4P.ORIENT_LEFT); - else if (option == optRight) - sdr.setTextOrientation(G4P.ORIENT_RIGHT); - else if (option == optTrack) - sdr.setTextOrientation(G4P.ORIENT_TRACK); - else if (option == cbxOpaque) - sdr.setOpaque(option.isSelected()); - else if (option == cbxValue) - sdr.setShowValue(option.isSelected()); - else if (option == cbxShowTicks) - sdr.setShowTicks(option.isSelected()); - else if (option == cbxLimits) - sdr.setShowLimits(option.isSelected()); - else if (option == cbxSticky) - sdr.setStickToTicks(option.isSelected()); -} - - -private void placeCodeOnClipboard() { - StringBuilder s = new StringBuilder(); - s.append("// Generated by the GKnob example program\n\n"); - s.append("import g4p_controls.*;\n\n"); - s.append("GSlider sdr; \n\n"); - s.append("void setup() { \n"); - s.append(" size(300, 300); \n"); - s.append(" sdr = new GSlider(this, 55, 80, 200, 100, 15); \n"); - s.append(" // Some of the following statements are not actually\n"); - s.append(" // required because they are setting the default value. \n"); - s.append(" sdr.setLocalColorScheme(" + sdr.getLocalColorScheme() + "); \n"); - s.append(" sdr.setOpaque(" + sdr.isOpaque() + "); \n"); - s.append(" sdr.setValue(" + sdr.getValueF() + "); \n"); - s.append(" sdr.setNbrTicks(" + sdr.getNbrTicks() + "); \n"); - s.append(" sdr.setShowLimits(" + sdr.isShowLimits() + "); \n"); - s.append(" sdr.setShowValue(" + sdr.isShowValue() + "); \n"); - s.append(" sdr.setShowTicks(" + sdr.isShowTicks() + "); \n"); - s.append(" sdr.setStickToTicks(" + sdr.isStickToTicks() + "); \n"); - s.append(" sdr.setEasing(" + sdr.getEasing() + "); \n"); - s.append(" sdr.setRotation(" + knbAngle.getValueF() + ", GControlMode.CENTER); \n"); - s.append("} \n\n"); - s.append("void draw(){ \n"); - s.append(" background(" + bgcol + "); \n"); - s.append("} \n"); - if (GClip.copy(s.toString())) - println("Paste code into empty Processing sketch"); - else - System.err.println("UNABLE TO ACCESS CLIPBOARD"); -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_Slider_Config/configcontrols.pde b/Processing/libraries/G4P/examples/G4P_Slider_Config/configcontrols.pde deleted file mode 100644 index 694ffe8..0000000 --- a/Processing/libraries/G4P/examples/G4P_Slider_Config/configcontrols.pde +++ /dev/null @@ -1,83 +0,0 @@ -// The code in this tab is used to create all the other -// controls needed to configure the slider control. - -GToggleGroup tg = new GToggleGroup(); -GOption optLeft, optRight, optTrack; -GCheckbox cbxOpaque, cbxShowTicks, cbxValue, cbxLimits, cbxSticky; -GSlider sdrBack, sdrNbrTicks, sdrEasing; -GLabel lblOrient, lblVisible, lblNbrTicks, lblEasing; -GKnob knbAngle; -GButton btnMakeCode; -GButton[] btnColours = new GButton[8]; - -public void makeSliderConfigControls() { - // Create colour scheme selectors - int x = width - 42, y = 2; - for (int i = 0; i < btnColours.length; i++) { - btnColours[i] = new GButton(this, x, y + i * 20, 40, 18, "" + (i+1)); - btnColours[i].tag = "Button: " + (i+1); - btnColours[i].setLocalColorScheme(i); - btnColours[i].tagNo = 1000+i; - } - // Create sliders - x = width-100; - y = 162; - bgcol = 200; - sdrBack = new GSlider(this, x, y, 162, 80, 12); - sdrBack.setLimits(bgcol, 0, 255); - sdrBack.setRotation(-PI/2); - sdrBack.setTextOrientation(G4P.ORIENT_RIGHT); - sdrBack.setEasing(20); - sdrBack.setShowValue(true); - sdrBack.setShowTicks(true); - - x = width - 180; - y = 250; - - sdrEasing = new GSlider(this, x, y + 34, 80, 40, 12); - sdrEasing.setLimits(1.0f, 1.0f, 30.0f); - sdrEasing.setShowValue(true); - lblEasing = new GLabel(this, x + 82, y + 34, 80, 40, "Easing"); - lblEasing.setTextAlign(GAlign.LEFT, null); - lblEasing.setTextItalic(); - - sdrNbrTicks = new GSlider(this, x, y + 68, 80, 40, 12); - sdrNbrTicks.setLimits(2, 2, 15); - sdrNbrTicks.setShowValue(true); - lblNbrTicks = new GLabel(this, x + 82, y + 68, 80, 40, "No. of ticks"); - lblNbrTicks.setTextAlign(GAlign.LEFT, null); - lblNbrTicks.setTextItalic(); - - x = width - 180; - y = 164; - lblOrient = new GLabel(this, x, y, 178, 18, "Orient Text"); - lblOrient.setTextAlign(GAlign.LEFT, null); - lblOrient.setTextBold(); - optLeft = new GOption(this, x, y + 20, 80, 18, "Left"); - optRight = new GOption(this, x, y + 40, 80, 18, "Right"); - optTrack = new GOption(this, x, y + 60, 80, 18, "Track"); - tg.addControls(optLeft, optRight, optTrack); - optTrack.setSelected(true); - - x = width - 180; - y = 2; - lblVisible = new GLabel(this, x, y, 70, 18, "Visible"); - lblVisible.setTextBold(); - cbxShowTicks = new GCheckbox(this, x, y + 20, 70, 18, "Ticks"); - cbxLimits = new GCheckbox(this, x, y + 40, 70, 18, "Limits"); - cbxValue = new GCheckbox(this, x, y + 60, 70, 18, "Value"); - cbxOpaque = new GCheckbox(this, x, y + 80, 70, 18, "Opaque"); - cbxSticky = new GCheckbox(this, x, y + 110, 70, 40, "Stick to ticks"); - - x = 10; - y = height - 80; - knbAngle = new GKnob(this, x, y, 70, 70, 0.6f); - knbAngle.setTurnRange(0, 360); - knbAngle.setLimits(0.0f, 0.0f, TWO_PI); - knbAngle.setTurnMode(G4P.CTRL_ANGULAR); - knbAngle.setIncludeOverBezel(true); - knbAngle.setNbrTicks(13); - knbAngle.setStickToTicks(true); - - btnMakeCode = new GButton(this, x + 100, y + 20, 182, 38, "Place code for existing configuration on clipboard"); -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_Stick/G4P_Stick.pde b/Processing/libraries/G4P/examples/G4P_Stick/G4P_Stick.pde deleted file mode 100644 index 28ca05e..0000000 --- a/Processing/libraries/G4P/examples/G4P_Stick/G4P_Stick.pde +++ /dev/null @@ -1,67 +0,0 @@ -/* - This example demonstrates the GStick control. - - The stick can operate with 8 directions, as shown - here or just 4 directions with - joystick.setMode(G4P.X4); - - for Processing V2 and V3 - (c) 2015 Peter Lager - - */ -import g4p_controls.*; - -GStick joystick; -int facing = 6; -int dirX, dirY; -float px, py; -float speed; - -public void setup() { - size(300, 300); - float ss = 80; - joystick = new GStick(this, width-ss, height-ss, ss, ss); - // Change from the default X4 mode (4 position) to the - // 8 position mode. - joystick.setMode(G4P.X8); - strokeWeight(1.5f); - px = width/2; - py = height/2; -} - -public void draw() { - background(255, 255, 230); - // Calculate current position of arrow - px = (px + dirX * speed + width) % width; - py = (py + dirY * speed + height) % height; - - // Draw arrow in current position and rotation - pushMatrix(); - translate(px, py); - rotate(facing * PI/4); - fill(255, 200, 200); - stroke(160, 32, 32); - beginShape(); - vertex(-20, -10); - vertex(-20, 10); - vertex(30, 0); - endShape(CLOSE); - fill(160, 32, 32); - noStroke(); - ellipse(-6, 0, 10, 6); - popMatrix(); -} - -public void handleStickEvents(GStick stick, GEvent event) { - if (joystick == stick) { - int pos = stick.getPosition(); - if (pos < 0) // Stick is in rest position? - speed = 0; - else { // The is not at - facing = pos; - dirX = stick.getStickX(); - dirY = stick.getStickY(); - speed = 0.8; - } - } -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_TextAreaControl/G4P_TextAreaControl.pde b/Processing/libraries/G4P/examples/G4P_TextAreaControl/G4P_TextAreaControl.pde deleted file mode 100644 index 97d8c33..0000000 --- a/Processing/libraries/G4P/examples/G4P_TextAreaControl/G4P_TextAreaControl.pde +++ /dev/null @@ -1,91 +0,0 @@ -/* - Sketch to demonstrate the GTextArea class. - - This component allows the user to enter and edit text. - - In this demonstration the text width > the display width - so it can show off its' horizontal scrollbar. - - The control has been setup with some default text and - this becomes visible when the control is empty. - - The buttons on the side will change the font style - for the selected text. If no text has been selected - then the buttons are ignored. - - Note that super/sub script may not be available on your - system. - - for Processing V2 and V3 - (c) 2015 Peter Lager - - */ - -import g4p_controls.*; - - -GTextArea txaSample; -int bgcol = 32; -String startText; - -public void setup() { - size(700, 360); - - //Load some sample text - String[] paragraphs = loadStrings("book3.txt"); - startText = PApplet.join(paragraphs, '\n'); - - // Create a text area with both horizontal and - // vertical scrollbars that automatically hide - // when not needed. - txaSample = new GTextArea(this, 80, 20, 290, 300, G4P.SCROLLBARS_BOTH | G4P.SCROLLBARS_AUTOHIDE); - txaSample.setText(startText, 310); - // Set some default text - txaSample.setPromptText("Please enter some text"); - - createConfigControls(); -} - -public void draw() { - background(bgcol); - fill(227, 230, 255); - noStroke(); - rect(width - 190, 0, 200, height); -} - -public void handleSliderEvents(GValueControl slider, GEvent event) { - if (slider == sdrBack) - bgcol = slider.getValueI(); -} - -public void handleTextEvents(GEditableTextControl textarea, GEvent event) { - println(event); -} - -public void handleButtonEvents(GButton button, GEvent event) { - if (event == GEvent.CLICKED) { - if (button.tagNo >= 100) - txaSample.setLocalColorScheme(button.tagNo - 1000); - if (button == btnItalic) - txaSample.setSelectedTextStyle(G4P.POSTURE, G4P.POSTURE_OBLIQUE); - if (button == btnPlain) - txaSample.clearStyles(); - if (button == btnBold) - txaSample.setSelectedTextStyle(G4P.WEIGHT, G4P.WEIGHT_BOLD); - if (button == btnSuper) - txaSample.setSelectedTextStyle(G4P.SUPERSCRIPT, G4P.SUPERSCRIPT_SUPER); - if (button == btnSub) - txaSample.setSelectedTextStyle(G4P.SUPERSCRIPT, G4P.SUPERSCRIPT_SUB); - if (button == btnText) - txaSample.setText(startText, 310); - } -} - -public void handleToggleControlEvents(GToggleControl checkbox, GEvent event) { - if (checkbox == cbxJustify) - txaSample.setJustify(checkbox.isSelected()); -} - -public void handleKnobEvents(GValueControl knob, GEvent event) { - txaSample.setRotation(knbAngle.getValueF(), GControlMode.CENTER); -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_TextAreaControl/configcontrols.pde b/Processing/libraries/G4P/examples/G4P_TextAreaControl/configcontrols.pde deleted file mode 100644 index d6074b4..0000000 --- a/Processing/libraries/G4P/examples/G4P_TextAreaControl/configcontrols.pde +++ /dev/null @@ -1,81 +0,0 @@ -// The code in this tab is used to create all the other -// controls needed to configure the knob control. - -GButton[] btnColours = new GButton[8]; -GButton btnItalic, btnBold, btnPlain, btnSuper, btnSub, btnText; -GCheckbox cbxJustify; -GLabel lblStyleInstr; -GKnob knbAngle; -GSlider sdrBack; -StyledString ss; - -public void createConfigControls() { - int x = width - 42, y = 2; - for (int i = 0; i < btnColours.length; i++) { - btnColours[i] = new GButton(this, x, y + i * 20, 40, 18, "" + (i+1)); - btnColours[i].tag = "Button: " + (i+1); - btnColours[i].setLocalColorScheme(i); - btnColours[i].tagNo = 1000+i; - } - - // Create sliders - x = width-100; - y = 162; - sdrBack = new GSlider(this, x, y, 162, 80, 12); - sdrBack.setLimits(bgcol, 0, 255); - sdrBack.setRotation(-PI/2); - sdrBack.setTextOrientation(G4P.ORIENT_RIGHT); - sdrBack.setEasing(20); - sdrBack.setShowValue(true); - sdrBack.setShowTicks(true); - - x = width -180; - y = 2; - btnPlain = new GButton(this, x, 2, 66, 20, "Clear"); - btnPlain.tag = "Button: Clear"; - - btnItalic = new GButton(this, x, 2 + 22, 66, 20, "Italic"); - btnItalic.tag = "Button: Italic"; - ss = new StyledString("Italic"); - ss.addAttribute(G4P.POSTURE, G4P.POSTURE_OBLIQUE); - btnItalic.setStyledText(ss); - - btnBold = new GButton(this, x, 2 + 44, 66, 20, "Bold"); - btnBold.tag = "Button: Bold"; - ss = new StyledString("Bold"); - ss.addAttribute(G4P.WEIGHT, G4P.WEIGHT_BOLD); - btnBold.setStyledText(ss); - - btnSuper = new GButton(this, x, 2 + 66, 66, 20, "Superscript"); - btnSuper.tag = "Button: Superscript"; - ss = new StyledString("Superscript"); - ss.addAttribute(G4P.SUPERSCRIPT, G4P.SUPERSCRIPT_SUPER, 5, 11); - btnSuper.setStyledText(ss); - - btnSub = new GButton(this, x, 2 + 88, 66, 20, "SubScript"); - btnSub.tag = "Button: Subscript"; - ss = new StyledString("Subscript"); - ss.addAttribute(G4P.SUPERSCRIPT, G4P.SUPERSCRIPT_SUB, 3, 9); - btnSub.setStyledText(ss); - - cbxJustify = new GCheckbox(this, x, 2 + 110, 66, 20, "Justify"); - cbxJustify.setOpaque(true); - - btnText = new GButton(this, x, 142, 66, 36, "RESET TEXT"); - - x = width - 180; - y = 176; - String si = "Use the keyboard (Windows shortcut keys) or the mouse to select some text then click on the style buttons to change the style of the selected text"; - lblStyleInstr = new GLabel(this, x, y, 170, 100, si); - lblStyleInstr.setOpaque(true); - - x = width - 130; - y = height - 80; - knbAngle = new GKnob(this, x, y, 70, 70, 0.6f); - knbAngle.setTurnRange(0, 360); - knbAngle.setLimits(0.0f, 0.0f, TWO_PI); - knbAngle.setTurnMode(G4P.CTRL_ANGULAR); - knbAngle.setIncludeOverBezel(true); - knbAngle.setNbrTicks(13); - knbAngle.setStickToTicks(true); -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_TextAreaControl/data/book3.txt b/Processing/libraries/G4P/examples/G4P_TextAreaControl/data/book3.txt deleted file mode 100644 index 3d343d3..0000000 --- a/Processing/libraries/G4P/examples/G4P_TextAreaControl/data/book3.txt +++ /dev/null @@ -1,3 +0,0 @@ -Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. -Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. -It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like) \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_TextIconControls/G4P_TextIconControls.pde b/Processing/libraries/G4P/examples/G4P_TextIconControls/G4P_TextIconControls.pde deleted file mode 100644 index c9cd049..0000000 --- a/Processing/libraries/G4P/examples/G4P_TextIconControls/G4P_TextIconControls.pde +++ /dev/null @@ -1,150 +0,0 @@ -/* - This sketch is used show controls that use a mixture of - text and icons and allows you to experiment with text - and icon alignment options. - - It also uses the droplist control extensively. - controls available in the G4P library. - - for Processing V3 - (c) 2015 Peter Lager - - */ - -import g4p_controls.*; - -GToggleGroup tg = new GToggleGroup(); -GOption opt0, opt1, opt2; -GCheckbox cbx0; -GLabel lbl0, lbl1; -GButton btn0, btn1; - -// Since all the classes for all these controls inherit -// from GTextIconControl this arraylist will keep them as -// a collection so they can all be configured as a group -// more easily -ArrayList controls = new ArrayList(); - -int bgcol = 240; - -public void setup() { - size(560, 380); - G4P.setCursor(CROSS); - - // Get some sample text for later - String[] lines = loadStrings("tisample.txt"); - String text = join(lines, '\n'); - // Options and checkboxes have default settings : - // left/middle text & left/middle icon alignment - // Labels and buttons have default settings : - // centre/middle text & right/middle icon alignment - // The buttons and labels will have there alignment - // changed to match the labels so they all start - // matched to the drop lists. - lbl0 = new GLabel(this, 20, 10, 150, 350, text); - lbl0.setTextAlign(GAlign.LEFT, null); - controls.add(lbl0); - - lbl1 = new GLabel(this, 200, 100, 140, 80, "Labels can also have icons like this one"); - lbl1.setIcon("bugtest.png", 1, GAlign.LEFT, null); - lbl1.setTextAlign(GAlign.LEFT, null); - controls.add(lbl1); - - btn0 = new GButton(this, 200, 190, 150, 80, "Buttons always have an opaque background"); - btn0.setTextAlign(GAlign.LEFT, null); - controls.add(btn0); - - btn1 = new GButton(this, 200, 280, 150, 80, "As well as text buttons can also have icons"); - btn1.setIcon("smile.png", 3, GAlign.LEFT, null); - btn1.setTextAlign(GAlign.LEFT, null); - controls.add(btn1); - - opt0 = new GOption(this, 200, 10, 100, 18, "Option 0"); - tg.addControl(opt0); - controls.add(opt0); - - opt1 = new GOption(this, 200, 32, 100, 18, "Option 1"); - tg.addControl(opt1); - controls.add(opt1); - - opt2 = new GOption(this, 200, 54, 100, 18, "Option 2"); - tg.addControl(opt2); - controls.add(opt2); - - opt0.setSelected(true); - tg.addControls(opt0, opt1, opt2); - - cbx0 = new GCheckbox(this, 200, 76, 100, 20, "Tick box"); - controls.add(cbx0); - makeTextIconConfigControls(); -} - -public void draw() { - background(bgcol); - fill(227, 230, 255); - noStroke(); - rect(width - 190, 0, 200, height); -} - -public void handleSliderEvents(GValueControl slider, GEvent event) { - if (slider == sdrBack) - bgcol = slider.getValueI(); -} - -public void handleKnobEvents(GValueControl knob, GEvent event) { - if (knbAngle == knob) - for (GTextIconAlignBase control : controls) - control.setRotation(knbAngle.getValueF(), GControlMode.CENTER); -} - -public void handleButtonEvents(GButton button, GEvent event) { - if (button.tagNo >= 1000) { - for (GTextIconAlignBase control : controls) - control.setLocalColorScheme(button.tagNo - 1000); - } -} - - -public void handleToggleControlEvents(GToggleControl option, GEvent event) { - if (option == optPlain) - for (GTextIconAlignBase control : controls) - control.setTextPlain(); - else if (option == optBold) - for (GTextIconAlignBase control : controls) { - control.setTextPlain(); - control.setTextBold(); - } else if (option == optItalic) - for (GTextIconAlignBase control : controls) { - control.setTextPlain(); - control.setTextItalic(); - } else if (option == optItalic) - for (GTextIconAlignBase control : controls) { - control.setTextPlain(); - control.setTextItalic(); - } else if (option == optBoldItalic) - for (GTextIconAlignBase control : controls) { - control.setTextBold(); - control.setTextItalic(); - } else if (option == cbxOpaque) - for (GTextIconAlignBase control : controls) - control.setOpaque(cbxOpaque.isSelected()); -} - -public void handleDropListEvents(GDropList list, GEvent event) { - GAlign na = GAlign.getFromText(list.getSelectedText()); - println(na); - - if (list == textH) - for (GTextIconAlignBase control : controls) - control.setTextAlign(na, null); - if (list == textV) - for (GTextIconAlignBase control : controls) - control.setTextAlign(null, na); - if (list == iconH) - for (GTextIconAlignBase control : controls) - control.setIconAlign(na, null); - if (list == iconV) { - for (GTextIconAlignBase control : controls) - control.setIconAlign(null, na); - } -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_TextIconControls/configcontrols.pde b/Processing/libraries/G4P/examples/G4P_TextIconControls/configcontrols.pde deleted file mode 100644 index 8fe8c45..0000000 --- a/Processing/libraries/G4P/examples/G4P_TextIconControls/configcontrols.pde +++ /dev/null @@ -1,93 +0,0 @@ -// The code in this tab is used to create all the other -// controls needed to configure the text+icon controls. - -GToggleGroup tgStyle = new GToggleGroup(); -GOption optPlain, optBold, optItalic, optBoldItalic; -GCheckbox cbxOpaque; -GSlider sdrBack; -GLabel lblTestStyle, lblVisible, lblNbrTicks, lblEasing; -GLabel lblTextA, lblIconA; -GKnob knbAngle; -GButton[] btnColours = new GButton[8]; -GDropList textH, textV, iconH, iconV; - -public void makeTextIconConfigControls() { - // Create colour scheme selectors - int x = width - 42, y = 2; - for (int i = 0; i < btnColours.length; i++) { - btnColours[i] = new GButton(this, x, y + i * 20, 40, 18, "" + (i+1)); - btnColours[i].tag = "Button: " + (i+1); - btnColours[i].setLocalColorScheme(i); - btnColours[i].tagNo = 1000+i; - } - // Create sliders - x = width-100; - y = 162; - sdrBack = new GSlider(this, x, y, 162, 80, 12); - sdrBack.setLimits(bgcol, 0, 255); - sdrBack.setRotation(-PI/2); - sdrBack.setTextOrientation(G4P.ORIENT_RIGHT); - sdrBack.setEasing(20); - sdrBack.setShowValue(true); - sdrBack.setShowTicks(true); - - x = width - 180; - y = 2; - lblVisible = new GLabel(this, x, y, 80, 18, "VISIBLE"); - lblVisible.setTextItalic(); - cbxOpaque = new GCheckbox(this, x, y + 20, 70, 18, "OPAQUE"); - - x = width - 180; - y = 52; - lblTestStyle = new GLabel(this, x, y, 80, 18, "Text Style"); - lblTestStyle.setTextItalic(); - optPlain = new GOption(this, x, y + 20, 80, 18, "Plain"); - optBold = new GOption(this, x, y + 40, 80, 18, "Bold"); - optItalic = new GOption(this, x, y + 60, 80, 18, "Italic"); - optBoldItalic = new GOption(this, x, y + 80, 100, 18, "Bold-Italic"); - - tgStyle.addControls(optPlain, optBold, optItalic, optBoldItalic); - optPlain.setSelected(true); - - // Allignment droplists - String[] items; - x = width - 180; - y = 170; - lblTextA = new GLabel(this, x, y, 80, 38, "TEXT ALIGNMENT"); - lblTextA.setTextItalic(); - - items = new String[] { "LEFT", "CENTER", "RIGHT", "JUSTIFY"}; - textH = new GDropList(this, x, y + 40, 80, 90, 4); - textH.setItems(items, 0); - textH.tag = "textH"; - - items = new String[] { "TOP", "MIDDLE", "BOTTOM"}; - textV = new GDropList(this, x, y + 60, 80, 90, 4); - textV.setItems(items, 1); - textV.tag = "textV"; - - x = width - 90; - y = 170; - lblIconA = new GLabel(this, x, y, 80, 38, "ICON ALIGNMENT"); - lblIconA.setTextItalic(); - - items = new String[] { "LEFT", "RIGHT"}; - iconH = new GDropList(this, x, y + 40, 80, 90, 4); - iconH.setItems(items, 0); - iconH.tag = "iconH"; - - items = new String[] { "TOP", "MIDDLE", "BOTTOM"}; - iconV = new GDropList(this, x, y + 60, 80, 90, 4); - iconV.setItems(items, 1); - iconV.tag = "iconV"; - - x = width - 140; - y = height - 120; - knbAngle = new GKnob(this, x, y, 100, 100, 0.6f); - knbAngle.setTurnRange(0, 360); - knbAngle.setLimits(0.0f, 0.0f, TWO_PI); - knbAngle.setTurnMode(G4P.CTRL_ANGULAR); - knbAngle.setIncludeOverBezel(true); - knbAngle.setNbrTicks(13); - knbAngle.setStickToTicks(true); -} diff --git a/Processing/libraries/G4P/examples/G4P_TextIconControls/data/bugtest.png b/Processing/libraries/G4P/examples/G4P_TextIconControls/data/bugtest.png deleted file mode 100644 index c619c4c..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_TextIconControls/data/bugtest.png and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_TextIconControls/data/smile.png b/Processing/libraries/G4P/examples/G4P_TextIconControls/data/smile.png deleted file mode 100644 index 63e0ed1..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_TextIconControls/data/smile.png and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_TextIconControls/data/tisample.txt b/Processing/libraries/G4P/examples/G4P_TextIconControls/data/tisample.txt deleted file mode 100644 index 9e7492d..0000000 --- a/Processing/libraries/G4P/examples/G4P_TextIconControls/data/tisample.txt +++ /dev/null @@ -1,3 +0,0 @@ -Icons are created from images files made by the user. -The user supplied image should contain between 1 and 3 images tiled horizontally. The GButton control the tile show depends on whether the mouse is off or over the control surface and if the mouse button is pressed while over the control. -The GOption and GCheckbox controls need just 2 tiled images and the GLabel just 1 tiled image. \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_Timer/G4P_Timer.pde b/Processing/libraries/G4P/examples/G4P_Timer/G4P_Timer.pde deleted file mode 100644 index 38cc7d8..0000000 --- a/Processing/libraries/G4P/examples/G4P_Timer/G4P_Timer.pde +++ /dev/null @@ -1,145 +0,0 @@ -/* - Balls of Vesuvius. - - A simple program to demonstrate the use of the GTimer - class which is part of the G4P (GUI for Processing) - library. - - for Processing V2 and V3 - (c) 2015 Peter Lager - - */ - -import g4p_controls.*; - -GSlider sdrRate; -GButton btnStart, btnStop; -GTimer timer; - -ArrayList liveBalls, deadBalls; -int rate; -PImage rear, front; - -void setup() { - size(768, 600); - // Create 2 buttons to start and stop the balls - btnStart = new GButton(this, 10, 10, 100, 20, "Start"); - btnStop = new GButton(this, 120, 10, 100, 20, "Stop"); - // Create a slider to control rate of balls erupted. - sdrRate = new GSlider(this, 230, 10, 360, 20, 10); - sdrRate.setLimits(50, 10, 120); // (init, min, max) - sdrRate.setEasing(5); - - // Get timer interval based on initial slider value and limits - rate = 130 - sdrRate.getValueI(); - // Create a GTimer object that will call the method - // fireBall - // Parameter 1 : the PApplet class i.e. 'this' - // 2 : the object that has the method to call - // 3 : the name of the method (parameterless) to call - // 4 : the interval in millisecs bewteen method calls - timer = new GTimer(this, this, "fireBall", rate); - - // Balls in the air alive - liveBalls = new ArrayList(2000); - // Balls that are below the level of the window - deadBalls = new ArrayList(100); - - front = loadImage("vfront.png"); - rear = loadImage("vrear.jpg"); - - // try and keep it at 30fps - frameRate(30); - - // Register the pre() method for this class. Pick the line - // to match the version of Processing being used. - // registerPre(this); // Use this for PS 1.5.1 - registerMethod("pre", this); // Use this for PS 2.0b6 -} - -// This method is now called before each call to draw() -public void pre() { - Ball b; - int i; - // Update all live balls - for (i = 0; i < liveBalls.size(); i++) { - b = (Ball)liveBalls.get(i); - b.update(); - // See if this ball should die if so remember it - if (b.y > height + 20) - deadBalls.add(b); - } - // Remove dead balls from the list of live balls - for (i = 0; i < deadBalls.size(); i++) { - liveBalls.remove(deadBalls.get(i)); - } - // Done with dead balls - deadBalls.clear(); -} - -void draw() { - int i; - Ball b; - - background(rear); - for (i = 0; i < liveBalls.size(); i++) { - b = (Ball)liveBalls.get(i); - b.display(); - } - image(front, 0, 0); -} - -// This is called when the user drags on the slider -void handleSliderEvents(GValueControl slider, GEvent event) { - rate = 130 - sdrRate.getValueI(); - timer.setInterval(rate); -} - -// This method is called when a button is clicked -void handleButtonEvents(GButton button, GEvent event) { - if (button == btnStart && event == GEvent.CLICKED) - timer.start(); - if (button == btnStop && event == GEvent.CLICKED) - timer.stop(); -} - -// This method is called by the timer -void fireBall(GTimer timer) { - Ball ball = new Ball(); - liveBalls.add(ball); -} - -// Simple class to represent a ball -class Ball { - public float radius; - public int col; - public float x, y; - public float vx, vy; - public float gravity = 0.07f; - public float drag = 0.99; - public float shrink = 0.999; - - public Ball() { - x = random(500, 540); - y = 290; - col = color(random(200, 255), random(20, 55), 0); - radius = random(3, 10); - vx = random(-3.0, 1.9); - vy = random(5.5, 8.2); - } - - public void update() { - x += vx; - y -= vy; - vy -= gravity; - if (vy < 0) - vx *= drag; - radius *= shrink; - } - - public void display() { - noStroke(); - fill(col); - ellipse(x, y, radius, radius); - } -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_Timer/data/vfront.png b/Processing/libraries/G4P/examples/G4P_Timer/data/vfront.png deleted file mode 100644 index 2179669..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_Timer/data/vfront.png and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_Timer/data/vrear.jpg b/Processing/libraries/G4P/examples/G4P_Timer/data/vrear.jpg deleted file mode 100644 index bb90808..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_Timer/data/vrear.jpg and /dev/null differ diff --git a/Processing/libraries/G4P/examples/G4P_Toroid/G4P_Toroid.pde b/Processing/libraries/G4P/examples/G4P_Toroid/G4P_Toroid.pde deleted file mode 100644 index 89bbb70..0000000 --- a/Processing/libraries/G4P/examples/G4P_Toroid/G4P_Toroid.pde +++ /dev/null @@ -1,130 +0,0 @@ -/* - Interative Toroid with GUI controls from the G4P library - - Modification of the example - Interactive Toroid by Ira Greenberg. - - The toroid code has been abstracted to its own tab to - separate it from the GUI code for clarity. - - Illustrates the geometric relationship between Toroid, Sphere, - and Helix 3D primitives, as well as lathing principal. - - for Processing V2 and V3 - (c) 2015 Peter Lager - - */ - -import g4p_controls.*; - -GLabel lblSegs, lblERad, lblPts, lblLRad; -GCustomSlider sdrSegs, sdrERad, sdrPts, sdrLRad; -GCheckbox cbxWire; -GOption optTorroid, optHelix; -GToggleGroup optShape; -GPanel p; - -Toroid t1; - -void setup() { - size(640, 480, P3D); - t1 = new Toroid(); - - // Sets the colour scheme for the GUI components - // The 8 schemes available are - // RED_SCHEME, GREEN_SCHEME, YELLOW_SCHEME, PURPLE_SCHEME - // ORANGE_SCHEME, CYAN_SCHEME, BLUE_SCHEME, GOLD_SCHEME - // Defaults to BLUE_SCHEME - G4P.setGlobalColorScheme(G4P.PURPLE_SCHEME); - - // Create the various GUI components - p = new GPanel(this, 2, height - 30, 460, 300, "Toroid Control Panel"); - lblSegs = new GLabel(this, 2, 40, 120, 20, "Segment detail"); - lblPts = new GLabel(this, 2, 100, 120, 20, "Ellipse detail"); - lblERad = new GLabel(this, 2, 160, 120, 20, "Ellipse Radius"); - lblLRad = new GLabel(this, 2, 220, 120, 20, "Toroid Radius"); - - sdrSegs = new GCustomSlider(this, 110, 20, 325, 60, "purple18px"); - sdrSegs.setLimits(60, 3, 60); - sdrSegs.setNbrTicks(58); - sdrSegs.setStickToTicks(true); - - sdrPts = new GCustomSlider(this, 110, 80, 325, 60, "purple18px"); - sdrPts.setLimits(32, 3, 32); - sdrPts.setNbrTicks(30); - sdrPts.setStickToTicks(true); - - sdrERad = new GCustomSlider(this, 110, 140, 325, 60, null); - sdrERad.setLimits(60.0, 10.0, 100.0); - sdrERad.setEasing(20); - - sdrLRad = new GCustomSlider(this, 110, 200, 325, 60, null); - sdrLRad.setLimits(140.0, 10.0, 240.0); - sdrLRad.setEasing(20); - - // Various options - optTorroid = new GOption(this, 110, 260, 80, 20, "Toroid?"); - optHelix = new GOption(this, 200, 260, 80, 20, "Helix?"); - cbxWire = new GCheckbox(this, 330, 260, 100, 20, "Wire frame?"); - - // Torroid / helix option group - optShape = new GToggleGroup(); - optShape.addControl(optTorroid); - optShape.addControl(optHelix); - optTorroid.setSelected(true); - - p.addControl(lblSegs); - p.addControl(lblPts); - p.addControl(lblERad); - p.addControl(lblLRad); - p.addControl(sdrSegs); - p.addControl(sdrPts); - p.addControl(sdrERad); - p.addControl(sdrLRad); - p.addControl(optHelix); - p.addControl(optTorroid); - p.addControl(cbxWire); - // Set the alpha after adding the controls. - // The true will mean it will be applied to - // anything already added to the panel. - p.setAlpha(220, true); - p.setCollapsed(true); -} - -public void handleSliderEvents(GValueControl slider, GEvent event) { - if (slider == sdrSegs) - t1.setSegmentDetail(sdrSegs.getValueI()); - if (slider == sdrPts) - t1.setEllipseDetail(sdrPts.getValueI()); - if (slider == sdrERad) - t1.setEllipseRadius(sdrERad.getValueF()); - if (slider == sdrLRad) - t1.setLatheRadius(sdrLRad.getValueF()); -} - -public void handleToggleControlEvents(GToggleControl option, GEvent event) { - if (option == cbxWire) - t1.setIsWire(cbxWire.isSelected()); - if (option == optHelix) - t1.setIsHelix(true); - if (option == optTorroid) - t1.setIsHelix(false); -} - -void draw() { - pushMatrix(); - background(200, 200, 255); - // basic lighting setup - lights(); - // 2 rendering styles - //center and spin toroid - translate(width/2, height/2, -200); - - rotateX(frameCount*PI/150); - rotateY(frameCount*PI/170); - rotateZ(frameCount*PI/90); - - // draw toroid - t1.draw(); - popMatrix(); -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_Toroid/Toroid.pde b/Processing/libraries/G4P/examples/G4P_Toroid/Toroid.pde deleted file mode 100644 index ea684a4..0000000 --- a/Processing/libraries/G4P/examples/G4P_Toroid/Toroid.pde +++ /dev/null @@ -1,130 +0,0 @@ -/** - * Interactive Toroid - * by Ira Greenberg. - * - * Illustrates the geometric relationship between Toroid, Sphere, - * and Helix 3D primitives, as well as lathing principal. - */ - -class Toroid { - int pts = 40; - float angle = 0; - float radius = 60.0; - - // lathe segments - int segments = 60; - float latheAngle = 0; - float latheRadius = 100.0; - - //vertices - PVector vertices[], vertices2[]; - - // for shaded or wireframe rendering - boolean isWireFrame = false; - - // for optional helix - boolean isHelix = false; - float helixOffset = 5.0; - - - boolean modelChange = false; - - public Toroid(){ - fillVertexArrays(); - } - - public void setSegmentDetail(int segments){ - this.segments = segments; - fillVertexArrays(); - } - - public void setEllipseDetail(int points){ - pts = points; - fillVertexArrays(); - } - - public void setEllipseRadius(float eradius){ - radius = eradius; - fillVertexArrays(); - } - - public void setLatheRadius(float lradius){ - latheRadius = lradius; - fillVertexArrays(); - } - - public void setIsHelix(boolean helix){ - isHelix = helix; - fillVertexArrays(); -} - - public void setIsWire(boolean wire){ - isWireFrame = wire; - } - - void fillVertexArrays(){ - // initialize point arrays - vertices = new PVector[pts+1]; - vertices2 = new PVector[pts+1]; - - // fill arrays - for(int i=0; i<=pts; i++){ - vertices[i] = new PVector(); - vertices2[i] = new PVector(); - vertices[i].x = latheRadius + sin(radians(angle))*radius; - if (isHelix){ - vertices[i].z = cos(radians(angle))*radius-(helixOffset* segments)/2; - } - else{ - vertices[i].z = cos(radians(angle))*radius; - } - angle+=360.0/pts; - } - } - - void draw(){ - pushStyle(); - if(isHelix) - fillVertexArrays(); - pushMatrix(); - if (isWireFrame){ - stroke(64, 64, 128); - strokeWeight(1); - noFill(); - } - else { - noStroke(); - fill(40, 40, 255); - } - - // draw toroid - latheAngle = 0; - for(int i=0; i<=segments; i++){ - beginShape(QUAD_STRIP); - for(int j=0; j<=pts; j++){ - if (i>0){ - vertex(vertices2[j].x, vertices2[j].y, vertices2[j].z); - } - vertices2[j].x = cos(radians(latheAngle))*vertices[j].x; - vertices2[j].y = sin(radians(latheAngle))*vertices[j].x; - vertices2[j].z = vertices[j].z; - // optional helix offset - if (isHelix){ - vertices[j].z+=helixOffset; - } - vertex(vertices2[j].x, vertices2[j].y, vertices2[j].z); - } - // create extra rotation for helix - if (isHelix){ - latheAngle+=720.0/segments; - } - else { - latheAngle+=360.0/segments; - } - endShape(); - } - popMatrix(); - popStyle(); - } - -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_WindowsStarter/G4P_WindowsStarter.pde b/Processing/libraries/G4P/examples/G4P_WindowsStarter/G4P_WindowsStarter.pde deleted file mode 100644 index 7848182..0000000 --- a/Processing/libraries/G4P/examples/G4P_WindowsStarter/G4P_WindowsStarter.pde +++ /dev/null @@ -1,127 +0,0 @@ -/* - Demonstration of how to create and use multiple windows with - the G4P library. - - - Since each window has its own unique data set they can all - share the code needed for mouse handling and drawing. - It is a complex example and it is recommended that you read - a detailed explanation of the code used which can be found at: - - http://www.lagers.org.uk/g4p/applets/g4p_windowsstarter - - for Processing V3 - (c) 2015 Peter Lager - - */ - -import g4p_controls.*; - -GWindow[] window; -GButton btnStart; -GLabel lblInstr; - -public void setup() { - size(256, 128); - btnStart = new GButton(this, 4, 34, 120, 60, "Create 3 Windows"); - lblInstr = new GLabel(this, 132, 34, 120, 60, "Use the mouse to draw a rectangle in any of the 3 windows"); - lblInstr.setTextAlign(GAlign.CENTER, GAlign.MIDDLE); - lblInstr.setVisible(false); -} - -/** - * Draw for the main window - */ -public void draw() { - background(240); -} - -/** - Create the three windows so that they share mouse handling - and drawing code. - */ -public void createWindows() { - //int[] col = {color(200,0,0), color(0,200,0), color(0,0,200) }; - int col; - window = new GWindow[3]; - for (int i = 0; i < 3; i++) { - col = (128 << (i * 8)) | 0xff000000; - window[i] = GWindow.getWindow(this, "Window "+i, 70+i*220, 160+i*50, 200, 200, JAVA2D); - window[i].addData(new MyWinData()); - ((MyWinData)window[i].data).col = col; - window[i].addDrawHandler(this, "windowDraw"); - window[i].addMouseHandler(this, "windowMouse"); - } -} - -/** - * Click the button to create the windows. - * @param button - */ -public void handleButtonEvents(GButton button, GEvent event) { - if (window == null && event == GEvent.CLICKED) { - createWindows(); - lblInstr.setVisible(true); - button.setEnabled(false); - } -} - -/** - * Handles mouse events for ALL GWindow objects - * - * @param appc the PApplet object embeded into the frame - * @param data the data for the GWindow being used - * @param event the mouse event - */ -public void windowMouse(PApplet appc, GWinData data, MouseEvent event) { - MyWinData data2 = (MyWinData)data; - switch(event.getAction()) { - case MouseEvent.PRESS: - data2.sx = data2.ex = appc.mouseX; - data2.sy = data2.ey = appc.mouseY; - data2.done = false; - break; - case MouseEvent.RELEASE: - data2.ex = appc.mouseX; - data2.ey = appc.mouseY; - data2.done = true; - break; - case MouseEvent.DRAG: - data2.ex = appc.mouseX; - data2.ey = appc.mouseY; - break; - } -} - -/** - * Handles drawing to the windows PApplet area - * - * @param appc the PApplet object embeded into the frame - * @param data the data for the GWindow being used - */ -public void windowDraw(PApplet appc, GWinData data) { - MyWinData data2 = (MyWinData)data; - appc.background(data2.col); - if (!(data2.sx == data2.ex && data2.ey == data2.ey)) { - appc.stroke(255); - appc.strokeWeight(2); - appc.noFill(); - if (data2.done) { - appc.fill(128); - } - appc.rectMode(CORNERS); - appc.rect(data2.sx, data2.sy, data2.ex, data2.ey); - } -} - -/** - * Simple class that extends GWinData and holds the data - * that is specific to a particular window. - * - * @author Peter Lager - */ -class MyWinData extends GWinData { - int sx, sy, ex, ey; - boolean done; - int col; -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_with_PeasyCam/G4P_with_PeasyCam.pde b/Processing/libraries/G4P/examples/G4P_with_PeasyCam/G4P_with_PeasyCam.pde deleted file mode 100644 index ec3705c..0000000 --- a/Processing/libraries/G4P/examples/G4P_with_PeasyCam/G4P_with_PeasyCam.pde +++ /dev/null @@ -1,198 +0,0 @@ -/** - * PeasyCam with GUI control - * - * Extends PeasyCam example to use with G4P by providing - * sliders to control the angles. - * - * When the panel is open you can drag the sliders to rotate - * the cube. When the panel is closed then dragging the mouse - * over the display will rotate the cube as per PeaseyCam - * example. - * - * The control code is quite complex because PeasyCam does - * not provide methods to set the rotation angles abso;utely - * only relatively. - * - * Click on the panel tab to open/close the panel. - * - * by Peter Lager - */ - -import g4p_controls.*; -import peasy.*; - -PeasyCam cam; - -GPanel pnl; -GSlider sx, sy, sz; -GLabel label; -int ax, ay, az; - -// These are needed to remember PeasyCam offset and distance -float[] offsets = new float[3]; -float[] rotations = new float[3]; -double distance = 0.0f; - -// Remember last slider values -// PeasyCam does not provide methods to set the absolute -// rotation angles, rotateX(ang) rotates about the X axis -// by ang radians -int lastSx, lastSy, lastSz; -int currSx, currSy, currSz; - -public void setup() { - size(400, 400, P3D); - - // This is only required if you are going to create something - // that changes the initial matrix (g) BEFORE creating a G4P - // control. PeasyCam is just such an object, but if it is - // created after one of the G4P controls then you would not - // this statement. - - // Sets the colour scheme for the GUI components - // The 8 schemes available are - // RED_SCHEME, GREEN_SCHEME, YELLOW_SCHEME, PURPLE_SCHEME - // ORANGE_SCHEME, CYAN_SCHEME, BLUE_SCHEME, GOLD_SCHEME - // Defaults to BLUE_SCHEME - G4P.setGlobalColorScheme(GCScheme.RED_SCHEME); - - // Create a collapsible panel - // (this, tab title, x, y, width, height) - pnl = new GPanel(this, 10, 300, 300, 88, "Rotate Cube"); - pnl.setCollapsed(true); - // Create a horizontal slider - // (this, x, y, width, height) - // default value limits 0-100 and initial value 50 - sx = new GSlider(this, 10, 22, 280, 20, 13); - // set slider value limits (initial value, min, max) - sx.setLimits(0, -180, 180); - // Hide tick marks - sx.setShowTicks(false); - // Set thumb easing for nice visual effect - acceptable - // values 1 to 100 (default = 1 i.e. no easing) - sx.setEasing(15); - - sy = new GSlider(this, 10, 42, 280, 20, 13); - sy.setLimits(0, -180, 180); - sy.setShowTicks(false); - sy.setEasing(15); - - sz = new GSlider(this, 10, 62, 280, 20, 13); - sz.setLimits(0, -180, 180); - sz.setShowTicks(false); - sz.setEasing(15); - - // Add the sliders to the panel x,y coordinates are now - // relative to the top left of the panel open area below - // the tab - pnl.addControl(sx); - pnl.addControl(sy); - pnl.addControl(sz); - - // Create a label across the top of the screen - String s = "Drag the slider thumb or click on the "; - s += "track to rotate the cube. The panel can be collapsed/"; - s += "expanded by clicking on the panel title bar"; - label = new GLabel(this, 0, 0, width, 60, s); - label.setOpaque(true); - // Align the text both horizontally and vertically - label.setTextAlign(GAlign.CENTER, GAlign.MIDDLE); - - // Create a PeasyCam object - cam = new PeasyCam(this, 100); - cam.setMinimumDistance(50); - cam.setMaximumDistance(500); -} - -public void draw() { - // Switch off PeasyCam mouse control if the panel is being - // dragged else turn it on - if (pnl.isCollapsed()) // Panel is collapsed - cam.setActive(!pnl.isDragging()); - else // panel open must be using sliders - cam.setActive(false); - rotateX(-.5f); - rotateY(-.5f); - background(0); - // Draw big box - strokeWeight(2); - stroke(255, 255, 0); - fill(255, 0, 0); - box(30); - // Draw little box - translate(0, 0, 20); - fill(0, 0, 255); - box(5); - // Synchronise the actual rotations and slider positions - syncSliders(); -} - - -/* - This function displays how we can create a HUD with PeasyCam. - */ -void syncSliders() { - // Get the current PeasyCam details to restore later - rotations = cam.getRotations(); - - // If necessary update slider positions - if (pnl.isCollapsed()) { - // Update slider positions - currSx = lastSx = (int)Math.toDegrees(rotations[0]); - currSy = lastSy = (int)Math.toDegrees(rotations[1]); - currSz = lastSz = (int)Math.toDegrees(rotations[2]); - - // There are 2 methods to set the value of the slider - // setValue(value); it takes into account any inertia - // setValue(value, ignore); where ignore is a boolean value - // which if true will set the value and move the thumb - // immediately ignoring any inertia value - sx.setValue((int)Math.toDegrees(rotations[0])); - sy.setValue((int)Math.toDegrees(rotations[1])); - sz.setValue((int)Math.toDegrees(rotations[2])); - } - else { // Use sliders to control rotation - if (currSx != lastSx) { - cam.rotateX(Math.toRadians(currSx - lastSx)); - lastSx = currSx; - } - if (currSy != lastSy) { - cam.rotateY(Math.toRadians(currSy - lastSy)); - lastSy = currSy; - } - if (currSz != lastSz) { - cam.rotateZ(Math.toRadians(currSz - lastSz)); - lastSz = currSz; - } - } -} - -// Handle panels events i.e. when a panel is opened or -// collapsed -void handlePanelEvents(GPanel panel, GEvent event) { - // Intended to detect panel events but ended up not - // needing it. Left the following code as an example - switch(event) { - case COLLAPSED: - println("Panel has collapsed"); - break; - case EXPANDED: - println("Panel has expanded"); - break; - case DRAGGED: - print("The panel has been dragged to "); - println(pnl.getX() + ", " + pnl.getY()); - break; - } -} - -// Handles slider events for both horizontal and -// vertical sliders -void handleSliderEvents(GValueControl slider, GEvent event) { - if (slider == sx) - currSx = slider.getValueI(); - if (slider == sy) - currSy = slider.getValueI(); - if (slider == sz) - currSz = slider.getValueI(); -} \ No newline at end of file diff --git a/Processing/libraries/G4P/examples/G4P_with_PeasyCam/code/peasycam.jar b/Processing/libraries/G4P/examples/G4P_with_PeasyCam/code/peasycam.jar deleted file mode 100644 index ec804af..0000000 Binary files a/Processing/libraries/G4P/examples/G4P_with_PeasyCam/code/peasycam.jar and /dev/null differ diff --git a/Processing/libraries/G4P/library.properties b/Processing/libraries/G4P/library.properties deleted file mode 100644 index f0f101a..0000000 --- a/Processing/libraries/G4P/library.properties +++ /dev/null @@ -1,11 +0,0 @@ -name=G4P -category=GUI -authors=[Peter Lager](http://www.lagers.org.uk) -url=http://www.lagers.org.uk/g4p -sentence=Provides a set of 2D GUI controls and multiple window support. -paragraph=Controls include buttons, sliders, knobs, labels, textfields, timers, combo boxes, option buttons etc. and multiple windows. [G4P GUI builder](http://www.lagers.org.uk/g4ptool/index.html) is a companion tool that enables the rapid (visual) development of user interfaces with this library. -version=27 -prettyVersion=4.0.4 -lastUpdated=0 -minRevision=245 -maxRevision=0 diff --git a/Processing/libraries/G4P/library/G4P.jar b/Processing/libraries/G4P/library/G4P.jar deleted file mode 100644 index c674f75..0000000 Binary files a/Processing/libraries/G4P/library/G4P.jar and /dev/null differ diff --git a/Processing/libraries/G4P/library/changes.txt b/Processing/libraries/G4P/library/changes.txt deleted file mode 100644 index aae380e..0000000 --- a/Processing/libraries/G4P/library/changes.txt +++ /dev/null @@ -1,87 +0,0 @@ -G4P changes incorporated into version - -V4.0.4 (27) -Fixes bug in GTextArea when text is cleared and the control has focus (Ticket 12) - -GTextArea now fires GEvent.ENTERED event when the Return / Enter key is typed (Ticket 11) - -Sliders and scrollbars now respond to the mouse wheel (Ticket 10) - - -V4.0.3 (26) -Scrollbars improved visually - -GButton controls now have rounded corners - -Bug fix for displaying prompt text in GTextField and GTextArea controls - -Methods added to GCScheme for setting, changing and saving colours and palettes (schemes) - -Fixes bug in getSnapshot - -saveSnapshot methods added. - - -V4.0.2 (25) -Bug fix for setFont(...) - -V4.0.1 (24) -Seamless support for use with Peasycam added. - -GWindow methods added: setVisible, getVisible, isVisible , setAlwaysOnTop, setLocation and getLocation - -Window closing code changed - - -V4.0 (23) -Major update for Processing V3, it will not work with previous versions of Processing. - -GPassord control no longer supports horizontal scroll bars, it didn't make sense use max password size instead. - -GTextField and GTextArea the deprecated methods setDefaultText and getDefaultText have been removed use set/getPromptText instead. - -Major overhaul of multiple window support. Now uses the factory pattern to get instances of GWindow i.e. window = GWindow.getWindow(...) instead of window = new GWindow(...) -No longer possible to create 'undecorated' frames. - - -V3.5.4 (22) -This is the last version of G4P to be compatible with Processing 2. All future versions will be for Processing 3. The source code is the same as 3.5.3 the changes are so that G4P plays nicely with PS3. - - -V3.5.3 (21) -Bug fixes errors when using GLabel in GWindow controls with GUI Builder - -V3.5.2 (20) -Bug fixes for GTextField and GTextArea controls. My thanks to kowalski5233 for not only finding and reporting the problems, but also in testing the bug fixes prior to this release. - - -V3.5.1 (19) -Fixes bug in GPanel constructor without text parameter - -Fixes bug that alters font metrics in text controls on first use of setText - -Fixes bug in GTextField and GTextArea gains focus from mouse press and the text is a single space it will be selected and so replaced on first keypress. - - -V3.5 (18) -New control for entering password (GPassword) - -Support for displaying UTF8 characters added to GTextField and GTextArea controls - -Improved text rendering for controls with transparent background i.e. labels, sliders, radio buttons and checkboxes. - -GGroup objects allow controls to be grouped for common tasks e.g. enabling, visibility, transparency and fading. Group actions can executed immediately to after a user defined delay. - -GTextField & GTextArea - the setDefaultText method has been deprecated in favour of the setPromptText to make its purpose clearer. - -GTextArea - addStyle(...) methods added to set the text style of part or all of a display line. - -GTextArea - insertText(...) methods added to insert text at a specified display line number/character position or at the current caret position. - -GTextArea - getCaretPos(...) methods added to retrieve the current caret position. - -GImageToggleButton - the stateValue methods have been deprecated in favour of setState(...) and getState() methods. - -GDropList - it is now possible to remove, insert and add items to the control at runtime. - -GLabel, GButtom, GOption and GCheckbox - new method setHeightToFit() to change the controls height so it just surrounds the text and icon. diff --git a/Processing/libraries/G4P/reference/allclasses-frame.html b/Processing/libraries/G4P/reference/allclasses-frame.html deleted file mode 100644 index 2e2be4d..0000000 --- a/Processing/libraries/G4P/reference/allclasses-frame.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - -All Classes (Javadocs: G4P) - - - - -

All Classes

- - - diff --git a/Processing/libraries/G4P/reference/allclasses-noframe.html b/Processing/libraries/G4P/reference/allclasses-noframe.html deleted file mode 100644 index 55a7b11..0000000 --- a/Processing/libraries/G4P/reference/allclasses-noframe.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - -All Classes (Javadocs: G4P) - - - - -

All Classes

- - - diff --git a/Processing/libraries/G4P/reference/constant-values.html b/Processing/libraries/G4P/reference/constant-values.html deleted file mode 100644 index 5e1abb3..0000000 --- a/Processing/libraries/G4P/reference/constant-values.html +++ /dev/null @@ -1,11303 +0,0 @@ - - - - - -Constant Field Values (Javadocs: G4P) - - - - - - - - - - -
-

Constant Field Values

-

Contents

- -
-
- - -

g4p_controls.*

-
    -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GAbstractControl 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GButton 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GCheckbox 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GConstants 
    Modifier and TypeConstant FieldValue
    - -public static final intALPHA_BLOCK128
    - -public static final intALPHA_PICK48
    - -public static final intBLUE_SCHEME6
    - -public static final intCANCEL2
    - -public static final intCLOSE_WINDOW3842
    - -public static final intCLOSED-1
    - -public static final intCTRL_ANGULAR1281
    - -public static final intCTRL_HORIZONTAL1282
    - -public static final intCTRL_VERTICAL1283
    - -public static final intCYAN_SCHEME5
    - -public static final intDECIMAL1
    - -public static final charEND35
    - -public static final intERROR0
    - -public static final intEXIT_APP3841
    - -public static final intEXPONENT2
    - -public static final intFORWARD1
    - -public static final intGOLD_SCHEME7
    - -public static final intGREEN_SCHEME1
    - -public static final charHOME36
    - -public static final intINFO1
    - -public static final intINTEGER0
    - -public static final intKEEP_OPEN3843
    - -public static final intNO1
    - -public static final intOK0
    - -public static final intOK_CANCEL2
    - -public static final intORANGE_SCHEME4
    - -public static final intORIENT_LEFT-1
    - -public static final intORIENT_RIGHT1
    - -public static final intORIENT_TRACK0
    - -public static final intPLAIN-1
    - -public static final intPURPLE_SCHEME3
    - -public static final intQUERY3
    - -public static final intRED_SCHEME0
    - -public static final intREVERSE-1
    - -public static final intSCHEME_1010
    - -public static final intSCHEME_1111
    - -public static final intSCHEME_1212
    - -public static final intSCHEME_1313
    - -public static final intSCHEME_1414
    - -public static final intSCHEME_1515
    - -public static final intSCHEME_88
    - -public static final intSCHEME_99
    - -public static final intSCROLLBARS_AUTOHIDE4096
    - -public static final intSCROLLBARS_BOTH3
    - -public static final intSCROLLBARS_HORIZONTAL_ONLY2
    - -public static final intSCROLLBARS_NONE0
    - -public static final intSCROLLBARS_VERTICAL_ONLY1
    - -public static final intUSER_COL_SCHEME65794
    - -public static final intWARNING2
    - -public static final intX41
    - -public static final intX82
    - -public static final intYELLOW_SCHEME2
    - -public static final intYES0
    - -public static final intYES_NO0
    - -public static final intYES_NO_CANCEL1
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GCustomSlider 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GDropList 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GEditableTextControl 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GGroup 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GImageButton 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GImageToggleButton 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GKnob 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GLabel 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GLinearTrackControl 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GOption 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GPanel 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GPassword 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GSketchPad 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GSlider 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GSlider2D 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GStick 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GTextAlign 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GTextArea 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GTextBase 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GTextField 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GTextIconAlignBase 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GTimer 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GToggleControl 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GValueControl 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GValueControl2D 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GWindow 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GWindowAWT 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GWindowImpl 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.GWindowNEWT 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final charEOL10
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    g4p_controls.StyledString 
    Modifier and TypeConstant FieldValue
    - -public static final intALL_METHOD31
    - -public static final intCLIP_RUN512
    - -public static final intCOMBI_MODES768
    - -public static final StringDEFAULT_SLIDER_STYLE"grey_blue"
    - -public static final intDRAG_CONTROL3
    - -public static final intDRAW_METHOD1
    - -public static final intEXCP_IN_HANDLER-16777211
    - -public static final intGROUP_CONTROL_METHOD11
    - -public static final floatHORZ_SCROLL_RATE4.0f
    - -public static final intI_CL4
    - -public static final intI_COVERED32
    - -public static final intI_CR8
    - -public static final intI_INSIDE16
    - -public static final intI_MODES63
    - -public static final intI_NONE0
    - -public static final intI_TL1
    - -public static final intI_TR2
    - -public static final intINVALID_PAPPLET-16777212
    - -public static final intINVALID_TYPE-16777213
    - -public static final intKEY_METHOD8
    - -public static final intMERGE_RUNS256
    - -public static final intMISSING-16777215
    - -public static final intMOUSE_METHOD2
    - -public static final intNONEXISTANT-16777214
    - -public static final intOFF_CONTROL0
    - -public static final intOVER_CONTROL1
    - -public static final intPOST_METHOD16
    - -public static final intPRE_METHOD4
    - -public static final intPRESS_CONTROL2
    - -public static final intSCROLLBAR_HORIZONTAL2
    - -public static final intSCROLLBAR_VERTICAL1
    - -public static final StringSLIDER_STYLES"|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"
    - -public static final intTINT_FOR_ALPHA255
    - -public static final intTPAD22
    - -public static final intTPAD44
    - -public static final intTPAD66
    - -public static final intTPAD88
    - -public static final floatVERT_SCROLL_RATE8.0f
    - -public static final floatWHEEL_DELTA0.009999999776482582f
    - -public static final floatWHEEL_STICK_FACTOR0.5099999904632568f
    - -public static final intZ_PANEL1024
    - -public static final intZ_SLIPPY24
    - -public static final intZ_SLIPPY_EXPANDS48
    - -public static final intZ_STICKY0
    -
  • -
-
- - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/deprecated-list.html b/Processing/libraries/G4P/reference/deprecated-list.html deleted file mode 100644 index efa6cf1..0000000 --- a/Processing/libraries/G4P/reference/deprecated-list.html +++ /dev/null @@ -1,151 +0,0 @@ - - - - - -Deprecated List (Javadocs: G4P) - - - - - - - -
- - - - - -
- - -
-

Deprecated API

-

Contents

- -
-
- - - -
- -
- - - - - -
- - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/Focusable.html b/Processing/libraries/G4P/reference/g4p_controls/Focusable.html deleted file mode 100644 index 283e0b7..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/Focusable.html +++ /dev/null @@ -1,211 +0,0 @@ - - - - - -Focusable (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Interface Focusable

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    GEditableTextControl, GPassword, GTextArea, GTextField
    -
    -
    -
    -
    public interface Focusable
    -
    Any text input control that can receive or lose focus when the tab key is typed must - implement this interface.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
-
    -
  • - - -
  • -
-
-
-
    -
  • - - -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/FontManager.html b/Processing/libraries/G4P/reference/g4p_controls/FontManager.html deleted file mode 100644 index 1fe47c0..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/FontManager.html +++ /dev/null @@ -1,294 +0,0 @@ - - - - - -FontManager (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class FontManager

-
-
- -
-
    -
  • -
    -
    -
    public class FontManager
    -extends Object
    -
    This class is used to access system fonts.
    - - Only basic functionality is available in 3.5 but will be extended hopefully :) - - Introduced v3.5
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      FontManager() 
      -
    • -
    - - -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        FontManager

        -
        public FontManager()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getPriorityFont

        -
        public static Font getPriorityFont(String[] familyFontNamnes,
        -                   int style,
        -                   int size)
        -
        Get a system font that matches one the font family names with the style and size. If - it can't find a suitable system font from the font family it returns a logical - font (Dialog) of the specified style and size.
        -
        Parameters:
        familyFontNamnes - user defined list of family font names or null to use default list
        style - Font.PLAIN, Font.BOLD, Font.Italic
        size - font size
        -
        Returns:
        a system font, or if none found a logical font
        -
      • -
      - - - -
        -
      • -

        getFont

        -
        public static Font getFont(String familyName,
        -           int style,
        -           int size)
        -
        Get a system font that matches the font family name, style and size. If - it can't find a system font from the font family it returns null.
        -
        Parameters:
        familyName - font family name e.g. "Arial", "Trebuchet MS" ...
        style - Font.PLAIN, Font.BOLD, Font.Italic
        size - font size
        -
        Returns:
        a system font from the specified family name, if not found returns null
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/G4P.html b/Processing/libraries/G4P/reference/g4p_controls/G4P.html deleted file mode 100644 index aed96c7..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/G4P.html +++ /dev/null @@ -1,924 +0,0 @@ - - - - - -G4P (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class G4P

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    GConstants, processing.core.PConstants
    -
    -
    -
    -
    public class G4P
    -extends Object
    -implements GConstants, processing.core.PConstants
    -
    The core class for the global manipulation and execution of G4P.
    - All the methods and constants are static so to call a method or - reference a constant prefix it's name with 'G4P.' for example
    -
    - G4P.method_name(parameters);
    - G4P.name_of_constant;
    - 

    - - Prior to version 3.5 G4P used logical fonts to be cross-platform, - unfortunately logical fonts do not use uniform metrics so it caused - serious errors when formatting the text layout. In version 3.5 G4P - will attempt to use a system fonts selected from this list
    - "Arial", "Trebuchet MS", "Tahoma", "Helvetica", "Verdana"
    - - Arial is the preferred font (since most systems will have it installed) - but if not found it will attempt to use the next one in the list. If - the list is exhausted and no matching system font found it will use - a logical font.
    - If this causes a problem with older sketches simple call
    -
    - G4P.usePre35Fonts();
    - 
    - before you create any GUI controls.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        G4P

        -
        public G4P()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getPrettyVersion

        -
        public static String getPrettyVersion()
        -
        return the pretty version of the library.
        -
      • -
      - - - -
        -
      • -

        getVersion

        -
        public static String getVersion()
        -
        return the version of the library used by Processing
        -
      • -
      - - - -
        -
      • -

        registerSketch

        -
        public static void registerSketch(processing.core.PApplet app)
        -
        Used to register the main sketch window with G4P. This is ignored if any - G4P controls or windows have already been created because the act of - creating a control will do this for you.
        - - Some controls are created without passing a reference to the sketch applet - but still need to know it. An example is the GColorChooser control which - cannot be used until this method is called or some other G4P control has - been created. - - Also some other libraries such as PeasyCam change the transformation matrix. - In which case either a G4P control should be created or this method called - before creating a PeasyCam object.
        -
        Parameters:
        app -
        -
      • -
      - - - -
        -
      • -

        setGlobalColorScheme

        -
        public static void setGlobalColorScheme(int cs)
        -
        Set the global colour scheme. This will change the local - colour scheme for every control.
        -
        Parameters:
        cs - colour scheme to use (0-15)
        -
      • -
      - - - -
        -
      • -

        usePre35Fonts

        -
        public static void usePre35Fonts()
        -
        Versions of G4P prior to 3.5 used logical fonts for the controls. So if you - have old sketches then the text may look different with this and later versions - of G4P.
        - If this is causing a problem then call this method before creating any controls.
        -
      • -
      - - - -
        -
      • -

        setWindowColorScheme

        -
        public static void setWindowColorScheme(processing.core.PApplet app,
        -                        int cs)
        -
        Set the colour scheme for all the controls drawn by the given - PApplet. This will override any previous colour scheme for - these controls.
        -
        Parameters:
        app -
        cs -
        -
      • -
      - - - -
        -
      • -

        setGlobalAlpha

        -
        public static void setGlobalAlpha(int alpha)
        -
        Set the transparency of all controls. If the alpha level for a - control falls below G4P.ALPHA_BLOCK then it will no longer - respond to mouse and keyboard events.
        -
        Parameters:
        alpha - value in the range 0 (transparent) to 255 (opaque)
        -
      • -
      - - - -
        -
      • -

        setWindowAlpha

        -
        public static void setWindowAlpha(processing.core.PApplet app,
        -                  int alpha)
        -
        Set the transparency level for all controls drawn by the given - PApplet. If the alpha level for a control falls below - G4P.ALPHA_BLOCK then it will no longer respond to mouse - and keyboard events.
        -
        Parameters:
        app -
        alpha - value in the range 0 (transparent) to 255 (opaque)
        -
      • -
      - - - -
        -
      • -

        setCtrlMode

        -
        public static void setCtrlMode(GControlMode mode)
        -
        Change the way position and size parameters are interpreted when a control is created. - or added to another control e.g. GPanel.
        - There are 3 modes.
        - PApplet.CORNER  (x, y, w, h) 
        - PApplet.CORNERS (x0, y0, x1, y1)
        - PApplet.CENTER (cx, cy, w, h)

        -
        Parameters:
        mode - illegal values are ignored leaving the mode unchanged
        -
      • -
      - - - -
        -
      • -

        getCtrlMode

        -
        public static GControlMode getCtrlMode()
        -
        Get the control creation mode @see ctrlMode(int mode)
        -
        Returns:
        the current control mode
        -
      • -
      - - - -
        -
      • -

        messagesEnabled

        -
        public static void messagesEnabled(boolean enable)
        -
        G4P has a range of support messages eg
        if you create a GUI component - without an event handler or,
        a slider where the visible size of the - slider is less than the difference between min and max values.
        - - This method allows the user to enable (default) or disable this option. If - disable then it should be called before any GUI components are created.
        - - If you are adding your own event handlers then I suggest that you disable - messages.
        -
        Parameters:
        enable -
        -
      • -
      - - - -
        -
      • -

        setMouseOverEnabled

        -
        public static void setMouseOverEnabled(boolean enable)
        -
        Enables or disables cursor over component change.
        - - Calls to this method are ignored if no G4P controls have been created.
        -
        Parameters:
        enable - true to enable cursor change over components.
        -
      • -
      - - - -
        -
      • -

        mouseWheelForSlider

        -
        public static void mouseWheelForSlider(int dir)
        -
        Determines how the direction of the mouse wheel rotation is interpreted - for sliders. This value applies to all sliders.
        - The default value is FORWARD
        -
        Parameters:
        dir - FORWARD or REVERSE, illegal values are ignored
        -
      • -
      - - - -
        -
      • -

        mouseWheelForScrollbar

        -
        public static void mouseWheelForScrollbar(int dir)
        -
        Determines how the direction of the mouse wheel rotation is interpreted - for sliders. This value applies to all sliders.
        - The default value is FORWARD
        -
        Parameters:
        dir - FORWARD or REVERSE, illegal values are ignored
        -
      • -
      - - - -
        -
      • -

        setCursorOff

        -
        @Deprecated
        -public static void setCursorOff(int cursorOff)
        -
        Deprecated. use setCursor(int)
        -
      • -
      - - - -
        -
      • -

        setCursor

        -
        public static void setCursor(int cursorOff)
        -
        Set the cursor shape to be used when the mouse is not over a - G4P control for the entire application including secondary - windows.
        -
        Parameters:
        cursorOff - the cursor shape.
        -
      • -
      - - - -
        -
      • -

        getCursor

        -
        public static int getCursor()
        -
        Get the cursor shape used when the mouse is not over a G4P - control - set for the
        -
      • -
      - - - -
        -
      • -

        getCursorOff

        -
        @Deprecated
        -public static int getCursorOff()
        -
        Deprecated. use getCursor()
        -
      • -
      - - - -
        -
      • -

        getOpenWindowsAsList

        -
        public static ArrayList<GWindow> getOpenWindowsAsList(ArrayList<GWindow> list)
        -
        Get a list of all open GWindow objects even if minimised or invisible.
        - If an ArrayList is provided then its contents are cleared before adding references - to all open GWindow objects. If an ArrayList is not provided then a new - ArrayList will be created.
        - This method never returns null, if there are no open windows the list will - be of size zero.
        -
        Parameters:
        list - an optional ArrayList to use. In null will create a new ArrayList.
        -
        Returns:
        an ArrayList of references to all open GWindow objects.
        -
      • -
      - - - -
        -
      • -

        getOpenWindowsAsArray

        -
        public static GWindow[] getOpenWindowsAsArray()
        -
        Get an array of GWindow objects even if minimised or invisible.
        - This method never returns null, if there are no open windows the array - will be of length zero.
        -
        Returns:
        an array of references to all open GWindow objects.
        -
      • -
      - - - -
        -
      • -

        isWindowOpen

        -
        public static boolean isWindowOpen(GWindow window)
        -
        Use this to check whether a GWindow window is still open (as far as G4P is concerned).
        -
        Parameters:
        window - the window we are interested in
        -
        Returns:
        true if G4P still thinks it is open
        -
      • -
      - - - -
        -
      • -

        selectColor

        -
        public static int selectColor()
        -
        This will open a version of the Java Swing color chooser dialog. The dialog's - UI is dependent on the OS and JVM implementation running.
        - - If you click on Cancel then it returns the last color previously selected.
        -
        Returns:
        the ARGB colour as a 32 bit integer (as used in Processing).
        -
      • -
      - - - -
        -
      • -

        selectFolder

        -
        public static String selectFolder(String prompt)
        -
        Select a folder from the local file system.
        -
        Parameters:
        prompt - the frame text for the chooser
        -
        Returns:
        the absolute path name for the selected folder, or null if action - cancelled.
        -
      • -
      - - - -
        -
      • -

        selectInput

        -
        public static String selectInput(String prompt)
        -
        Select a file for input from the local file system.
        -
        Parameters:
        prompt - the frame text for the chooser
        -
        Returns:
        the absolute path name for the selected folder, or null if action - cancelled.
        -
      • -
      - - - -
        -
      • -

        selectInput

        -
        public static String selectInput(String prompt,
        -                 String types,
        -                 String typeDesc)
        -
        Select a file for input from the local file system.
        - - This version allows the dialog window to filter the output based on file extensions. - This is not available on all platforms, if not then it is ignored.
        - - It is definitely available on Linux systems because it uses the standard Swing - JFileFinder component.
        -
        Parameters:
        prompt - the frame text for the chooser
        types - a comma separated list of file extensions e.g. "png,gif,jpg,jpeg"
        typeDesc - simple textual description of the file types e.g. "Image files"
        -
        Returns:
        the absolute path name for the selected folder, or null if action - cancelled.
        -
      • -
      - - - -
        -
      • -

        selectOutput

        -
        public static String selectOutput(String prompt)
        -
        Select a file for output from the local file system.
        -
        Parameters:
        prompt - the frame text for the chooser
        -
        Returns:
        the absolute path name for the selected folder, or null if action is cancelled.
        -
      • -
      - - - -
        -
      • -

        selectOutput

        -
        public static String selectOutput(String prompt,
        -                  String types,
        -                  String typeDesc)
        -
        Select a file for output from the local file system.
        - - This version allows the dialog window to filter the output based on file extensions. - This is not available on all platforms, if not then it is ignored.
        - - It is definitely available on Linux systems because it uses the standard swing - JFileFinder component.
        -
        Parameters:
        prompt - the frame text for the chooser
        types - a comma separated list of file extensions e.g. "png,jpf,tiff"
        typeDesc - simple textual description of the file types e.g. "Image files"
        -
        Returns:
        the absolute path name for the selected folder, or null if action - cancelled.
        -
      • -
      - - - -
        -
      • -

        showMessage

        -
        public static void showMessage(processing.core.PApplet owner,
        -               String message,
        -               String title,
        -               int messageType)
        -
        Display a simple message dialog window.
        - - The actual UI will depend on the platform your application is running on.
        - - The message type should be one of the following
        - G4P.PLAIN, G4P.ERROR, G4P.INFO, G4P.WARNING, G4P.QUERY
        -
        Parameters:
        owner - the control responsible for this dialog.
        message - the text to be displayed in the main area of the dialog
        title - the text to appear in the dialog's title bar.
        messageType - the message type
        -
      • -
      - - - -
        -
      • -

        selectOption

        -
        public static int selectOption(processing.core.PApplet owner,
        -               String message,
        -               String title,
        -               int messageType,
        -               int optionType)
        -
        Display a simple message dialog window.
        - - The actual UI will depend on the platform your application is running on.
        - - The message type should be one of the following
        - G4P.PLAIN, G4P.ERROR, G4P.INFO, G4P.WARNING, G4P.QUERY
        - - The option type should be one of the following
        - G4P.YES_NO, G4P.YES_NO_CANCEL, G4P.OK_CANCEL
        - - This method returns a value to indicate which button was clicked. It will be - one of the following
        - G4P.OK, G4P.YES, G4P.NO, G4P.CANCEL, G4P.CLOSED
        - - Some comments on the returned value:
          -
        • G4P.OK and G4P.YES have the same integer value so can be used interchangeably.
        • -
        • G4P.CLOSED maybe returned if the dialog box is closed although on some - systems G4P.NO or G4P.CANCEL may be returned instead.
        • -
        • It is better to test for a positive response because they have the same value.
        • -
        • If you must test for a negative response use !G4P.OK or !G4P.YES
        -
        Parameters:
        owner - the control responsible for this dialog.
        message - the text to be displayed in the main area of the dialog
        title - the text to appear in the dialog's title bar.
        messageType - the message type
        optionType -
        -
        Returns:
        which button was clicked
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GAbstractControl.Z_Order.html b/Processing/libraries/G4P/reference/g4p_controls/GAbstractControl.Z_Order.html deleted file mode 100644 index e169b2e..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GAbstractControl.Z_Order.html +++ /dev/null @@ -1,278 +0,0 @@ - - - - - -GAbstractControl.Z_Order (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GAbstractControl.Z_Order

-
-
- -
- -
-
- -
-
- -
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GAbstractControl.html b/Processing/libraries/G4P/reference/g4p_controls/GAbstractControl.html deleted file mode 100644 index 1a91c35..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GAbstractControl.html +++ /dev/null @@ -1,1951 +0,0 @@ - - - - - -GAbstractControl (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GAbstractControl

-
-
- -
- -
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        GAbstractControl

        -
        public GAbstractControl(processing.core.PApplet theApplet)
        -
        Base constructor for ALL control ctors that do not have a visible UI but require - access to a PApplet object.
        - As of V3.5 the only class using this constructor is GGroup
        -
        Parameters:
        theApplet -
        -
      • -
      - - - -
        -
      • -

        GAbstractControl

        -
        public GAbstractControl(processing.core.PApplet theApplet,
        -                float p0,
        -                float p1)
        -
        Base constructor for ALL control ctors that have a visible UI but whose width and height - are determined elsewhere e.g. the size of an image. It will set the - position of the control based on controlMode.
        -
      • -
      - - - -
        -
      • -

        GAbstractControl

        -
        public GAbstractControl(processing.core.PApplet theApplet,
        -                float p0,
        -                float p1,
        -                float p2,
        -                float p3)
        -
        Base constructor for ALL control ctors that have a visible UI. It will set the - position and size of the control based on controlMode.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        draw

        -
        public void draw()
        -
      • -
      - - - -
        -
      • -

        mouseEvent

        -
        public void mouseEvent(processing.event.MouseEvent event)
        -
      • -
      - - - -
        -
      • -

        keyEvent

        -
        public void keyEvent(processing.event.KeyEvent e)
        -
      • -
      - - - -
        -
      • -

        pre

        -
        public void pre()
        -
      • -
      - - - -
        -
      • -

        post

        -
        public void post()
        -
      • -
      - - - -
        -
      • -

        dispose

        -
        public void dispose()
        -
        This will remove all references to this control in the library.
        - The user is responsible for nullifying all references to this control - in their sketch code.
        - Once this method is called the control cannot be reused but resources - used by the control remain until all references to the control are - set to null.
        -
      • -
      - - - -
        -
      • -

        forceBufferUpdate

        -
        public void forceBufferUpdate()
        -
        This is for emergency use only!!!!
        - In this version of the library a visual controls is drawn to off-screen buffer - and then drawn to the screen by copying the buffer. This means that the - computationally expensive routines needed to draw the control (especially text - controls) are only done when a change has been noted. This means that single - changes need not trigger a full redraw to buffer.
        - It does mean that an error in the library code could result in the buffer not - being updated after changes. If this happens then in draw() call this method - on the affected control, and report it as an issue - here
        - Thanks
        -
      • -
      - - - -
        -
      • -

        isOver

        -
        public boolean isOver(float x,
        -             float y)
        -
        Determines if a particular pixel position is over the panel.
        -
        Returns:
        true if the position is over.
        -
      • -
      - - - -
        -
      • -

        setLocalColor

        -
        public void setLocalColor(int colorNo,
        -                 int color)
        -
        Change a specific colour within the scheme.
        - Most controls used a shared colour palette but calling this method - will create a new palette specific for this control.
        -
        Parameters:
        colorNo - the colour index value (0-15 inlc)
        color - ARGB color value
        -
      • -
      - - - -
        -
      • -

        setLocalColorScheme

        -
        public void setLocalColorScheme(int cs)
        -
        Set the local colour scheme for this control. Children are ignored.
        -
        Parameters:
        cs - the colour scheme to use (0-15 incl.)
        -
      • -
      - - - -
        -
      • -

        setLocalColorScheme

        -
        public void setLocalColorScheme(int cs,
        -                       boolean includeChildren)
        -
        Set the local colour scheme for this control. - If required include the children and their children.
        -
        Parameters:
        cs - the colour scheme to use (0-15 incl.)
        includeChildren - if do do the same for all descendants
        -
      • -
      - - - -
        -
      • -

        getLocalColorScheme

        -
        public int getLocalColorScheme()
        -
        Get the local color scheme ID number. If it returns a value <0 then - it is using a control specific palette.
        -
      • -
      - - - -
        -
      • -

        setAlpha

        -
        public void setAlpha(int alpha)
        -
        Set the transparency of the component and make it unavailable to - mouse and keyboard events if below the threshold. Child controls - are ignored?
        -
        Parameters:
        alpha - value in the range 0 (transparent) to 255 (opaque)
        -
      • -
      - - - -
        -
      • -

        setAlpha

        -
        public void setAlpha(int alpha,
        -            boolean includeChildren)
        -
        Set the transparency of the component and make it unavailable to - mouse and keyboard events if below the threshold. Child controls - are ignored?
        - If required include the children and their children.
        -
        Parameters:
        alpha - value in the range 0 (transparent) to 255 (opaque)
        includeChildren - if do do the same for all descendants
        -
      • -
      - - - -
        -
      • -

        getParent

        -
        public GAbstractControl getParent()
        -
        Get the parent control. If null then this is a top-level component
        -
      • -
      - - - -
        -
      • -

        getPApplet

        -
        public processing.core.PApplet getPApplet()
        -
        Get the PApplet that manages this component
        -
      • -
      - - - -
        -
      • -

        getSnapshot

        -
        public processing.core.PGraphics getSnapshot()
        -
        This method should be used sparingly since it is heavy on resources.
        -
        Returns:
        a PGraphics object showing current state of the control (ignoring rotation)
        -
      • -
      - - - -
        -
      • -

        saveSnapshot

        -
        public boolean saveSnapshot()
        -
        Save a snapshot of the control using class name and sketch runtime as the filename
        -
        Returns:
        true if the snapshot was saved else return false
        -
      • -
      - - - -
        -
      • -

        saveSnapshot

        -
        public boolean saveSnapshot(String filename)
        -
        Save a snapshot of the control using the specified filename
        -
        Returns:
        true if the snapshot was saved else return false
        -
      • -
      - - - -
        -
      • -

        addEventHandler

        -
        public void addEventHandler(Object obj,
        -                   String methodName)
        -
        Attempt to create the default event handler for the component class. - The default event handler is a method that returns void and has a single - parameter of the same type as the component class generating the - event and a method name specific for that class.
        -
        Parameters:
        obj - the object to handle the event
        methodName - the method to execute in the object handler class
        -
      • -
      - - - -
        -
      • -

        setRotation

        -
        public void setRotation(float angle)
        -
        Set the rotation to apply when displaying this control. The center of - rotation is determined by the control_mode attribute.
        -
        Parameters:
        angle - clockwise angle in radians
        -
      • -
      - - - -
        -
      • -

        setRotation

        -
        public void setRotation(float angle,
        -               GControlMode mode)
        -
        Set the rotation to apply when displaying this control. The center of - rotation is determined by the mode parameter parameter.
        -
        Parameters:
        angle - clockwise angle in radians
        mode - PApplet.CORNER / CORNERS / CENTER
        -
      • -
      - - - -
        -
      • -

        moveTo

        -
        public void moveTo(float px,
        -          float py)
        -
        Move the control to the given position based on the mode.
        - - The position is not constrained to the screen area.
        - - The current control mode determines whether we move the - corner or the center of the control to px,py
        -
        Parameters:
        px - the horizontal position to move to
        py - the vertical position to move to
        -
      • -
      - - - -
        -
      • -

        moveTo

        -
        public void moveTo(float px,
        -          float py,
        -          GControlMode mode)
        -
        Move the control to the given position based on the mode.
        - - Unlike when dragged the position is not constrained to the - screen area.
        - - The mode determines whether we move the corner or the center - of the control to px,py
        -
        Parameters:
        px - the horizontal position to move to
        py - the vertical position to move to
        mode - the control mode
        -
      • -
      - - - -
        -
      • -

        getX

        -
        public float getX()
        -
        Get the left position of the control.
        - If the control is on a panel then the value returned is relative to the - top-left corner of the panel otherwise it is relative to the sketch - window display.
        -
      • -
      - - - -
        -
      • -

        getY

        -
        public float getY()
        -
        Get the top position of the control.
        - If the control is on a panel then the value returned is relative to the - top-left corner of the panel otherwise it is relative to the sketch - window display.
        -
      • -
      - - - -
        -
      • -

        getCX

        -
        public float getCX()
        -
        Get the centre x position of the control.
        - If the control is on a panel then the value returned is relative to the - top-left corner of the panel otherwise it is relative to the sketch - window display.
        -
      • -
      - - - -
        -
      • -

        getCY

        -
        public float getCY()
        -
        Get the centre y position of the control.
        - If the control is on a panel then the value returned is relative to the - top-left corner of the panel otherwise it is relative to the sketch - window display.
        -
      • -
      - - - -
        -
      • -

        getWidth

        -
        public float getWidth()
        -
        Returns:
        the width
        -
      • -
      - - - -
        -
      • -

        getHeight

        -
        public float getHeight()
        -
        Returns:
        the height
        -
      • -
      - - - -
        -
      • -

        setVisible

        -
        public void setVisible(boolean visible)
        -
        Parameters:
        visible - the visibility to set
        -
      • -
      - - - -
        -
      • -

        isVisible

        -
        public boolean isVisible()
        -
        Returns:
        the component's visibility
        -
      • -
      - - - -
        -
      • -

        setOpaque

        -
        public void setOpaque(boolean opaque)
        -
        Determines whether to show the back colour or not. - Only applies to some components
        -
        Parameters:
        opaque -
        -
      • -
      - - - -
        -
      • -

        isOpaque

        -
        public boolean isOpaque()
        -
        Find out if the component is opaque
        -
        Returns:
        true if the background is visible
        -
      • -
      - - - -
        -
      • -

        isDragging

        -
        public boolean isDragging()
        -
      • -
      - - - -
        -
      • -

        setEnabled

        -
        public void setEnabled(boolean enable)
        -
        Enable or disable the ability of the component to generate mouse events.
        - GTextField - it also controls key press events
        - GPanel - controls whether the panel can be moved/collapsed/expanded
        -
        Parameters:
        enable - true to enable else false
        -
      • -
      - - - -
        -
      • -

        isEnabled

        -
        public boolean isEnabled()
        -
        Is this component enabled
        -
        Returns:
        true if the component is enabled
        -
      • -
      - - - -
        -
      • -

        setFocus

        -
        public void setFocus(boolean focus)
        -
        Determines whether this component is to have focus or not
        -
        Parameters:
        focus -
        -
      • -
      - - - -
        -
      • -

        hasFocus

        -
        public boolean hasFocus()
        -
        Does this component have focus
        -
        Returns:
        true if this component has focus else false
        -
      • -
      - - - -
        -
      • -

        addControl

        -
        public void addControl(GAbstractControl c,
        -              float x,
        -              float y,
        -              float angle)
        -
        This will set the rotation of the control to angle overwriting - any previous rotation set. Then it calculates the centre position - so that the original top left corner of the control will be the - position indicated by x,y with respect to the top left corner of - parent.
        - - The added control will have its position calculated relative to the - centre of the parent control.
        - - All overloaded methods call this one.
        -
        Parameters:
        c - the control to add.
        x - the leftmost or centre position depending on controlMode
        y - the topmost or centre position depending on controlMode
        angle - the rotation angle (replaces any the angle specified in control)
        -
      • -
      - - - -
        -
      • -

        addControl

        -
        public void addControl(GAbstractControl c,
        -              float x,
        -              float y)
        -
        Add a control at the given position with zero rotation angle.
        -
        Parameters:
        c - the control to add.
        x - the leftmost or centre position depending on controlMode
        y - the topmost or centre position depending on controlMode
        -
      • -
      - - - -
        -
      • -

        addControl

        -
        public void addControl(GAbstractControl c)
        -
        Add a control at the position and rotation specified in the control.
        -
        Parameters:
        c - the control to add
        -
      • -
      - - - -
        -
      • -

        addControls

        -
        public void addControls(GAbstractControl... controls)
        -
        Add several control at the position and rotation specified in each control.
        -
        Parameters:
        controls - comma separated list of controls
        -
      • -
      - - - -
        -
      • -

        getCursorOver

        -
        public int getCursorOver()
        -
        Get the shape type when the cursor is over a control
        -
        Returns:
        shape type
        -
      • -
      - - - -
        -
      • -

        setCursorOver

        -
        public void setCursorOver(int cursorOver)
        -
        Set the shape type to use when the cursor is over a control
        -
        Parameters:
        cursorOver - the shape type to use
        -
      • -
      - - - -
        -
      • -

        markForDisposal

        -
        public void markForDisposal()
        -
        If the control is permanently no longer required then call - this method to remove it and free up resources.
        - The variable identifier used to create this control should - be set to null.
        - For example if you want to dispose of a button called -
        btnDoThis
        then to remove the button use the - statements
        - btnDoThis.dispose(); 
        - btnDoThis = null;
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GAlign.html b/Processing/libraries/G4P/reference/g4p_controls/GAlign.html deleted file mode 100644 index bb0c6f5..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GAlign.html +++ /dev/null @@ -1,533 +0,0 @@ - - - - - -GAlign (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Enum GAlign

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Serializable, Comparable<GAlign>
    -
    -
    -
    -
    public enum GAlign
    -extends Enum<GAlign>
    -
    This class provides an enumeration that is used to control the alignment - of text and images.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Enum Constant Detail

      - - - -
        -
      • -

        INVALID

        -
        public static final GAlign INVALID
        -
      • -
      - - - -
        -
      • -

        LEFT

        -
        public static final GAlign LEFT
        -
      • -
      - - - -
        -
      • -

        CENTER

        -
        public static final GAlign CENTER
        -
      • -
      - - - -
        -
      • -

        RIGHT

        -
        public static final GAlign RIGHT
        -
      • -
      - - - -
        -
      • -

        JUSTIFY

        -
        public static final GAlign JUSTIFY
        -
      • -
      - - - -
        -
      • -

        TOP

        -
        public static final GAlign TOP
        -
      • -
      - - - -
        -
      • -

        MIDDLE

        -
        public static final GAlign MIDDLE
        -
      • -
      - - - -
        -
      • -

        BOTTOM

        -
        public static final GAlign BOTTOM
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        values

        -
        public static GAlign[] values()
        -
        Returns an array containing the constants of this enum type, in -the order they are declared. This method may be used to iterate -over the constants as follows: -
        -for (GAlign c : GAlign.values())
        -    System.out.println(c);
        -
        -
        Returns:
        an array containing the constants of this enum type, in -the order they are declared
        -
      • -
      - - - -
        -
      • -

        valueOf

        -
        public static GAlign valueOf(String name)
        -
        Returns the enum constant of this type with the specified name. -The string must match exactly an identifier used to declare an -enum constant in this type. (Extraneous whitespace characters are -not permitted.)
        -
        Parameters:
        name - the name of the enum constant to be returned.
        -
        Returns:
        the enum constant with the specified name
        -
        Throws:
        -
        IllegalArgumentException - if this enum type has no constant -with the specified name
        -
        NullPointerException - if the argument is null
        -
      • -
      - - - -
        -
      • -

        getFromID

        -
        public static GAlign getFromID(int id)
        -
        Get an alignment based on its ID number.
        -
        Parameters:
        id - the id number for this alignment.
        -
        Returns:
        the alignment or INVALID if not found
        -
      • -
      - - - -
        -
      • -

        getFromText

        -
        public static GAlign getFromText(String text)
        -
        Get an alignment based on its alignment text.
        -
        Parameters:
        text - the alignment text.
        -
        Returns:
        the alignment or INVALID if not found
        -
      • -
      - - - -
        -
      • -

        getID

        -
        public int getID()
        -
        Get the id number associated with this alignment
        -
        Returns:
        the ID associated with this alignment
        -
      • -
      - - - -
        -
      • -

        getTextID

        -
        public String getTextID()
        -
        Get the text ID associated with this alignment.
        -
        Returns:
        alignment text e.g. "RIGHT"
        -
      • -
      - - - -
        -
      • -

        getDesc

        -
        public String getDesc()
        -
        Get the description of this alignment
        -
        Returns:
        e.g. "Align top"
        -
      • -
      - - - -
        -
      • -

        isHorzAlign

        -
        public boolean isHorzAlign()
        -
        Is this a horizontal alignment constant?
        -
      • -
      - - - -
        -
      • -

        isVertAlign

        -
        public boolean isVertAlign()
        -
        Is this a vertical alignment constant?
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GButton.html b/Processing/libraries/G4P/reference/g4p_controls/GButton.html deleted file mode 100644 index c2268b5..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GButton.html +++ /dev/null @@ -1,1206 +0,0 @@ - - - - - -GButton (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GButton

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    GConstants, processing.core.PConstants
    -
    -
    -
    -
    public class GButton
    -extends GTextIconAlignBase
    -
    This class is the Button component. - - The button face can have either text or an image or both just - pick the right constructor. - - Three types of event can be generated :-
    - PRESSED RELEASED CLICKED
    - - To simplify event handling the button only fires off CLICKED events - if the mouse button is pressed and released over the button face - (the default behaviour).
    - - Using
    button1.fireAllEvents(true);
    enables the other 2 events - for button button1. A PRESSED event is created if the mouse button - is pressed down over the button face, the CLICKED event is then generated - if the mouse button is released over the button face. Releasing the - button off the button face creates a RELEASED event.
    - - The image file can either be a single image which is used for - all button states, or be a composite of 3 images (tiled horizontally) - which are used for the different button states OFF, OVER and DOWN - in which case the image width should be divisible by 3.
    - A number of setImages(...) methods exist to set button state images, these - can be used once the button is created.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
- -
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GCScheme.html b/Processing/libraries/G4P/reference/g4p_controls/GCScheme.html deleted file mode 100644 index 3cb9fc8..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GCScheme.html +++ /dev/null @@ -1,461 +0,0 @@ - - - - - -GCScheme (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GCScheme

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    GConstants, processing.core.PConstants
    -
    -
    -
    -
    public class GCScheme
    -extends Object
    -implements GConstants, processing.core.PConstants
    -
    Defines a number of color schemes for the GUI components.
    - G4P supports 16 colour schemes and each scheme has a palette of 16 colours.
    - - When G4P is used it loads an image file with all the colors used by the various colour schemes.
    - First it will search for a file containing a user defined scheme (user_gui_palette.png) and - if it can't find it, will use the library default scheme (default_gui_palette.png).
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        GCScheme

        -
        public GCScheme()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getPalette

        -
        public static int[] getPalette(int schemeNbr)
        -
        Set the color scheme to one of the preset schemes - BLUE / GREEN / RED / PURPLE / YELLOW / CYAN / BROWN - or if you have created your own schemes following the instructions - at gui4processing.lagers.org.uk/colorscheme.html then you can enter - the appropriate numeric value of the scheme.
        -
        Parameters:
        schemeNbr - scheme number (0-15)
        -
        Returns:
        the color scheme based on the scheme number
        -
      • -
      - - - -
        -
      • -

        changePalette

        -
        public static void changePalette(int schemeNbr,
        -                 int[] colors)
        -
        Change a colour scheme to use the colours passed in the third parameter.
        - Colour scheme numbers 0-7 inclusive are the default colour schemes and - schemes 8-15 inclusive are undefined by G4P.
        - This method will override the previous scheme and will affect all controls - using the scheme.
        -
        Parameters:
        schemeNbr - the scheme number
        colors - the colours to use in this palette.
        -
      • -
      - - - -
        -
      • -

        copyPalette

        -
        public static void copyPalette(int srcSchemeNbr,
        -               int dstSchemeNbr)
        -
        Copies the colours from the source scheme to the destination scheme.
        -
        Parameters:
        srcSchemeNbr - source scheme number (0-15)
        dstSchemeNbr - destination scheme number (0-15)
        -
      • -
      - - - -
        -
      • -

        changePaletteColor

        -
        public static void changePaletteColor(int schemeNbr,
        -                      int colorNbr,
        -                      int color)
        -
        Change a single colour within an existing scheme
        -
        Parameters:
        schemeNbr - the scheme number
        colorNbr - the palette index number for the colour
        color - ARGB colour value
        -
      • -
      - - - -
        -
      • -

        savePalettes

        -
        public static void savePalettes(processing.core.PApplet app)
        -
        Save the current colour schemes as an image in the sketch's data folder. The file will be - called
        "user_gui_palette.png"
        -
        Parameters:
        app - the PApplet object
        -
      • -
      - - - -
        -
      • -

        savePalettes

        -
        public static void savePalettes(processing.core.PApplet app,
        -                String filename)
        -
        Save the current colour schemes as an image in the sketch's data folder.
        -
        Parameters:
        app - the PApplet object
        filename - the name of the image file to use
        -
      • -
      - - - -
        -
      • -

        makeColorSchemes

        -
        public static void makeColorSchemes(processing.core.PApplet app)
        -
        Called every time we create a control. The palettes will be made when - the first control is created. - - This method is called by
        -
        Parameters:
        app - the PApplet using this scheme
        -
      • -
      - - - -
        -
      • -

        getJavaColor

        -
        public static Color[] getJavaColor(int schemeNo)
        -
        DO NOT CALL THIS METHOD
        - - This method is only to be used by GUI Builder.
        -
      • -
      - - - -
        -
      • -

        makeColorSchemes

        -
        public static void makeColorSchemes()
        -
        DO NOT CALL THIS METHOD
        - - This method is only to be used by GUI Builder.
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GCheckbox.html b/Processing/libraries/G4P/reference/g4p_controls/GCheckbox.html deleted file mode 100644 index dca377a..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GCheckbox.html +++ /dev/null @@ -1,1087 +0,0 @@ - - - - - -GCheckbox (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GCheckbox

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    GConstants, processing.core.PConstants
    -
    -
    -
    -
    public class GCheckbox
    -extends GToggleControl
    -
    A two-state toggle control.
    - - GCheckbox objects (also known as tick boxes) are two-state toggle switches that are - used independently of other tick boxes.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
- -
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GClip.html b/Processing/libraries/G4P/reference/g4p_controls/GClip.html deleted file mode 100644 index 9ccd1ac..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GClip.html +++ /dev/null @@ -1,273 +0,0 @@ - - - - - -GClip (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GClip

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    ClipboardOwner
    -
    -
    -
    -
    public class GClip
    -extends Object
    -implements ClipboardOwner
    -
    Clipboard functionaliy for plain text
    - - This provides clipboard functionality for text and is currently only used by the - GTextField and GTextArea classes.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        copy

        -
        public static boolean copy(String chars)
        -
        Copy a string to the clipboard
        -
        Parameters:
        chars -
        -
      • -
      - - - -
        -
      • -

        paste

        -
        public static String paste()
        -
        Get a string from the clipboard
        -
        Returns:
        the string on the clipboard
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GConstants.html b/Processing/libraries/G4P/reference/g4p_controls/GConstants.html deleted file mode 100644 index de2ec3f..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GConstants.html +++ /dev/null @@ -1,1398 +0,0 @@ - - - - - -GConstants (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Interface GConstants

-
-
- -
- -
-
- -
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GControlMode.html b/Processing/libraries/G4P/reference/g4p_controls/GControlMode.html deleted file mode 100644 index 5ee70d6..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GControlMode.html +++ /dev/null @@ -1,417 +0,0 @@ - - - - - -GControlMode (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Enum GControlMode

-
-
- -
- -
-
-
    -
  • - -
      -
    • - - -

      Enum Constant Summary

      - - - - - - - - - - - - - - -
      Enum Constants 
      Enum Constant and Description
      CENTER 
      CORNER 
      CORNERS 
      -
    • -
    - -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeField and Description
      Stringdescription 
      intmode 
      Stringps_name 
      -
        -
      • - - -

        Fields inherited from interface processing.core.PConstants

        -ADD, ALPHA, ALT, AMBIENT, ARC, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BEZIER_VERTEX, BLEND, BLUR, BOTTOM, BOX, BREAK, BURN, CENTER, CHATTER, CHORD, CLAMP, CLOSE, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CURVE_VERTEX, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ASYNC_SAVEFRAME, DISABLE_BUFFER_READING, DISABLE_DEPTH_MASK, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_KEY_REPEAT, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERRORS, DISABLE_OPTIMIZED_STROKE, DISABLE_STROKE_PERSPECTIVE, DISABLE_STROKE_PURE, DISABLE_TEXTURE_MIPMAPS, DODGE, DOWN, DXF, ELLIPSE, ENABLE_ASYNC_SAVEFRAME, ENABLE_BUFFER_READING, ENABLE_DEPTH_MASK, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_KEY_REPEAT, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_ERRORS, ENABLE_OPTIMIZED_STROKE, ENABLE_STROKE_PERSPECTIVE, ENABLE_STROKE_PURE, ENABLE_TEXTURE_MIPMAPS, ENTER, EPSILON, ERODE, ESC, EXCLUSION, FX2D, GIF, GRAY, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LANDSCAPE, LEFT, LIGHTEST, LINE, LINE_LOOP, LINE_STRIP, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MODELVIEW, MOVE, MULTIPLY, NORMAL, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, PIE, platformNames, POINT, POINTS, POLYGON, PORTRAIT, POSTERIZE, PROBLEM, PROJECT, PROJECTION, QUAD, QUAD_BEZIER_VERTEX, QUAD_STRIP, QUADRATIC_VERTEX, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RECT, REPEAT, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPAN, SPHERE, SPOT, SQUARE, SUBTRACT, SVG, TAB, TARGA, TAU, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, VERTEX, WAIT, WHITESPACE, WINDOWS, X, Y, Z
      • -
      -
    • -
    - - -
  • -
-
-
-
    -
  • - - - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        description

        -
        public final String description
        -
      • -
      - - - -
        -
      • -

        ps_name

        -
        public final String ps_name
        -
      • -
      - - - -
        -
      • -

        mode

        -
        public final int mode
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        values

        -
        public static GControlMode[] values()
        -
        Returns an array containing the constants of this enum type, in -the order they are declared. This method may be used to iterate -over the constants as follows: -
        -for (GControlMode c : GControlMode.values())
        -    System.out.println(c);
        -
        -
        Returns:
        an array containing the constants of this enum type, in -the order they are declared
        -
      • -
      - - - -
        -
      • -

        valueOf

        -
        public static GControlMode valueOf(String name)
        -
        Returns the enum constant of this type with the specified name. -The string must match exactly an identifier used to declare an -enum constant in this type. (Extraneous whitespace characters are -not permitted.)
        -
        Parameters:
        name - the name of the enum constant to be returned.
        -
        Returns:
        the enum constant with the specified name
        -
        Throws:
        -
        IllegalArgumentException - if this enum type has no constant -with the specified name
        -
        NullPointerException - if the argument is null
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GCustomSlider.html b/Processing/libraries/G4P/reference/g4p_controls/GCustomSlider.html deleted file mode 100644 index 279b65c..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GCustomSlider.html +++ /dev/null @@ -1,1130 +0,0 @@ - - - - - -GCustomSlider (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GCustomSlider

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    GConstants, processing.core.PConstants
    -
    -
    -
    -
    public class GCustomSlider
    -extends GLinearTrackControl
    -
    Slider that can be customised with user provided graphics.
    - - This class replaces the GWSlider provided in pre v3 editions of this library. -

    - The main difference to the GSlider class is the ability to skin the slider with user provided graphics. - The library provides a number of skins ready for use. You specify the skin to use when the slider is created - and if the library is unable to load the skin it will print a warning and load the default skin instead.

    -

    Library skins available

    -
      -
    • grey_blue (default skin)
    • -
    • green_red20px
    • -
    • red_yellow18px
    • -
    • blue18px
    • -
    • purple18px
    • -
    - A skin requires 5 image files for different parts of the slider which must be stored in their own - folder (the folder name is also used as the skin name) and this folder should be place inside the - sketch's data folder.

    -

    The image files have specific names. -

      -
    • Left end cap of the slider(end_left.???)
    • -
    • Right end cap of the slider(end_right.???)
    • -
    • An extendible centre segment(centre.???)
    • -
    • Draggable thumb (handle.??? and handle_mouseover.???)
    • -
    - Where ??? is the image type file extension. The image type can be any that Processing can handle, the - most common types will be png, jpg or gif but tga is also permitted

    - -

    There are very few restrictions about the images you use but when designing the images you should consider - the following facts:

    -
      -
    • the slider will be created to fit the control size (specified in the constructor)
    • -
    • the horizontal space allocated for the end-caps will be the same for each end (uses the width or the larger end cap image)
    • -
    • the track width will be the height of the centre image
    • -
    • the centre image will be tiled along the track length
    • -
    • the track will be placed in the horizontal and vertical centre of the control.
    • -
    • the end cap images will be placed in the vertical centre of the control and butted against the track.
    • -
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
- -
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GDropList.html b/Processing/libraries/G4P/reference/g4p_controls/GDropList.html deleted file mode 100644 index 760fbcf..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GDropList.html +++ /dev/null @@ -1,1374 +0,0 @@ - - - - - -GDropList (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GDropList

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    GConstants, processing.core.PConstants
    -
    -
    -
    -
    public class GDropList
    -extends GTextBase
    -
    A drop down list component.
    - - This replaces the GCombo control in pre V3 editions of this library.
    - - The number of items in the list is not restricted but the user can define - the maximum number of items to be displayed in the drop list. If there are - too many items to display a vertical scroll bar is provide to scroll through - all the items. - - The vertical size of an individual item is calculated from the overall height - specified when creating the control.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        GDropList

        -
        public GDropList(processing.core.PApplet theApplet,
        -         float p0,
        -         float p1,
        -         float p2,
        -         float p3)
        -
        Create a drop down list component with a list size of 4. - - After creating the control use setItems to initialise the list.
        -
        Parameters:
        theApplet - the applet that will display this component.
        p0 -
        p1 -
        p2 -
        p3 -
        -
      • -
      - - - -
        -
      • -

        GDropList

        -
        public GDropList(processing.core.PApplet theApplet,
        -         float p0,
        -         float p1,
        -         float p2,
        -         float p3,
        -         int dropListMaxSize)
        -
        Create a drop down list component with a specified list size. - - After creating the control use setItems to initialise the list.
        -
        Parameters:
        theApplet -
        p0 -
        p1 -
        p2 -
        p3 -
        dropListMaxSize - the maximum number of element to appear in the drop down list
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setItems

        -
        public void setItems(String[] array,
        -            int selected)
        -
        Use this to set or change the list of items to appear in the list. If - you enter an invalid selection index then it is forced into - the valid range.
        - Null and empty values in the list will be ignored.
        - If the list is null then or empty then then no changes are made.
        -
        Parameters:
        array -
        selected -
        -
      • -
      - - - -
        -
      • -

        setItems

        -
        public void setItems(List<String> list,
        -            int selected)
        -
      • -
      - - - -
        -
      • -

        removeItem

        -
        public boolean removeItem(int idx)
        -
        Remove an item from the list.
        - If idx is not a valid position in the list then the list is unchanged. - If idx points to the selected item or an item below it then the - selected index value is reduced by 1 but the selected text remains the - same.
        - If idx points to an item above the selected item then the selected - item is unchanged.
        - No event is fired even if the selected index changes.
        -
        Parameters:
        idx - index of the item to remove
        -
        Returns:
        true if item is successfully removed else false
        -
      • -
      - - - -
        -
      • -

        insertItem

        -
        public boolean insertItem(int idx,
        -                 String name)
        -
        Insert an item at the specified position in the list.
        - If idx is <0 then the list is unchanged.
        - If idx is >= the number of items in the list, it is added to the end.
        - If idx points to the selected item or an item below it then the - selected index value is incremented by 1 but the selected text remains - the same.
        - If idx points to an item above the selected item then the selected - item is unchanged.
        - No event is fired even if the selected index changes.
        -
        Parameters:
        idx - index of the item to remove
        name - text of the item to insert (null values ignored)
        -
        Returns:
        true if item is successfully inserted else false
        -
      • -
      - - - -
        -
      • -

        addItem

        -
        public boolean addItem(String name)
        -
        Add an item to the end of the list.
        - No event is fired.
        -
        Parameters:
        name - text of the item to add (null values ignored)
        -
        Returns:
        true if add is successfully added else false
        -
      • -
      - - - -
        -
      • -

        setSelected

        -
        public void setSelected(int selected)
        -
        Set the currently selected item from the droplist by index position.
        - Invalid values are ignored.
        -
        Parameters:
        selected -
        -
      • -
      - - - -
        -
      • -

        getSelectedIndex

        -
        public int getSelectedIndex()
        -
        Get the index position of the selected item
        -
      • -
      - - - -
        -
      • -

        getSelectedText

        -
        public String getSelectedText()
        -
        Get the text for the selected item
        -
      • -
      - - - -
        -
      • -

        setLocalColorScheme

        -
        public void setLocalColorScheme(int cs)
        -
        Sets the local colour scheme for this control
        -
        -
        Overrides:
        -
        setLocalColorScheme in class GAbstractControl
        -
        Parameters:
        cs - the colour scheme to use (0-15 incl.)
        -
      • -
      - - - -
        -
      • -

        isOver

        -
        public boolean isOver(float x,
        -             float y)
        -
        Determines if a particular pixel position is over this control taking - into account whether it is collapsed or not.
        -
        -
        Overrides:
        -
        isOver in class GAbstractControl
        -
        Returns:
        true if the position is over.
        -
      • -
      - - - -
        -
      • -

        mouseEvent

        -
        public void mouseEvent(processing.event.MouseEvent event)
        -
        -
        Overrides:
        -
        mouseEvent in class GAbstractControl
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getSnapshot

        -
        public processing.core.PGraphics getSnapshot()
        -
        Description copied from class: GAbstractControl
        -
        This method should be used sparingly since it is heavy on resources.
        -
        -
        Overrides:
        -
        getSnapshot in class GAbstractControl
        -
        Returns:
        a PGraphics object showing current state of the control (ignoring rotation)
        -
      • -
      - - - -
        -
      • -

        vsbEventHandler

        -
        public void vsbEventHandler(g4p_controls.GScrollbar scrollbar,
        -                   GEvent event)
        -
        This method should not be called by the user. It - is for internal library use only.
        -
      • -
      - - - -
        -
      • -

        buttonShowListHandler

        -
        public void buttonShowListHandler(GButton button,
        -                         GEvent event)
        -
        This method should not be called by the user. It - is for internal library use only.
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GEditableTextControl.html b/Processing/libraries/G4P/reference/g4p_controls/GEditableTextControl.html deleted file mode 100644 index a76f4f8..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GEditableTextControl.html +++ /dev/null @@ -1,1561 +0,0 @@ - - - - - -GEditableTextControl (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GEditableTextControl

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Focusable, GConstants, processing.core.PConstants
    -
    -
    -
    Direct Known Subclasses:
    -
    GTextArea, GTextField
    -
    -
    -
    -
    public abstract class GEditableTextControl
    -extends GTextBase
    -implements Focusable
    -
    This class is the basis for the GTextField and GTextArea classes.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        GEditableTextControl

        -
        public GEditableTextControl(processing.core.PApplet theApplet,
        -                    float p0,
        -                    float p1,
        -                    float p2,
        -                    float p3,
        -                    int scrollbars)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        setFocus

        -
        public void setFocus(boolean focus)
        -
        Determines whether this component is to have focus or not.
        -
        -
        Overrides:
        -
        setFocus in class GAbstractControl
        -
        -
      • -
      - - - -
        -
      • -

        setPromptText

        -
        public void setPromptText(String ptext)
        -
        Set the prompt text for this control. When the text control is empty - the prompt text (italic) is displayed instead. - .
        -
        Parameters:
        ptext - prompt text
        -
      • -
      - - - -
        -
      • -

        getWrapWidth

        -
        public int getWrapWidth()
        -
        Returns:
        the wrapWidth
        -
      • -
      - - - -
        -
      • -

        setWrapWidth

        -
        public void setWrapWidth(int wrapWidth)
        -
        Parameters:
        wrapWidth - the wrapWidth to set
        -
      • -
      - - - -
        -
      • -

        getPromptText

        -
        public String getPromptText()
        -
        Get the prompt text used in this control.
        -
        Returns:
        the prompt text without styling
        -
      • -
      - - - -
        -
      • -

        getText

        -
        public String getText()
        -
        Get the text in the control
        -
        -
        Overrides:
        -
        getText in class GTextBase
        -
        Returns:
        the text without styling
        -
      • -
      - - - -
        -
      • -

        getStyledText

        -
        public StyledString getStyledText()
        -
        Get the styled text in the control
        -
        -
        Overrides:
        -
        getStyledText in class GTextBase
        -
        Returns:
        the text with styling
        -
      • -
      - - - -
        -
      • -

        addStyle

        -
        public void addStyle(TextAttribute attr,
        -            Object value,
        -            int charStart,
        -            int charEnd)
        -
        Adds the text attribute to a range of characters on a particular line. If charEnd - is past the EOL then the attribute will be applied to the end-of-line.
        -
        Parameters:
        attr - the text attribute to add
        value - value of the text attribute
        charStart - the position of the first character to apply the attribute
        charEnd - the position after the last character to apply the attribute
        -
      • -
      - - - -
        -
      • -

        addStyle

        -
        public void addStyle(TextAttribute attr,
        -            Object value)
        -
        Adds the text attribute to a range of characters on a particular line. If charEnd - is past the EOL then the attribute will be applied to the end-of-line.
        -
        Parameters:
        attr - the text attribute to add
        value - value of the text attribute
        -
      • -
      - - - -
        -
      • -

        clearStyles

        -
        public void clearStyles(int charStart,
        -               int charEnd)
        -
        Clears all text attribute from a range of characters starting at position - charStart and ending with the character preceding charEnd.
        -
        Parameters:
        charStart - the position of the first character to apply the attribute
        charEnd - the position after the last character to apply the attribute
        -
      • -
      - - - -
        -
      • -

        clearStyles

        -
        public void clearStyles()
        -
        Clear all styles from the entire text.
        -
      • -
      - - - -
        -
      • -

        setFont

        -
        public void setFont(Font font)
        -
        Set the font for this control.
        -
        -
        Overrides:
        -
        setFont in class GTextBase
        -
        Parameters:
        font -
        -
      • -
      - - - -
        -
      • -

        getSelectedText

        -
        public String getSelectedText()
        -
        Get the text that has been selected (highlighted) by the user.
        -
        Returns:
        the selected text without styling
        -
      • -
      - - - -
        -
      • -

        setSelectedTextStyle

        -
        public void setSelectedTextStyle(TextAttribute style,
        -                        Object value)
        -
        If some text has been selected then set the style. If there is no selection then - the text is unchanged.
        -
        Parameters:
        style -
        -
      • -
      - - - -
        -
      • -

        clearSelectionStyle

        -
        public void clearSelectionStyle()
        -
        Clear any styles applied to the selected text.
        -
      • -
      - - - -
        -
      • -

        setJustify

        -
        public void setJustify(boolean justify)
        -
      • -
      - - - -
        -
      • -

        setLocalColorScheme

        -
        public void setLocalColorScheme(int cs)
        -
        Sets the local colour scheme for this control
        -
        -
        Overrides:
        -
        setLocalColorScheme in class GAbstractControl
        -
        Parameters:
        cs - the colour scheme to use (0-15 incl.)
        -
      • -
      - - - -
        -
      • -

        hasSelection

        -
        public boolean hasSelection()
        -
        Find out if some text is selected (highlighted)
        -
        Returns:
        true if some text is selected else false
        -
      • -
      - - - -
        -
      • -

        setTextEditEnabled

        -
        public void setTextEditEnabled(boolean enableTextEdit)
        -
        Determines whether the text can be edited using the keyboard or mouse. It - still allows the text to be modified by the sketch code.
        - If text editing is being disabled and the control has focus then it is forced - to give up that focus.
        - This might be useful if you want to use a GTextArea control to display large - amounts of text that needs scrolling (so cannot use a GLabel) but must not - change e.g. a user instruction guide.
        -
        Parameters:
        enableTextEdit - false to disable keyboard input
        -
      • -
      - - - -
        -
      • -

        isTextEditEnabled

        -
        public boolean isTextEditEnabled()
        -
        Is this control keyboard enabled
        -
      • -
      - - - -
        -
      • -

        keyEvent

        -
        public void keyEvent(processing.event.KeyEvent e)
        -
        -
        Overrides:
        -
        keyEvent in class GAbstractControl
        -
        -
      • -
      - - - -
        -
      • -

        flashCaret

        -
        public void flashCaret(GTimer timer)
        -
        Do not call this directly. A timer calls this method as and when required.
        -
      • -
      - - - -
        -
      • -

        hsbEventHandler

        -
        public void hsbEventHandler(g4p_controls.GScrollbar scrollbar,
        -                   GEvent event)
        -
        Do not call this method directly, G4P uses it to handle input from - the horizontal scrollbar.
        -
      • -
      - - - -
        -
      • -

        vsbEventHandler

        -
        public void vsbEventHandler(g4p_controls.GScrollbar scrollbar,
        -                   GEvent event)
        -
        Do not call this method directly, G4P uses it to handle input from - the vertical scrollbar.
        -
      • -
      - - - -
        -
      • -

        markForDisposal

        -
        public void markForDisposal()
        -
        Permanently dispose of this control.
        -
        -
        Overrides:
        -
        markForDisposal in class GAbstractControl
        -
        -
      • -
      - - - -
        -
      • -

        saveText

        -
        public boolean saveText(String fname)
        -
        Save the styled text used by this control to file.
        - It will also save the start and end position of any text selection.
        -
        -
        Overrides:
        -
        saveText in class GTextBase
        -
        Parameters:
        fname - the name of the file to use
        -
        Returns:
        true if saved successfully else false
        -
      • -
      - - - -
        -
      • -

        loadText

        -
        public boolean loadText(String fname)
        -
        Load the styled string to be used by this control.
        - It will also restore any text selection saved with the text.
        -
        -
        Overrides:
        -
        loadText in class GTextBase
        -
        Parameters:
        fname - the name of the file to use
        -
        Returns:
        true if loaded successfully else false
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GEvent.html b/Processing/libraries/G4P/reference/g4p_controls/GEvent.html deleted file mode 100644 index a826a59..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GEvent.html +++ /dev/null @@ -1,564 +0,0 @@ - - - - - -GEvent (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Enum GEvent

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Serializable, Comparable<GEvent>
    -
    -
    -
    -
    public enum GEvent
    -extends Enum<GEvent>
    -
    Enumeration of events that can be fired by G4P.
    - - GTextField and GTextArea events
    - CHANGED Text has changed
    - SELECTION_CHANGED Text selection has changed
    - ENTERED Enter/return key typed
    - LOST_FOCUS TextField/Area lost focus
    - GETS_FOCUS TextField/Area got focus
    - - GPanel events
    - COLLAPSED Control was collapsed
    - EXPANDED Control was expanded
    - DRAGGED Control is being dragged
    - - Button control events (PRESSED and RELEASED are not fired by default) - CLICKED Mouse button was clicked
    - PRESSED Mouse button was pressed
    - RELEASED Mouse button was released
    - - Slider control events events
    - VALUE_CHANGING Value is changing
    - VALUE_STEADY Value has reached a steady state
    - DRAGGING The mouse is being dragged over a component
    - - GCheckbox & GOption events
    - SELECTED ( "Option selected
    - DESELECTED ( "Option de-selected
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Enum Constant Detail

      - - - -
        -
      • -

        CHANGED

        -
        public static final GEvent CHANGED
        -
      • -
      - - - -
        -
      • -

        SELECTION_CHANGED

        -
        public static final GEvent SELECTION_CHANGED
        -
      • -
      - - - -
        -
      • -

        ENTERED

        -
        public static final GEvent ENTERED
        -
      • -
      - - - -
        -
      • -

        LOST_FOCUS

        -
        public static final GEvent LOST_FOCUS
        -
      • -
      - - - -
        -
      • -

        GETS_FOCUS

        -
        public static final GEvent GETS_FOCUS
        -
      • -
      - - - -
        -
      • -

        COLLAPSED

        -
        public static final GEvent COLLAPSED
        -
      • -
      - - - -
        -
      • -

        EXPANDED

        -
        public static final GEvent EXPANDED
        -
      • -
      - - - -
        -
      • -

        DRAGGED

        -
        public static final GEvent DRAGGED
        -
      • -
      - - - -
        -
      • -

        CLICKED

        -
        public static final GEvent CLICKED
        -
      • -
      - - - -
        -
      • -

        PRESSED

        -
        public static final GEvent PRESSED
        -
      • -
      - - - -
        -
      • -

        RELEASED

        -
        public static final GEvent RELEASED
        -
      • -
      - - - -
        -
      • -

        VALUE_CHANGING

        -
        public static final GEvent VALUE_CHANGING
        -
      • -
      - - - -
        -
      • -

        VALUE_STEADY

        -
        public static final GEvent VALUE_STEADY
        -
      • -
      - - - -
        -
      • -

        DRAGGING

        -
        public static final GEvent DRAGGING
        -
      • -
      - - - -
        -
      • -

        SELECTED

        -
        public static final GEvent SELECTED
        -
      • -
      - - - -
        -
      • -

        DESELECTED

        -
        public static final GEvent DESELECTED
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        values

        -
        public static GEvent[] values()
        -
        Returns an array containing the constants of this enum type, in -the order they are declared. This method may be used to iterate -over the constants as follows: -
        -for (GEvent c : GEvent.values())
        -    System.out.println(c);
        -
        -
        Returns:
        an array containing the constants of this enum type, in -the order they are declared
        -
      • -
      - - - -
        -
      • -

        valueOf

        -
        public static GEvent valueOf(String name)
        -
        Returns the enum constant of this type with the specified name. -The string must match exactly an identifier used to declare an -enum constant in this type. (Extraneous whitespace characters are -not permitted.)
        -
        Parameters:
        name - the name of the enum constant to be returned.
        -
        Returns:
        the enum constant with the specified name
        -
        Throws:
        -
        IllegalArgumentException - if this enum type has no constant -with the specified name
        -
        NullPointerException - if the argument is null
        -
      • -
      - - - -
        -
      • -

        getDesc

        -
        public String getDesc()
        -
        Get a textual description of this event
        -
      • -
      - - - -
        -
      • -

        getType

        -
        public String getType()
        -
        Get the error identifier.
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GGroup.html b/Processing/libraries/G4P/reference/g4p_controls/GGroup.html deleted file mode 100644 index 975c9b8..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GGroup.html +++ /dev/null @@ -1,1371 +0,0 @@ - - - - - -GGroup (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GGroup

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    GConstants, processing.core.PConstants
    -
    -
    -
    -
    public final class GGroup
    -extends GAbstractControl
    -
    This class allows you to group GUI controls so that they can be treated as a single - entity for common GUI actions.
    - Once grouped a single statement change the enabled status, visibility status, colour - scheme and transparency for all the controls in the group. It is possible to - specify a delay before the action is executed, and in the case of transparency, specify - the amount of time the fade occurs.
    - This is particularly useful if your sketch has a number of 'modes' and each mode has its - own set of G4P controls. Simply create a GGroup object for each mode then as the mode - changes it is easy to display the controls for the current mode and hide the others.
    - A GGroup is associated with a window (or GWindow) and can only be used with controls - displayed on that window.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        GGroup

        -
        public GGroup(processing.core.PApplet theApplet)
        -
        Create a control group for the indicated PApplet. Only controls - created with this PApplet can be added to this group.
        - - All controls added will be initialised as fully opaque.
        -
        Parameters:
        theApplet - the associated PApplet
        -
      • -
      - - - -
        -
      • -

        GGroup

        -
        public GGroup(processing.core.PApplet theApplet,
        -      int startAlpha)
        -
        Create a control group for the indicated PApplet. Only controls - created with this PApplet can be added to this group.
        - - All controls added will be initialised as fully opaque.
        -
        Parameters:
        theApplet - the associated PApplet
        startAlpha - the starting alpha level (must 0-255 incl)
        -
      • -
      - - - -
        -
      • -

        GGroup

        -
        public GGroup(GWindow theWindow)
        -
        Create a control group for the indicated GWindow. Only controls - displayed in this GWindow can be added to this group.
        - - All controls added will be initialised as fully opaque.
        -
        Parameters:
        theWindow - the associated GWindow
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        fadeOut

        -
        public void fadeOut(int delay,
        -           int duration)
        -
        Fade to invisible. (alpha = 0)
        -
        Parameters:
        delay - time before starting fade (milli-seconds)
        duration - time to fade over (milli-seconds)
        -
      • -
      - - - -
        -
      • -

        fadeIn

        -
        public void fadeIn(int delay,
        -          int duration)
        -
        Fade to fully opaque. (alpha = 255)
        -
        Parameters:
        delay - time before starting fade (milli-seconds)
        duration - time to fade over (milli-seconds)
        -
      • -
      - - - -
        -
      • -

        fadeTo

        -
        public void fadeTo(int delay,
        -          int duration,
        -          int alpha)
        -
        Fade to an alpha value
        -
        Parameters:
        delay - time before starting fade (milli-seconds)
        duration - time to fade over (milli-seconds)
        alpha - the target alpha value
        -
      • -
      - - - -
        -
      • -

        setEnabled

        -
        public void setEnabled(int delay,
        -              boolean enable)
        -
        Enable / disable the controls.
        -
        Parameters:
        delay - delay time before action is performed (milli-seconds)
        -
      • -
      - - - -
        -
      • -

        isFading

        -
        public boolean isFading()
        -
      • -
      - - - -
        -
      • -

        timeLeftFading

        -
        public int timeLeftFading()
        -
      • -
      - - - -
        -
      • -

        setEnabled

        -
        public void setEnabled(boolean enable)
        -
        Enable / disable the controls immediately.
        -
        -
        Overrides:
        -
        setEnabled in class GAbstractControl
        -
        Parameters:
        enable - true to enable else false
        -
      • -
      - - - -
        -
      • -

        setVisible

        -
        public void setVisible(int delay,
        -              boolean visible)
        -
        Make the control visible or invisible.
        - If you simply want to change the controls' visibility status then - use this in preference to fadeIn/fadeOut
        -
        Parameters:
        delay - delay time before action is performed (milli-seconds)
        -
      • -
      - - - -
        -
      • -

        setVisible

        -
        public void setVisible(boolean visible)
        -
        Make the control visible or invisible with immediate effect.
        - If you simply want to change the controls' visibility status then - use this in preference to fadeIn/fadeOut
        -
        -
        Overrides:
        -
        setVisible in class GAbstractControl
        -
        Parameters:
        visible - the visibility to set
        -
      • -
      - - - - - - - -
        -
      • -

        setLocalColorScheme

        -
        public void setLocalColorScheme(int delay,
        -                       int colScheme)
        -
        Set the color scheme used by these controls after a delay.
        -
        Parameters:
        delay - time before colour change (milli-seconds)
        colScheme - the colour scheme (0-15) to be used.
        See Also:
        for colour constants (e.g. BLUE_SCHEME) to use.
        -
      • -
      - - - - - - - -
        -
      • -

        addControls

        -
        public void addControls(GAbstractControl... controls)
        -
        Add one or more G4P controls to this group.
        - If a control is not a valid type for group control, or if the control and group are for different - windows then the control is not added and a warning message is displayed.
        -
        -
        Overrides:
        -
        addControls in class GAbstractControl
        -
        Parameters:
        controls - comma separated list of G4P controls to add to this group
        -
      • -
      - - - -
        -
      • -

        addControl

        -
        public void addControl(GAbstractControl control)
        -
        A single G4P control to add to this group.
        - If a control is not a valid type for group control, or if the control and group are for different - windows then the control is not added and a warning message is displayed.
        -
        -
        Overrides:
        -
        addControl in class GAbstractControl
        -
        Parameters:
        control - a G4P control to add to this group
        -
      • -
      - - - -
        -
      • -

        removeControls

        -
        public void removeControls(GAbstractControl... controls)
        -
        Remove one or more G4P controls from this group.
        -
        Parameters:
        controls - comma separated list of G4P controls to remove from this group
        -
      • -
      - - - -
        -
      • -

        removeControl

        -
        public void removeControl(GAbstractControl control)
        -
        Remove a single G4P control from this group.
        -
        Parameters:
        control - a G4P control to remove from this group
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GImageButton.html b/Processing/libraries/G4P/reference/g4p_controls/GImageButton.html deleted file mode 100644 index e54bb87..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GImageButton.html +++ /dev/null @@ -1,1232 +0,0 @@ - - - - - -GImageButton (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GImageButton

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    GConstants, processing.core.PConstants
    -
    -
    -
    -
    public class GImageButton
    -extends GAbstractControl
    -
    Buttons create from this class use a number of images to represent it's - state. This means that buttons can have an irregular and/or discontinuous - shape.
    -

    Determining the control size

    - If when creating the button you specify a particular width and height then - any images that are not the same size will be scaled to fit without regard - to the original size or aspect ratio.
    - - If when creating the button you do not specify the width and height then it - will use the width and height of the 'off-button' image and assume that all the - other images are the same size.
    - -

    The images

    - The image button needs 1 to 3 image files to represent the button states
    - OFF mouse is not over button
    - OVER mouse is over the button
    - DOWN the mouse is over the button and a mouse button is being pressed.
    - - If you only provide one image then this will be used for all states, if you - provide two then the second image is used for both OVER and DOWN states.

    - - If you don't provide a mask file then the button 'hotspot' is represented by any - non-transparent pixels in the OFF image. If you do provide a mask file then the - hotspot is defined by any black pixels in the mask image.

    - - - Three types of event can be generated :-
    - GEvent.PRESSED GEvent.RELEASED GEvent.CLICKED
    - - To simplify event handling the button only fires off CLICKED events - when the mouse button is pressed and released over the button face - (the default behaviour).
    - - Using
    button1.fireAllEvents(true);
    enables the other 2 events - for button button1. A PRESSED event is created if the mouse button - is pressed down over the button face, the CLICKED event is then generated - if the mouse button is released over the button face. Releasing the - button off the button face creates a RELEASED event.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        GImageButton

        -
        public GImageButton(processing.core.PApplet theApplet,
        -            float p0,
        -            float p1,
        -            String[] fnames)
        -
        The control size will be set to the size of the image file used for the button OFF state.
        - There is no alpha mask file..
        -
        Parameters:
        theApplet -
        p0 -
        p1 -
        fnames - an array of up to 3 image filenames to represent the off/over/down state of the button.
        -
      • -
      - - - -
        -
      • -

        GImageButton

        -
        public GImageButton(processing.core.PApplet theApplet,
        -            float p0,
        -            float p1,
        -            String[] fnames,
        -            String fnameMask)
        -
        The control size will be set to the size of the image file used for the button OFF state.
        -
        Parameters:
        theApplet -
        p0 -
        p1 -
        fnames - an array of up to 3 image filenames to represent the off/over/down state of the button.
        fnameMask - the alpha mask filename or null if no mask
        -
      • -
      - - - -
        -
      • -

        GImageButton

        -
        public GImageButton(processing.core.PApplet theApplet,
        -            float p0,
        -            float p1,
        -            float p2,
        -            float p3,
        -            String[] fnames)
        -
        Create an image button of the size specified by the parameters.
        - The images will be resized to fit and there is no alpha mask file.
        -
        Parameters:
        theApplet -
        p0 -
        p1 -
        p2 -
        p3 -
        fnames - an array of up to 3 image filenames to represent the off/over/down state of the button.
        -
      • -
      - - - -
        -
      • -

        GImageButton

        -
        public GImageButton(processing.core.PApplet theApplet,
        -            float p0,
        -            float p1,
        -            float p2,
        -            float p3,
        -            String[] fnames,
        -            String fnameMask)
        -
        Create an image button of the size specified by the parameters.
        - The images will be resized to fit.
        -
        Parameters:
        theApplet -
        p0 -
        p1 -
        p2 -
        p3 -
        fnames - an array of up to 3 image filenames to represent the off/over/down state of the button.
        fnameMask - the alpha mask filename or null if no mask
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        mouseEvent

        -
        public void mouseEvent(processing.event.MouseEvent event)
        -
        When a mouse button is clicked on a GImageButton it generates the GEvent.CLICKED event. If - you also want the button to generate GEvent.PRESSED and GEvent.RELEASED events - then you need the following statement.
        -
        btnName.fireAllEvents(true); 

        - -
        - void handleButtonEvents(void handleButtonEvents(GImageButton button, GEvent event) {
        -          if(button == btnName && event == GEvent.CLICKED){
        -        // code for button click event
        -    }
        - 

        - Where
        btnName
        is the GImageButton identifier (variable name)

        -
        -
        Overrides:
        -
        mouseEvent in class GAbstractControl
        -
        -
      • -
      - - - -
        -
      • -

        fireAllEvents

        -
        public void fireAllEvents(boolean all)
        -
        If the parameter is true all 3 event types are generated, if false - only CLICKED events are generated (default behaviour).
        -
        Parameters:
        all -
        -
      • -
      - - - -
        -
      • -

        setEnabled

        -
        public void setEnabled(boolean enable)
        -
        Enable or disable the ability of the component to generate mouse events.
        - If the control is to be disabled when it is clicked then this will force the - mouse off button image is used.
        -
        -
        Overrides:
        -
        setEnabled in class GAbstractControl
        -
        Parameters:
        enable - true to enable else false
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GImageToggleButton.html b/Processing/libraries/G4P/reference/g4p_controls/GImageToggleButton.html deleted file mode 100644 index e647026..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GImageToggleButton.html +++ /dev/null @@ -1,1305 +0,0 @@ - - - - - -GImageToggleButton (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GImageToggleButton

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    GConstants, processing.core.PConstants
    -
    -
    -
    -
    public class GImageToggleButton
    -extends GAbstractControl
    -
    Buttons created from this class have 2 or more toggle states. If the number of states - is N then the button's value will be in the range 0 to N-1. Most toggle buttons will - have just two states and these have values 0 and 1.
    - Clicking on the button advances the state by one, restarting at zero after the last - state.
    - Each state must have its own 'picture' and the user must supply these as a tiled image - where the pictures are tiled in 1D or 2D arrangement without 'empty space' around the - tiles.
    - If for any reason the library is unable to use the specified graphics then it will - provide a default two state toggle switch.
    - It is also possible to provide an over-button image set for when the mouse moves - over the button - this is optional.
    - The button control will always be resized to suit the state picture size (tile size).
    - The mouse is considered to be over the button it its position is over an opaque pixel - in the state picture. Since transparent pixels are not included then the button shape - can be different for each state.
    - - - - Three types of event can be generated :-
    - GEvent.PRESSED GEvent.RELEASED GEvent.CLICKED
    - - To simplify event handling the button only fires off CLICKED events - when the mouse button is pressed and released over the button face - (the default behaviour).
    - - Using
    button1.fireAllEvents(true);
    enables the other 2 events - for button button1. A PRESSED event is created if the mouse button - is pressed down over the button face, the CLICKED event is then generated - if the mouse button is released over the button face. Releasing the - button off the button face creates a RELEASED event. This is included for - completeness since it is unlikely you will need to detect these events - for this type of control.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        GImageToggleButton

        -
        public GImageToggleButton(processing.core.PApplet theApplet,
        -                  float p0,
        -                  float p1)
        -
        Create the library default image-toggle-button at the stated position.
        -
        Parameters:
        theApplet -
        p0 - horizontal position of the control
        p1 - vertical position of the control
        -
      • -
      - - - -
        -
      • -

        GImageToggleButton

        -
        public GImageToggleButton(processing.core.PApplet theApplet,
        -                  float p0,
        -                  float p1,
        -                  String offPicture,
        -                  int nbrCols)
        -
        Create an image-toggle-button.
        - Single row of tiles.
        -
        Parameters:
        theApplet -
        p0 - horizontal position of the control
        p1 - vertical position of the control
        offPicture - the filename of bitmap containing toggle state pictures
        nbrCols - number of tiles horizontally
        -
      • -
      - - - -
        -
      • -

        GImageToggleButton

        -
        public GImageToggleButton(processing.core.PApplet theApplet,
        -                  float p0,
        -                  float p1,
        -                  String offPicture,
        -                  int nbrCols,
        -                  int nbrRows)
        -
        Create an image-toggle-button.
        -
        Parameters:
        theApplet -
        p0 - horizontal position of the control
        p1 - vertical position of the control
        offPicture - the filename of bitmap containing toggle state pictures
        nbrCols - number of tiles horizontally
        nbrRows - number of tiles vertically
        -
      • -
      - - - -
        -
      • -

        GImageToggleButton

        -
        public GImageToggleButton(processing.core.PApplet theApplet,
        -                  float p0,
        -                  float p1,
        -                  String offPicture,
        -                  String overPicture,
        -                  int nbrCols)
        -
        Create an image-toggle-button.
        - Single row of tiles.
        -
        Parameters:
        theApplet -
        p0 - horizontal position of the control
        p1 - vertical position of the control
        offPicture - the filename of bitmap containing toggle state pictures
        overPicture - the filename of bitmap containing mouse-over button toggle state pictures
        nbrCols - number of tiles horizontally
        -
      • -
      - - - -
        -
      • -

        GImageToggleButton

        -
        public GImageToggleButton(processing.core.PApplet theApplet,
        -                  float p0,
        -                  float p1,
        -                  String offPicture,
        -                  String overPicture,
        -                  int nbrCols,
        -                  int nbrRows)
        -
        Create an image-toggle-button.
        -
        Parameters:
        theApplet -
        p0 - horizontal position of the control
        p1 - vertical position of the control
        offPicture - the filename of bitmap containing toggle state pictures
        overPicture - the filename of bitmap containing mouse-over button toggle state pictures
        nbrCols - number of tiles horizontally
        nbrRows - number of tiles vertically
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        mouseEvent

        -
        public void mouseEvent(processing.event.MouseEvent event)
        -
        When a mouse button is clicked on a GImageToggleButton it generates the GEvent.CLICKED event. If - you also want the button to generate GEvent.PRESSED and GEvent.RELEASED events - then you need the following statement.
        -
        btnName.fireAllEvents(true); 

        -
        - void handleButtonEvents(void handleToggleButtonEvents(GImageToggleButton button, GEvent event) {
        -          if(button == btnName && event == GEvent.CLICKED){
        -        int buttonState = btnName.stateValue();
        -    }
        - 

        - Where
        btnName
        is the GImageToggleButton identifier (variable name)

        -
        -
        Overrides:
        -
        mouseEvent in class GAbstractControl
        -
        -
      • -
      - - - -
        -
      • -

        stateValue

        -
        @Deprecated
        -public int stateValue()
        -
        Deprecated. use getState()
        -
        Get the current state value of the button.
        -
      • -
      - - - -
        -
      • -

        getState

        -
        public int getState()
        -
        Get the current state value of the button.
        -
      • -
      - - - -
        -
      • -

        stateValue

        -
        @Deprecated
        -public void stateValue(int newState)
        -
        Deprecated. use setState(int)
        -
        Change the current toggle state.
        - If the parameter is not a valid toggle state value then it - is ignored and the button's state value is unchanged.
        -
        Parameters:
        newState -
        -
      • -
      - - - -
        -
      • -

        setState

        -
        public void setState(int newState)
        -
        Change the current toggle state.
        - If the parameter is not a valid toggle state value then it - is ignored and the button's state value is unchanged.
        -
        Parameters:
        newState -
        -
      • -
      - - - -
        -
      • -

        fireAllEvents

        -
        public void fireAllEvents(boolean all)
        -
        If the parameter is true all 3 event types are generated, if false - only CLICKED events are generated (default behaviour).
        - For this toggle control I can't see the need for anything but - CLICKED events
        -
        Parameters:
        all -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GKnob.html b/Processing/libraries/G4P/reference/g4p_controls/GKnob.html deleted file mode 100644 index 675ea13..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GKnob.html +++ /dev/null @@ -1,1406 +0,0 @@ - - - - - -GKnob (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GKnob

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    GConstants, processing.core.PConstants
    -
    -
    -
    -
    public class GKnob
    -extends GValueControl
    -
    The provides an extremely configurable GUI knob controller. GKnob - inherits from GValueControl so you should read the documentation - for that class as it also applies to GKnob.

    - - Configurable options
    - Knob size but it must be circular
    - Start and end of rotation arc.
    - Bezel width with tick marks
    - User defined value limits (i.e. the range of values returned
    -
    - Range of values associated with rotating the knob
    - Rotation is controlled by mouse movement - 3 modes available
    - (a) angular - drag round knob center
    - (b) horizontal - drag left or right
    - (c) vertical - drag up or down
    - User can specify mouse sensitivity for modes (b) and (c) - Use can specify easing to give smoother rotation - - Note: Angles are measured clockwise starting in the positive x direction i.e. -
    -         270
    -          |
    -    180 --+-- 0
    -          |
    -          90
    - 
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        GKnob

        -
        public GKnob(processing.core.PApplet theApplet,
        -     float p0,
        -     float p1,
        -     float p2,
        -     float p3,
        -     float gripAmount)
        -
        Will create the a circular knob control that fits the rectangle define by - the values passed as parameters.
        - The knob has two zones the outer bezel and the inner gripper. The radius of - the outer bezel is calculated from
        -
        bezel radius = min(width, height)/2 - 2

        - The radius of the inner griper radius is calculated from the bezel radius - and the last parameter.
        -
        grip radius = bezel radiius * gripAmount 

        - The gripAmount should be in te range 0.0 to 1.0 inclusive. The actual value - will be constrained to that range.
        -
        Parameters:
        theApplet -
        p0 -
        p1 -
        p2 -
        p3 -
        gripAmount - must be >=0.0 and <=1.0
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setGripAmount

        -
        public void setGripAmount(float gripAmount)
        -
        The radius of the inner griper radius is calculated from the bezel radius - and the parameter gripAmount using
        -
        grip radius = bezel radiius * gripAmount 

        - The gripAmount should be in te range 0.0 to 1.0 inclusive. The actual value - will be constrained to that range.
        -
        Parameters:
        gripAmount - must be >=0.0 and <=1.0
        -
      • -
      - - - -
        -
      • -

        setValue

        -
        public void setValue(float v)
        -
        Set the value for the slider.
        - The user must ensure that the value is valid for the slider range.
        -
        -
        Overrides:
        -
        setValue in class GValueControl
        -
        Parameters:
        v -
        -
      • -
      - - - -
        -
      • -

        setShowTrack

        -
        public void setShowTrack(boolean showTrack)
        -
        Whether or not to show the circular progress bar.
        -
        Parameters:
        showTrack - true for visible
        -
      • -
      - - - -
        -
      • -

        isShowTrack

        -
        public boolean isShowTrack()
        -
        Are we showing the the value track bar.
        -
      • -
      - - - -
        -
      • -

        setIncludeOverBezel

        -
        public void setIncludeOverBezel(boolean overBezel)
        -
        Whether to include the bezel when deciding when the mouse is over.
        -
        Parameters:
        overBezel - true if bezel inclded.
        -
      • -
      - - - -
        -
      • -

        isIncludeOverBezel

        -
        public boolean isIncludeOverBezel()
        -
        Is the bezel included when considering when the mouse is over.
        -
        Returns:
        true if included.
        -
      • -
      - - - -
        -
      • -

        setOverArcOnly

        -
        public void setOverArcOnly(boolean arcOnly)
        -
        Decides when the knob will respond to the mouse buttons. If set to true - it will only respond when ver the arc made by the start and end angles. If - false it will be the full circle.
        -
        Parameters:
        arcOnly -
        -
      • -
      - - - -
        -
      • -

        isOverArcOnly

        -
        public boolean isOverArcOnly()
        -
        Does the mouse only respond when over the arc?
        -
        Returns:
        true = yes
        -
      • -
      - - - -
        -
      • -

        setArcPolicy

        -
        public void setArcPolicy(boolean over_arc_only,
        -                boolean draw_arc_only,
        -                boolean overfullsize)
        -
        Convenience method to set both the show and the mouse over arc only properties - for this knob
        -
        Parameters:
        over_arc_only - mouse over arc only?
        draw_arc_only - draw arc only?
        overfullsize - include bezel in mouse over calculations?
        -
      • -
      - - - -
        -
      • -

        setShowArcOnly

        -
        public void setShowArcOnly(boolean arcOnly)
        -
        This will decide whether the knob is draw as a full circle or as an arc.
        -
        Parameters:
        arcOnly - true for arc only
        -
      • -
      - - - -
        -
      • -

        isShowArcOnly

        -
        public boolean isShowArcOnly()
        -
        Are we showing arc only?
        -
        Returns:
        true = yes
        -
      • -
      - - - -
        -
      • -

        mouseEvent

        -
        public void mouseEvent(processing.event.MouseEvent event)
        -
        -
        Overrides:
        -
        mouseEvent in class GAbstractControl
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getTurnMode

        -
        public int getTurnMode()
        -
        Get the current mouse controller mode possible values are
        - GKnob.CTRL_ANGULAR or GKnob.CTRL_HORIZONTAL) orGKnob.CTRL_VERTICAL
        -
        Returns:
        the mode
        -
      • -
      - - - -
        -
      • -

        setTurnMode

        -
        public void setTurnMode(int mode)
        -
        Set the mouse control mode to use, acceptable values are
        - GKnob.CTRL_ANGULAR or GKnob.CTRL_HORIZONTAL) orGKnob.CTRL_VERTICAL any - other value will be ignored.
        -
        Parameters:
        mode - the mode to set
        -
      • -
      - - - -
        -
      • -

        getSensitivity

        -
        public float getSensitivity()
        -
        This gets the sensitivity to be used in modes CTRL_HORIZONTAL and CTRL_VERTICAL
        -
        Returns:
        the sensitivity
        -
      • -
      - - - -
        -
      • -

        setSensitivity

        -
        public void setSensitivity(float sensitivity)
        -
        This gets the sensitivity to be used in modes CTRL_HORIZONTAL and CTRL_VERTICAL
        - A value of 1 is 1 degree per pixel and a value of 2 is 2 degrees per pixel.
        -
        Parameters:
        sensitivity - the sensitivity to set
        -
      • -
      - - - -
        -
      • -

        setTurnRange

        -
        public void setTurnRange(float start,
        -                float end)
        -
        Set the limits for the range of valid rotation angles for the knob.
        -
        Parameters:
        start - the range start angle in degrees
        end - the range end angle in degrees
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GLabel.html b/Processing/libraries/G4P/reference/g4p_controls/GLabel.html deleted file mode 100644 index 8a4d234..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GLabel.html +++ /dev/null @@ -1,1104 +0,0 @@ - - - - - -GLabel (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GLabel

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    GConstants, processing.core.PConstants
    -
    -
    -
    -
    public class GLabel
    -extends GTextIconAlignBase
    -
    The label component. - - This control can display text with/without an icon.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
- -
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GLinearTrackControl.html b/Processing/libraries/G4P/reference/g4p_controls/GLinearTrackControl.html deleted file mode 100644 index 381d804..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GLinearTrackControl.html +++ /dev/null @@ -1,1194 +0,0 @@ - - - - - -GLinearTrackControl (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GLinearTrackControl

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    GConstants, processing.core.PConstants
    -
    -
    -
    Direct Known Subclasses:
    -
    GCustomSlider, GSlider
    -
    -
    -
    -
    public abstract class GLinearTrackControl
    -extends GValueControl
    -
    Base class for linear sliders. - - This class provides the ability to control the orientation - the text should be displayed. It also enables the use of labels - for each tick mark.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        GLinearTrackControl

        -
        public GLinearTrackControl(processing.core.PApplet theApplet,
        -                   float p0,
        -                   float p1,
        -                   float p2,
        -                   float p3)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setTextOrientation

        -
        public void setTextOrientation(int orient)
        -
        Set the text orientation for the display of the limits and value if appropriate.
        - Acceptable values are G4P.ORIENT_LEFT, G4P.ORIENT_RIGHT or G4P.ORIENT_TRACK
        - If an invalid value is passed the ORIENT_TRACK is used.
        -
        Parameters:
        orient - the orientation of the number labels
        -
      • -
      - - - -
        -
      • -

        setTickLabels

        -
        public void setTickLabels(String[] tickLabels)
        -
        This method is used to set the text to appear alongside the tick marks.
        - The array passed must have a minimum of 2 elements and each label (element) - must have at least 1 character. If these two conditions are not met then - the call to this method will be ignored and no changes are made.
        -
        Parameters:
        tickLabels - an array of strings for the labels
        -
      • -
      - - - -
        -
      • -

        setShowTicks

        -
        public void setShowTicks(boolean showTicks)
        -
        Set whether the tick marks are to be displayed or not. Then - recalculate the track offset for the value and limit text.
        -
        -
        Overrides:
        -
        setShowTicks in class GValueControl
        -
        Parameters:
        showTicks - the showTicks to set
        -
      • -
      - - - -
        -
      • -

        setTrackOffset

        -
        public void setTrackOffset(float offset)
        -
        The offset is the distance the value/labels are drawn from the - centre of the track.
        - You may wish to tweak this value for visual effect.
        -
        Parameters:
        offset -
        -
      • -
      - - - -
        -
      • -

        getTrackOffset

        -
        public float getTrackOffset()
        -
        Get the visual offset for the value/label text.
        -
      • -
      - - - -
        -
      • -

        getValueS

        -
        public String getValueS()
        -
        If we are using labels then this will get the label text - associated with the current value.
        - If labels have not been set then return null
        -
        -
        Overrides:
        -
        getValueS in class GValueControl
        -
        -
      • -
      - - - -
        -
      • -

        mouseEvent

        -
        public void mouseEvent(processing.event.MouseEvent event)
        -
        -
        Overrides:
        -
        mouseEvent in class GAbstractControl
        -
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GOption.html b/Processing/libraries/G4P/reference/g4p_controls/GOption.html deleted file mode 100644 index f46b546..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GOption.html +++ /dev/null @@ -1,1088 +0,0 @@ - - - - - -GOption (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GOption

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    GConstants, processing.core.PConstants
    -
    -
    -
    -
    public class GOption
    -extends GToggleControl
    -
    A two-state toggle control.
    - - GOption objects (also known as radio buttons) are two-state toggle switches that can either - be used independently or if added to a GToggleGroup control part of a single selection - option group.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
- -
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GPanel.html b/Processing/libraries/G4P/reference/g4p_controls/GPanel.html deleted file mode 100644 index 6eb81c9..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GPanel.html +++ /dev/null @@ -1,1443 +0,0 @@ - - - - - -GPanel (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GPanel

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    GConstants, processing.core.PConstants
    -
    -
    -
    -
    public class GPanel
    -extends GTextBase
    -
    A component that can be used to group GUI components that can be - dragged, collapsed (leaves title tab only) and un-collapsed. - - When created the Panel is collapsed by default. To open the panel - use setCollapsed(true); after creating it.
    - - Once a component has been added the x/y coordinates of the control are - calculated to be the centre of the panel to the centre of the control. This - is to facilitate rotating of controls on panels
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        GPanel

        -
        public GPanel(processing.core.PApplet theApplet,
        -      float p0,
        -      float p1,
        -      float p2,
        -      float p3)
        -
        Create a Panel that comprises of 2 parts the tab which is used to - select and move the panel and the container window below the tab which - is used to hold other components.
        - If the panel fits inside the display window then its position will be - constrained so that it can't be dragged outside the viewable area. - Otherwise no constraint is applied.
        -
        Parameters:
        theApplet - the PApplet reference
        p0 - horizontal position
        p1 - vertical position
        p2 - width of the panel
        p3 - height of the panel (excl. tab)
        -
      • -
      - - - -
        -
      • -

        GPanel

        -
        public GPanel(processing.core.PApplet theApplet,
        -      float p0,
        -      float p1,
        -      float p2,
        -      float p3,
        -      String text)
        -
        Create a Panel that comprises of 2 parts the tab which is used to - select and move the panel and the container window below the tab which - is used to hold other components.
        - If the panel fits inside the display window then its position will be - constrained so that it can't be dragged outside the viewable area. - Otherwise no constraint is applied.
        -
        Parameters:
        theApplet - the PApplet reference
        p0 - horizontal position
        p1 - vertical position
        p2 - width of the panel
        p3 - height of the panel (excl. tab)
        text - to appear on tab
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setText

        -
        public void setText(String text)
        -
        Description copied from class: GTextBase
        -
        Set the text to be displayed.
        -
        -
        Overrides:
        -
        setText in class GTextBase
        -
        -
      • -
      - - - -
        -
      • -

        setFont

        -
        public void setFont(Font font)
        -
        Description copied from class: GTextBase
        -
        Set the font to be used in this control
        -
        -
        Overrides:
        -
        setFont in class GTextBase
        -
        Parameters:
        font - AWT font to use
        -
      • -
      - - - -
        -
      • -

        draw

        -
        public void draw()
        -
        Draw the panel. - If tabOnly == true - then display the tab only - else - draw tab and all child (added) components
        -
        -
        Overrides:
        -
        draw in class GAbstractControl
        -
        -
      • -
      - - - -
        -
      • -

        isOver

        -
        public boolean isOver(float x,
        -             float y)
        -
        Determines if a particular pixel position is over the panel taking - into account whether it is collapsed or not.
        -
        -
        Overrides:
        -
        isOver in class GAbstractControl
        -
        Returns:
        true if the position is over.
        -
      • -
      - - - -
        -
      • -

        mouseEvent

        -
        public void mouseEvent(processing.event.MouseEvent event)
        -
        All GUI components are registered for mouseEvents
        -
        -
        Overrides:
        -
        mouseEvent in class GAbstractControl
        -
        -
      • -
      - - - -
        -
      • -

        setOpaque

        -
        public void setOpaque(boolean opaque)
        -
        Determines whether to show the tab and panel back colour. If the - parameter is the same as the current state then no changes will - be made.
        - If the parameter is false then the panel will be
        -
          -
        • expanded
        • -
        • made non-collasible
        • -
        • made unavailable to mouse control (so can't be dragged)
        • -
        - If the parameter is true then the panel will remain non-collapsible - and the user must change this if required.
        -
        -
        Overrides:
        -
        setOpaque in class GAbstractControl
        -
        Parameters:
        opaque -
        -
      • -
      - - - -
        -
      • -

        isDragging

        -
        public boolean isDragging()
        -
        This method is used to discover whether the panel is being - dragged to a new position on the screen.
        -
        -
        Overrides:
        -
        isDragging in class GAbstractControl
        -
        Returns:
        true if being dragged to a new position
        -
      • -
      - - - -
        -
      • -

        setDraggable

        -
        public void setDraggable(boolean draggable)
        -
        Sets whether the panel can be dragged by the mouse or not.
        -
        Parameters:
        draggable -
        -
      • -
      - - - -
        -
      • -

        isDraggable

        -
        public boolean isDraggable()
        -
        Can we drag this panel with the mouse?
        -
        Returns:
        true if draggable
        -
      • -
      - - - -
        -
      • -

        setCollapsed

        -
        public void setCollapsed(boolean collapse)
        -
        Collapse or open the panel
        -
        Parameters:
        collapse -
        -
      • -
      - - - -
        -
      • -

        isCollapsed

        -
        public boolean isCollapsed()
        -
        Find out if the panel is collapsed
        -
        Returns:
        true if collapsed
        -
      • -
      - - - -
        -
      • -

        setCollapsible

        -
        public void setCollapsible(boolean c)
        -
        Determine whether the panel can be collapsed when the title bar is clicked.
        - - If this is set to false then the panel will be expanded and it will - not be possible to collapse it until set back to true.
        -
      • -
      - - - -
        -
      • -

        isCollapsible

        -
        public boolean isCollapsible()
        -
        Is this panel collapsible
        -
      • -
      - - - -
        -
      • -

        getTabHeight

        -
        public int getTabHeight()
        -
      • -
      - - - -
        -
      • -

        setDragArea

        -
        public boolean setDragArea(float xMin,
        -                  float yMin,
        -                  float xMax,
        -                  float yMax)
        -
        Provided the panel is physically small enough this method will set the area - within which the panel can be dragged and move the panel inside the area if - not already inside.
        -
        Parameters:
        xMin -
        yMin -
        xMax -
        yMax -
        -
        Returns:
        true if the constraint was applied successfully else false
        -
      • -
      - - - -
        -
      • -

        setDragArea

        -
        public boolean setDragArea()
        -
        Provided the panel is small enough to fit inside the display area then - the panel will be constrained to fit inside the display area.
        -
        Returns:
        true if the constraint was applied successfully else false
        -
      • -
      - - - -
        -
      • -

        clearDragArea

        -
        public void clearDragArea()
        -
        Remove any drag constraint from this panel.
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GPassword.html b/Processing/libraries/G4P/reference/g4p_controls/GPassword.html deleted file mode 100644 index b02a43d..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GPassword.html +++ /dev/null @@ -1,1324 +0,0 @@ - - - - - -GPassword (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GPassword

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Focusable, GConstants, processing.core.PConstants
    -
    -
    -
    -
    public final class GPassword
    -extends GAbstractControl
    -implements Focusable
    -
    The password field component.
    - - This control allows the user to secretly enter a password and supports an - optional horizontal scrollbar.
    - - Each key typed will display a # character, but the user can specify another character.
    - - Unlike a text field it does not support text selection or the copying and pasting of - text via the clipboard.
    - - Fires CHANGED, ENTERED, LOST_FOCUS, GETS_FOCUS events.
    - The focus events are only fired if the control is added to a GTabManager object.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        GPassword

        -
        public GPassword(processing.core.PApplet theApplet,
        -         float p0,
        -         float p1,
        -         float p2,
        -         float p3)
        -
        Create a password field without a scrollbar.
        -
        Parameters:
        theApplet -
        p0 -
        p1 -
        p2 -
        p3 -
        -
      • -
      - - - -
        -
      • -

        GPassword

        -
        public GPassword(processing.core.PApplet theApplet,
        -         float p0,
        -         float p1,
        -         float p2,
        -         float p3,
        -         int sbPolicy)
        -
        Create a password field with the given scrollbar policy.
        - This policy can be one of these
        -
          -
        • SCROLLBARS_NONE
        • -
        • SCROLLBARS_HORIZONTAL_ONLY
        • -
        - If you want the scrollbar to auto hide then perform a logical or with -
          -
        • SCROLLBARS_AUTOHIDE
        • -
        - e.g. SCROLLBARS_HORIZONTAL_ONLY | SCROLLBARS_AUTOHIDE -
        -
        Parameters:
        theApplet -
        p0 -
        p1 -
        p2 -
        p3 -
        sbPolicy -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setVisibleChar

        -
        public void setVisibleChar(char c)
        -
        Set the character that will be displayed instead of the actual character - entered by the user.
        - Default value is '#'
        -
      • -
      - - - -
        -
      • -

        getPassword

        -
        public String getPassword()
        -
        Get the current password (hidden) value of this field.
        -
        Returns:
        actual password text
        -
      • -
      - - - -
        -
      • -

        getWordLength

        -
        public int getWordLength()
        -
        Get the current length of the password entered.
        -
      • -
      - - - -
        -
      • -

        setMaxWordLength

        -
        public void setMaxWordLength(int ml)
        -
        Sets the max length of the password. This method is ignored if the control - already holds some user input.
        - The default value is 10.
        -
        Parameters:
        ml - the new max length (must be >= 1)
        -
      • -
      - - - -
        -
      • -

        setFont

        -
        public void setFont(Font font)
        -
        Set the font to be used in this control
        -
        Parameters:
        font - AWT font to use
        -
      • -
      - - - -
        -
      • -

        getSnapshot

        -
        public processing.core.PGraphics getSnapshot()
        -
        Description copied from class: GAbstractControl
        -
        This method should be used sparingly since it is heavy on resources.
        -
        -
        Overrides:
        -
        getSnapshot in class GAbstractControl
        -
        Returns:
        a PGraphics object showing current state of the control (ignoring rotation)
        -
      • -
      - - - - - - - -
        -
      • -

        flashCaret

        -
        public void flashCaret(GTimer timer)
        -
        Do not call this directly. A timer calls this method as and when required.
        -
      • -
      - - - -
        -
      • -

        mouseEvent

        -
        public void mouseEvent(processing.event.MouseEvent event)
        -
        -
        Overrides:
        -
        mouseEvent in class GAbstractControl
        -
        -
      • -
      - - - -
        -
      • -

        keyEvent

        -
        public void keyEvent(processing.event.KeyEvent e)
        -
        -
        Overrides:
        -
        keyEvent in class GAbstractControl
        -
        -
      • -
      - - - - - - - -
        -
      • -

        setFocus

        -
        public void setFocus(boolean focus)
        -
        Determines whether this component is to have focus or not.
        -
        -
        Overrides:
        -
        setFocus in class GAbstractControl
        -
        -
      • -
      - - - -
        -
      • -

        setLocalColorScheme

        -
        public void setLocalColorScheme(int cs)
        -
        Sets the local colour scheme for this control
        -
        -
        Overrides:
        -
        setLocalColorScheme in class GAbstractControl
        -
        Parameters:
        cs - the colour scheme to use (0-15 incl.)
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GSketchPad.html b/Processing/libraries/G4P/reference/g4p_controls/GSketchPad.html deleted file mode 100644 index d073d14..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GSketchPad.html +++ /dev/null @@ -1,1055 +0,0 @@ - - - - - -GSketchPad (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GSketchPad

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    GConstants, processing.core.PConstants
    -
    -
    -
    -
    public class GSketchPad
    -extends GAbstractControl
    -
    Display area for user generated graphics.
    - - This control will display a PGraphics object created and updated by the user. - If the size of the users graphic is different from the control the output will be - rescaled to fit the control size irrespective of the aspect ratio.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
- -
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GSlider.html b/Processing/libraries/G4P/reference/g4p_controls/GSlider.html deleted file mode 100644 index 2167d3a..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GSlider.html +++ /dev/null @@ -1,1078 +0,0 @@ - - - - - -GSlider (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GSlider

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    GConstants, processing.core.PConstants
    -
    -
    -
    -
    public class GSlider
    -extends GLinearTrackControl
    -
    A simple graphical slider. - - Either drag the thumb or click on the track to change the slider value.
    - - Supports
    - user defined limits (ascending or descending values)
    - numeric display for limits and current value
    - track ticks and stick to ticks
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
- -
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GSlider2D.html b/Processing/libraries/G4P/reference/g4p_controls/GSlider2D.html deleted file mode 100644 index 949a81d..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GSlider2D.html +++ /dev/null @@ -1,1498 +0,0 @@ - - - - - -GSlider2D (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GSlider2D

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    GConstants, processing.core.PConstants
    -
    -
    -
    -
    public class GSlider2D
    -extends GValueControl2D
    -
    This slider is used to control 2 variables by dragging the thumb over - a 2D surface. It has all the features of the standard slider (GSlider) - except that it does not have ticks or stick-to-ticks functionality.
    - - If no limits are set then the control will return a value in the range - 0.0 to 1.0 for both the x and the y axis. The setXlimits and setYlimits - can be used to set a different range for each axis independently. - - The minimum size for this control is 40x40 pixels and this is enforced - when the control is created. If necessary the width and/or height the - rectangle will be increased to 40pixels.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        GSlider2D

        -
        public GSlider2D(processing.core.PApplet theApplet,
        -         float p0,
        -         float p1,
        -         float p2,
        -         float p3)
        -
        Create a 2D slider inside the specified rectangle.
        -
        Parameters:
        theApplet -
        p0 -
        p1 -
        p2 -
        p3 -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setEasing

        -
        public void setEasing(float easeBy)
        -
        Set the amount of easing to be used when a value is changing. The default value - is 1 (no easing) values > 1 will cause the value to rush from its starting value - and decelerate towards its final values. In other words it smoothes the movement - of the slider thumb or knob rotation.
        -
        Parameters:
        easeBy - the easing to set
        -
      • -
      - - - -
        -
      • -

        setXlimits

        -
        public void setXlimits(int start,
        -              int end)
        -
        X (horz) limits - Sets the range of values to be returned. This method will - assume that you want to set the valueType to INTEGER
        -
        Parameters:
        start - the start value of the range
        end - the end value of the range
        -
      • -
      - - - -
        -
      • -

        setLimitsX

        -
        public void setLimitsX(int initValue,
        -              int start,
        -              int end)
        -
        X (horz) limits - Sets the initial value and the range of values to be returned. This - method will assume that you want to set the valueType to INTEGER.
        -
        Parameters:
        initValue - the initial value
        start - the start value of the range
        end - the end value of the range
        -
      • -
      - - - -
        -
      • -

        setLimitsX

        -
        public void setLimitsX(float start,
        -              float end)
        -
        X (horz) limits - Sets the range of values to be returned. This method will - assume that you want to set the valueType to DECIMAL
        -
        Parameters:
        start -
        end -
        -
      • -
      - - - -
        -
      • -

        setLimitsX

        -
        public void setLimitsX(float initValue,
        -              float start,
        -              float end)
        -
        X (horz) limits - Sets the initial value and the range of values to be returned. This - method will assume that you want to set the valueType to DECIMAL.
        -
        Parameters:
        initValue - the initial value
        start - the start value of the range
        end - the end value of the range
        -
      • -
      - - - -
        -
      • -

        setLimitsY

        -
        public void setLimitsY(int start,
        -              int end)
        -
        Y (vert) limits - Sets the range of values to be returned. This method will - assume that you want to set the valueType to INTEGER
        -
        Parameters:
        start - the start value of the range
        end - the end value of the range
        -
      • -
      - - - -
        -
      • -

        setLimitsY

        -
        public void setLimitsY(int initValue,
        -              int start,
        -              int end)
        -
        Y (vert) limits - Sets the initial value and the range of values to be returned. This - method will assume that you want to set the valueType to INTEGER.
        -
        Parameters:
        initValue - the initial value
        start - the start value of the range
        end - the end value of the range
        -
      • -
      - - - -
        -
      • -

        setLimitsY

        -
        public void setLimitsY(float start,
        -              float end)
        -
        Y (vert) limits - Sets the range of values to be returned. This method will - assume that you want to set the valueType to DECIMAL
        -
        Parameters:
        start -
        end -
        -
      • -
      - - - -
        -
      • -

        setLimitsY

        -
        public void setLimitsY(float initValue,
        -              float start,
        -              float end)
        -
        Y (vert) limits - Sets the initial value and the range of values to be returned. This - method will assume that you want to set the valueType to DECIMAL.
        -
        Parameters:
        initValue - the initial value
        start - the start value of the range
        end - the end value of the range
        -
      • -
      - - - -
        -
      • -

        setValueX

        -
        public void setValueX(float v)
        -
        Set the X (horz) value for the slider.
        - The value supplied will be constrained to the current limits.
        -
        Parameters:
        v - the new value
        -
      • -
      - - - -
        -
      • -

        setValueY

        -
        public void setValueY(float v)
        -
        Set the Y (vert) value for the slider.
        - The value supplied will be constrained to the current limits.
        -
        Parameters:
        v - the new value
        -
      • -
      - - - -
        -
      • -

        setValueXY

        -
        public void setValueXY(float vx,
        -              float vy)
        -
        Set both the XY values for the slider.
        - The values supplied will be constrained to the appropriate current limits.
        -
        Parameters:
        vx - the new X (horz) value
        vy - the new Y (vert) value
        -
      • -
      - - - -
        -
      • -

        getValueXF

        -
        public float getValueXF()
        -
        Get the current X value as a float
        -
      • -
      - - - -
        -
      • -

        getValueXI

        -
        public int getValueXI()
        -
        Get the current X value as an integer.
        - DECIMAL and EXPONENT value types will be rounded to the nearest integer.
        -
      • -
      - - - -
        -
      • -

        getValueXS

        -
        public String getValueXS()
        -
        Get the current X value as a string taking into account the number format.
        -
      • -
      - - - -
        -
      • -

        getValueYF

        -
        public float getValueYF()
        -
        Get the current Y value as a float
        -
      • -
      - - - -
        -
      • -

        getValueYI

        -
        public int getValueYI()
        -
        Get the current Y value as an integer.
        - DECIMAL and EXPONENT value types will be rounded to the nearest integer.
        -
      • -
      - - - -
        -
      • -

        getValueYS

        -
        public String getValueYS()
        -
        Get the current Y value as a string taking into account the number format.
        -
      • -
      - - - -
        -
      • -

        setPrecision

        -
        public void setPrecision(int nd)
        -
        For DECIMAL values this sets the number of decimal places to - be displayed.
        -
        Parameters:
        nd - must be >= 1 otherwise will use 1
        -
      • -
      - - - -
        -
      • -

        setNumberFormat

        -
        public void setNumberFormat(int numberFormat,
        -                   int precision)
        -
        Set the numberFormat and precision in one go.
        - Valid number formats are INTEGER, DECIMAL, EXPONENT
        - Precision must be >= 1 and is ignored for INTEGER.
        -
        Parameters:
        numberFormat - G4P.INTEGER, G4P.DECIMAL orG4P. EXPONENT
        precision - must be >= 1
        -
      • -
      - - - -
        -
      • -

        setNumberFormat

        -
        public void setNumberFormat(int numberFormat)
        -
        Set the numberFormat and precision in one go.
        - Valid number formats are INTEGER, DECIMAL, EXPONENT
        - Precision must be >= 1 and is ignored for INTEGER.
        -
        Parameters:
        numberFormat - G4P.INTEGER, G4P.DECIMAL or G4P.EXPONENT
        -
      • -
      - - - -
        -
      • -

        mouseEvent

        -
        public void mouseEvent(processing.event.MouseEvent event)
        -
        -
        Overrides:
        -
        mouseEvent in class GAbstractControl
        -
        -
      • -
      - - - - -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GStick.html b/Processing/libraries/G4P/reference/g4p_controls/GStick.html deleted file mode 100644 index 5bbffa5..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GStick.html +++ /dev/null @@ -1,1213 +0,0 @@ - - - - - -GStick (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GStick

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    GConstants, processing.core.PConstants
    -
    -
    -
    -
    public class GStick
    -extends GAbstractControl
    -
    This control simulates a digital joystick and is designed to give more - intuitive control in game scenarios where you might use the keyboard - e.g. WASD keys for movement.
    - - The joystick has two modes - in the default mode the joystick just - responds to movement in 4 directions (left,right, up and down) the - second mode allows for diagonals so recognises 8 directions.
    - - As in a real joystick you have a dead zone near the centre which - does not generate signals, thus avoiding jitter. This area is shown - graphically.
    - - The direction of the joystick is represented by an integer in the - range 0-7 and -1 when in the dead zone.
    -
    -     5   6   7
    -                \  |  /
    -       \ | /
    -   4 --- + --- 0         + is the dea zone so -1
    -       / | \
    -      /  |  \
    -     3   2   1
    - 

    - As well as the direction there are two useful methods to decode these - into X and Y directions -
    getStickX()
    and
    getStickY()
    - which give the values.
    -
    - X= -1   0   +1 
    -                \  |  /  -1
    -       \ | /
    -     --- + ---  0
    -       / | \
    -      /  |  \
    -           Y=  +1
    - 

    - The stick will auto-center when released.
    - - The minimum size for this control is 40x40 pixels and this is enforced - when the control is created. If necessary the width and/or height the - rectangle will be increased to 40pixels.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
- -
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GTabManager.html b/Processing/libraries/G4P/reference/g4p_controls/GTabManager.html deleted file mode 100644 index 1d86e59..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GTabManager.html +++ /dev/null @@ -1,308 +0,0 @@ - - - - - -GTabManager (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GTabManager

-
-
- -
-
    -
  • -
    -
    -
    public class GTabManager
    -extends Object
    -
    Allows TABBING between text controls. - A tab manager allows the user to use the TAB key to move from one text control - (GTextField or GTextArea) to the another. This is useful when creating a 'form' - made from several text controls.
    - The tab order is decided by the order the text controls are added to the tab - manager. The TAB key move the focus forwards and SHIFT+TAB moves it backwards. - Note that tabbing is not cyclic so pressing TAB on the last control does not - set the focus on the first control, in fact it will be ignored. Similar - logic applies to SHIFT_TAB on the first control
    - At least 2 controls must be added to the tab manager.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        GTabManager

        -
        public GTabManager()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        addControls

        -
        public boolean addControls(Focusable... controls)
        -
        Attempt to add multiple controls to the tab manager. The tab order is determined - by their order as parameters to this method.
        -
        Parameters:
        controls - a comma separated list of text field or text area controls.
        -
        Returns:
        true if any or all of the controls were added and false if none were added.
        -
      • -
      - - - -
        -
      • -

        addControl

        -
        public boolean addControl(Focusable control)
        -
        Add the next text control to this tab manager.
        -
        Parameters:
        control - to add
        -
        Returns:
        true if added successfully
        -
      • -
      - - - -
        -
      • -

        removeControl

        -
        public boolean removeControl(Focusable control)
        -
        Remove a control from the tab manager. This does not affect the tab - order of the remaining controls.
        -
        Parameters:
        control -
        -
        Returns:
        true if remove successfully
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GTextAlign.html b/Processing/libraries/G4P/reference/g4p_controls/GTextAlign.html deleted file mode 100644 index 9ef001c..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GTextAlign.html +++ /dev/null @@ -1,1083 +0,0 @@ - - - - - -GTextAlign (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GTextAlign

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    GConstants, processing.core.PConstants
    -
    -
    -
    Direct Known Subclasses:
    -
    GTextIconAlignBase
    -
    -
    -
    -
    public abstract class GTextAlign
    -extends GTextBase
    -
    Is the basis for all classes that have some simple non-editable text element to them.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
- -
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GTextArea.html b/Processing/libraries/G4P/reference/g4p_controls/GTextArea.html deleted file mode 100644 index a2b57c3..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GTextArea.html +++ /dev/null @@ -1,1652 +0,0 @@ - - - - - -GTextArea (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GTextArea

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Focusable, GConstants, processing.core.PConstants
    -
    -
    -
    -
    public class GTextArea
    -extends GEditableTextControl
    -
    The text area component.
    - - This control allows the user to enter and edit multiple lines of text. The control - also allows default text, horizontal and vertical scrollbars.
    - - Enables user to enter text at runtime. Text can be selected using the mouse - or keyboard shortcuts and then copied or cut to the clipboard. Text - can also be pasted in.
    - - There are some methods to add and clear text attributes to all or some of the - text in the control. If a method is expecting a line number, you should specify - the actual line number for the entire text (lines numbers start at 0). It is - not the line number in the visible display because this can change if the text - has been scrolled vertically.
    - - - Fires SELECTION_CHANGED, CHANGED, ENTERED, LOST_FOCUS, GETS_FOCUS events.
    - The focus events are only fired if the control is added to a GTabManager object.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        GTextArea

        -
        public GTextArea(processing.core.PApplet theApplet,
        -         float p0,
        -         float p1,
        -         float p2,
        -         float p3)
        -
        Create a text area without scrollbars and a text wrap width to fit the control.
        -
        Parameters:
        theApplet -
        p0 -
        p1 -
        p2 -
        p3 -
        -
      • -
      - - - -
        -
      • -

        GTextArea

        -
        public GTextArea(processing.core.PApplet theApplet,
        -         float p0,
        -         float p1,
        -         float p2,
        -         float p3,
        -         int sbPolicy)
        -
        Create a text field with the given scrollbar policy and a text wrap width to fit the control.
        - The scrollbar policy can be one of these
        -
          -
        • SCROLLBARS_NONE
        • -
        • SCROLLBARS_HORIZONTAL_ONLY
        • -
        • SCROLLBARS_VERTICAL_ONLY
        • -
        • SCROLLBARS_BOTH
        • -
        - If you want the scrollbar to auto hide then perform a logical or with -
          -
        • SCROLLBARS_AUTOHIDE
        • -
        - e.g. SCROLLBARS_BOTH | SCROLLBARS_AUTOHIDE -
        -
        Parameters:
        theApplet -
        p0 -
        p1 -
        p2 -
        p3 -
        sbPolicy -
        -
      • -
      - - - -
        -
      • -

        GTextArea

        -
        public GTextArea(processing.core.PApplet theApplet,
        -         float p0,
        -         float p1,
        -         float p2,
        -         float p3,
        -         int sbPolicy,
        -         int wrapWidth)
        -
        Create a text field with the given scrollbar policy with a user specified text wrap length
        -
        Parameters:
        theApplet -
        p0 -
        p1 -
        p2 -
        p3 -
        sbPolicy -
        wrapWidth -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setText

        -
        public void setText(String text,
        -           int wrapWidth)
        -
        Set the text to display and adjust any scrollbars
        -
        Parameters:
        text - text to display
        wrapWidth - the wrap width
        -
      • -
      - - - -
        -
      • -

        setText

        -
        public void setText(String text)
        -
        Set the text to be used. The wrap width is determined by the current - text wrapwidth or if there is no text then the text width - of the control.
        -
        -
        Overrides:
        -
        setText in class GTextBase
        -
        Parameters:
        text - to be displayed
        -
      • -
      - - - -
        -
      • -

        setText

        -
        public void setText(String[] lines)
        -
        Set the text to display and adjust any scrollbars
        -
        Parameters:
        lines - an array of Strings representing the text to display
        -
      • -
      - - - -
        -
      • -

        setText

        -
        public void setText(String[] lines,
        -           int wrapWidth)
        -
        Set the text to display and adjust any scrollbars
        -
        Parameters:
        lines - an array of Strings representing the text to display
        wrapWidth - the wrap width
        -
      • -
      - - - -
        -
      • -

        getTextAsArray

        -
        public String[] getTextAsArray()
        -
        Get the text as a String array. (splitting on line breaks).
        -
        Returns:
        the associated plain text as a String array split on line breaks
        -
      • -
      - - - -
        -
      • -

        addStyle

        -
        public void addStyle(TextAttribute attr,
        -            Object value,
        -            int lineNo,
        -            int charStart,
        -            int charEnd)
        -
        Adds the text attribute to a range of characters on a particular display line. If charEnd - is past the EOL then the attribute will be applied to the end-of-line.
        -
        Parameters:
        attr - the text attribute to add
        value - value of the text attribute
        lineNo - the display line number (starts at 0)
        charStart - the position of the first character to apply the attribute
        charEnd - the position after the last character to apply the attribute
        -
      • -
      - - - -
        -
      • -

        addStyle

        -
        public void addStyle(TextAttribute attr,
        -            Object value,
        -            int lineNo)
        -
        Adds the text attribute to an entire display line.
        -
        Parameters:
        attr - the text attribute to add
        value - value of the text attribute
        lineNo - the display line number (starts at 0)
        -
      • -
      - - - -
        -
      • -

        clearStyles

        -
        public void clearStyles(int lineNo,
        -               int charStart,
        -               int charEnd)
        -
        Clears all text attribute from a range of characters on a particular display line. - If charEnd is past the EOL then the attributes will be cleared to the - end-of-line.
        -
        Parameters:
        lineNo - the display line number (starts at 0)
        charStart - the position of the first character to apply the attribute
        charEnd - the position after the last character to apply the attribute
        -
      • -
      - - - -
        -
      • -

        clearStyles

        -
        public void clearStyles(int lineNo)
        -
        Clears all text attribute from an entire display line.
        -
        Parameters:
        lineNo - the display line number (starts at 0)
        -
      • -
      - - - - - - - -
        -
      • -

        appendText

        -
        public boolean appendText(String text)
        -
        Add text to the end of the current text. This is useful for a logging' type activity.
        - - No events will be generated and the caret will be moved to the end of any appended text.
        -
        Parameters:
        text - the text to append
        -
        Returns:
        true if some characters were added
        -
      • -
      - - - -
        -
      • -

        insertText

        -
        public boolean insertText(String text,
        -                 int lineNo,
        -                 int charNo)
        -
        Insert text at the display position specified.
        - - The area line number starts at 0 and includes any lines scrolled off the top. So if - three lines have been scrolled off the top the first visible line is number 3.
        - - No events will be generated and the caret will be moved to the end of any inserted text.
        -
        Parameters:
        text - the text to insert
        lineNo - the area line number
        charNo - the character position to insert text in display line
        -
        Returns:
        true if some characters were inserted
        -
      • -
      - - - -
        -
      • -

        insertText

        -
        public boolean insertText(String text,
        -                 int lineNo,
        -                 int charNo,
        -                 boolean startWithEOL,
        -                 boolean endWithEOL)
        -
        Insert text at the display position specified.
        - - The area line number starts at 0 and includes any lines scrolled off the top. So if - three lines have been scrolled off the top the first visible line is number 3.
        - - No events will be generated and the caret will be moved to the end of any inserted text.
        -
        Parameters:
        text - the text to insert
        lineNo - the area line number
        charNo - the character position to insert text in display line
        startWithEOL - if true,inserted text will start on newline
        endWithEOL - if true, text after inserted text will start on new line
        -
        Returns:
        true if some characters were inserted
        -
      • -
      - - - -
        -
      • -

        insertText

        -
        public boolean insertText(String text,
        -                 boolean startWithEOL,
        -                 boolean endWithEOL)
        -
        Insert text at the current caret position. If the current caret position is undefined - the text will be inserted at the beginning of the text.
        - - No events will be generated and the caret will be moved to the end of any inserted text.
        -
        Parameters:
        text - the text to insert
        startWithEOL - if true,inserted text will start on newline
        endWithEOL - if true, text after inserted text will start on new line
        -
        Returns:
        true if some characters were inserted
        -
      • -
      - - - -
        -
      • -

        insertText

        -
        public boolean insertText(String text)
        -
        Insert text at the current caret position. If the current caret position is undefined - the text will be inserted at the beginning of the text.
        - - No events will be generated and the caret will be moved to the end of any inserted text.
        -
        Parameters:
        text - the text to insert
        -
        Returns:
        true if some characters were inserted
        -
      • -
      - - - -
        -
      • -

        getText

        -
        public String getText(int lineNo)
        -
        Get the text on a particular line in the text area.
        - The line does not need to be visible and the line numbers - always start at 0.
        - The result is not dependent on what is visible at any - particular time but on the overall position in text area - control.
        - If the line number is invalid then an empty string is returned.
        - Trailing EOL characters are removed.
        -
        Parameters:
        lineNo - the text area line number we want
        -
        Returns:
        the plain text in a display line
        -
      • -
      - - - -
        -
      • -

        getTextLength

        -
        public int getTextLength(int lineNo,
        -                boolean ignoreEOL)
        -
        Get the length of text on a particular line in the text area.
        - The line does not need to be visible and the line numbers - always start at 0.
        - The result is not dependent on what is visible at any - particular time but on the overall position in text area - control.
        - If ignoreEOL is true then EOL characters are not included in the count.
        -
        Parameters:
        lineNo - the text area line number we want
        ignoreEOL - if true do not include trailing end=of-line characters
        -
        Returns:
        the length of the line, or <) if the line number is invalid
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        getSnapshot

        -
        public processing.core.PGraphics getSnapshot()
        -
        Description copied from class: GAbstractControl
        -
        This method should be used sparingly since it is heavy on resources.
        -
        -
        Overrides:
        -
        getSnapshot in class GAbstractControl
        -
        Returns:
        a PGraphics object showing current state of the control (ignoring rotation)
        -
      • -
      - - - -
        -
      • -

        moveCaretTo

        -
        public void moveCaretTo(int lineNo,
        -               int charNo)
        -
        Move the insertion point (caret) to the specified line and character. If the position is invalid - then the caret is not moved. The text will be scrolled so that the caret position is visible.
        -
        Parameters:
        lineNo - the line number (starts at 0)
        charNo - the character position on the line (starts at 0)
        -
      • -
      - - - -
        -
      • -

        getCaretPos

        -
        public int[] getCaretPos()
        -
        Get the current caret position.
        - - The method will always return a 2 element array with the current caret position - { line no, char no }
        - - If the current caret position is undefined then it will return the array { -1, -1 }
        -
        Returns:
        a two element int array holding the caret position.
        -
      • -
      - - - -
        -
      • -

        getCaretPos

        -
        public int[] getCaretPos(int[] cpos)
        -
        Get the current caret position.
        - - If the parameter is a 2 element int array then it will be populated with the line number [0] - and character no [1] of the caret's current position.
        - - The method will always return a 2 element array with the current caret position - { line no, char no }
        - - If the current caret position is undefined then it will return the array { -1, -1 }
        -
        Parameters:
        cpos - array to be populated with caret position
        -
        Returns:
        a two element int array holding the caret position.
        -
      • -
      - - - -
        -
      • -

        mouseEvent

        -
        public void mouseEvent(processing.event.MouseEvent event)
        -
        Will respond to mouse events.
        -
        -
        Overrides:
        -
        mouseEvent in class GAbstractControl
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GTextBase.html b/Processing/libraries/G4P/reference/g4p_controls/GTextBase.html deleted file mode 100644 index fb15ac9..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GTextBase.html +++ /dev/null @@ -1,1271 +0,0 @@ - - - - - -GTextBase (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GTextBase

-
-
- -
- -
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        GTextBase

        -
        public GTextBase(processing.core.PApplet theApplet,
        -         float p0,
        -         float p1,
        -         float p2,
        -         float p3)
        -
        Constructor
        -
        Parameters:
        theApplet -
        p0 -
        p1 -
        p2 -
        p3 -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setText

        -
        public void setText(String text)
        -
        Set the text to be displayed.
        -
        Parameters:
        text -
        -
      • -
      - - - -
        -
      • -

        loadText

        -
        public boolean loadText(String fname)
        -
        Load the styled string to be used by this control.
        -
        Parameters:
        fname - the name of the file to use
        -
        Returns:
        true if loaded successfully else false
        -
      • -
      - - - -
        -
      • -

        saveText

        -
        public boolean saveText(String fname)
        -
        Save the styled text used by this control to file.
        -
        Parameters:
        fname - the name of the file to use
        -
        Returns:
        true if saved successfully else false
        -
      • -
      - - - -
        -
      • -

        setFont

        -
        public void setFont(Font font)
        -
        Set the font to be used in this control
        -
        Parameters:
        font - AWT font to use
        -
      • -
      - - - -
        -
      • -

        setStyledText

        -
        public void setStyledText(StyledString ss)
        -
        Allows the user to provide their own styled text for this component
        -
        Parameters:
        ss -
        -
      • -
      - - - -
        -
      • -

        forceBufferUpdate

        -
        public void forceBufferUpdate()
        -
        Description copied from class: GAbstractControl
        -
        This is for emergency use only!!!!
        - In this version of the library a visual controls is drawn to off-screen buffer - and then drawn to the screen by copying the buffer. This means that the - computationally expensive routines needed to draw the control (especially text - controls) are only done when a change has been noted. This means that single - changes need not trigger a full redraw to buffer.
        - It does mean that an error in the library code could result in the buffer not - being updated after changes. If this happens then in draw() call this method - on the affected control, and report it as an issue - here
        - Thanks
        -
        -
        Overrides:
        -
        forceBufferUpdate in class GAbstractControl
        -
        -
      • -
      - - - -
        -
      • -

        setTextPlain

        -
        public void setTextPlain()
        -
        Clear all applied styles from the whole text.
        -
      • -
      - - - -
        -
      • -

        setTextBold

        -
        public void setTextBold(int start,
        -               int end)
        -
        Make the selected characters bold.
        - Characters affected are >= start and < end
        -
        Parameters:
        start - the first character to style
        end - the first character not to style
        -
      • -
      - - - -
        -
      • -

        setTextBold

        -
        public void setTextBold()
        -
        Make all the characters bold.
        -
      • -
      - - - -
        -
      • -

        setTextItalic

        -
        public void setTextItalic(int start,
        -                 int end)
        -
        Make the selected characters italic.
        - Characters affected are >= start and < end
        -
        Parameters:
        start - the first character to style
        end - the first character not to style
        -
      • -
      - - - -
        -
      • -

        setTextItalic

        -
        public void setTextItalic()
        -
        Make all the characters italic.
        -
      • -
      - - - -
        -
      • -

        getStyledText

        -
        public StyledString getStyledText()
        -
        Get the text used for this control.
        -
        Returns:
        the displayed text with styling
        -
      • -
      - - - -
        -
      • -

        getText

        -
        public String getText()
        -
        Get the text used for this control.
        -
        Returns:
        the displayed text without styling
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GTextField.html b/Processing/libraries/G4P/reference/g4p_controls/GTextField.html deleted file mode 100644 index 609cc64..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GTextField.html +++ /dev/null @@ -1,1271 +0,0 @@ - - - - - -GTextField (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GTextField

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Focusable, GConstants, processing.core.PConstants
    -
    -
    -
    -
    public class GTextField
    -extends GEditableTextControl
    -
    The text field component.
    - - This control allows the user to enter and edit a single line of text. The control - also allows default text and a horizontal scrollbar. - - can be created to manage either a single line of text or - multiple lines of text.
    - - Enables user text input at runtime. Text can be selected using the mouse - or keyboard shortcuts and then copied or cut to the clipboard. Text - can also be pasted in.
    - - Fires SELECTION_CHANGED, CHANGED, ENTERED, LOST_FOCUS, GETS_FOCUS events.
    - The focus events are only fired if the control is added to a GTabManager object.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
- -
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GTextIconAlignBase.html b/Processing/libraries/G4P/reference/g4p_controls/GTextIconAlignBase.html deleted file mode 100644 index 7c81dd8..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GTextIconAlignBase.html +++ /dev/null @@ -1,1179 +0,0 @@ - - - - - -GTextIconAlignBase (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GTextIconAlignBase

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    GConstants, processing.core.PConstants
    -
    -
    -
    Direct Known Subclasses:
    -
    GButton, GLabel, GToggleControl
    -
    -
    -
    -
    public abstract class GTextIconAlignBase
    -extends GTextAlign
    -
    Base class for controls with text and/or icon.
    - - This class forms the basis for any control that has text and/or an icon.
    - Use the setIcon, setIconAlign, setText and setTextAlign to control - horizontal and vertical alignment of the icon and text within the control face.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
- -
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GTimer.html b/Processing/libraries/G4P/reference/g4p_controls/GTimer.html deleted file mode 100644 index 5284414..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GTimer.html +++ /dev/null @@ -1,1199 +0,0 @@ - - - - - -GTimer (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GTimer

-
-
- -
-
    -
  • -
    -
    -
    public class GTimer
    -extends Object
    -
    This class is used to trigger events at user defined intervals. The event will - call a user defined method/function. The only restriction is that the method - used has a single parameter of type GTimer and returns void eg
    -
    - void fireBall(GTimer timer){ ... }
    - 

    - - Each timer object must have its own handler - - It has no visible GUI representation so will not appear in the GUI.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        GTimer

        -
        public GTimer(processing.core.PApplet theApplet,
        -      Object obj,
        -      String methodName,
        -      int delay)
        -
        Create the GTimer object with this ctor. - - 'methodName' is the method/function to be called every 'interval' - milliseconds. 'obj' is the object that contains the method/function - 'methodName' - - For most users 'methodName' will be in their main sketch so this - parameter has the same value as 'theApplet'
        -
        Parameters:
        theApplet - a reference to the PApplet object (invariably this)
        obj - the object that has the method to be executed (likely to be this)
        methodName - the name of the method to be called by the timer
        delay - the initial delay and the time (in millisecs) between function calls
        -
      • -
      - - - -
        -
      • -

        GTimer

        -
        public GTimer(processing.core.PApplet theApplet,
        -      Object obj,
        -      String methodName,
        -      int delay,
        -      int initDelay)
        -
        Create the GTimer object with this ctor. - - 'methodName' is the method/function to be called every 'interval' - milliseconds. 'obj' is the object that contains the method/function - 'methodName' - - For most users 'methodName' will be in their main sketch so this - parameter has the same value as 'theApplet'
        -
        Parameters:
        theApplet - a reference to the PApplet object (invariably this)
        obj - the object that has the method to be executed (likely to be this)
        methodName - the name of the method to be called by the timer
        delay - the time (in millisecs) between function calls
        initDelay - the initial delay (in millisecs)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        start

        -
        public void start()
        -
        Start the timer (call the method forever)
        -
      • -
      - - - -
        -
      • -

        start

        -
        public void start(int nrepeats)
        -
        Start the timer and call the method for the number of - times indicated by nrepeats - If nrepeats is <=0 then repeat forever
        -
        Parameters:
        nrepeats -
        -
      • -
      - - - -
        -
      • -

        stop

        -
        public void stop()
        -
        Stop the timer (can be restarted with start() method)
        -
      • -
      - - - -
        -
      • -

        isRunning

        -
        public boolean isRunning()
        -
        Is the timer running?
        -
        Returns:
        true if running
        -
      • -
      - - - -
        -
      • -

        setInterval

        -
        public void setInterval(int interval)
        -
        Set the interval between events
        -
        Parameters:
        interval - delay between events in milliseconds
        -
      • -
      - - - -
        -
      • -

        setInitialDelay

        -
        public void setInitialDelay(int initDelay)
        -
        Set the delay before the first event is triggered
        -
        Parameters:
        initDelay - initial delay in milliseconds
        -
      • -
      - - - -
        -
      • -

        setDelay

        -
        public void setDelay(int delay)
        -
        Sets the initial delay and the interval between events.
        - This is equivalent to calling both -
        -
        - setInterval(delay);
        - setInitialDelay(delay);
        - 

        -
        Parameters:
        delay - initial delay and interval in milliseconds
        -
      • -
      - - - -
        -
      • -

        getInterval

        -
        public int getInterval()
        -
        Get the interval time (milliseconds) between - events.
        -
        Returns:
        interval in millsecs or -1 if the timer failed to - be created.
        -
      • -
      - - - -
        -
      • -

        getInitialDelay

        -
        public int getInitialDelay()
        -
        Get the initial delay time (milliseconds).
        -
        Returns:
        initial delay in millsecs or -1 if the timer failed to - be created.
        -
      • -
      - - - -
        -
      • -

        isValid

        -
        public boolean isValid()
        -
        See if the GTimer object has been created successfully
        -
        Returns:
        true if successful
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GToggleControl.html b/Processing/libraries/G4P/reference/g4p_controls/GToggleControl.html deleted file mode 100644 index e86319a..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GToggleControl.html +++ /dev/null @@ -1,1142 +0,0 @@ - - - - - -GToggleControl (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GToggleControl

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    GConstants, processing.core.PConstants
    -
    -
    -
    Direct Known Subclasses:
    -
    GCheckbox, GOption
    -
    -
    -
    -
    public abstract class GToggleControl
    -extends GTextIconAlignBase
    -
    This class forms the basis for any two-state type control (toggle switch).
    - A toggle control can be in one of 2 states selected or not selected - and is the base class for the GOption and GCheckbox controls.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
- -
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GToggleGroup.html b/Processing/libraries/G4P/reference/g4p_controls/GToggleGroup.html deleted file mode 100644 index 45bf083..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GToggleGroup.html +++ /dev/null @@ -1,285 +0,0 @@ - - - - - -GToggleGroup (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GToggleGroup

-
-
- -
-
    -
  • -
    -
    -
    public class GToggleGroup
    -extends Object
    -
    Use this class to create a single selection collection of options.
    - - To use create an object of this class and then add GOption objects to it with - the addControl method.
    - - You cannot add GCheckbox objects because they are designed to work independently.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        GToggleGroup

        -
        public GToggleGroup()
        -
        Create a toggle group object.
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        addControl

        -
        public void addControl(GToggleControl tc)
        -
        Add a GOption object to this group.
        -
        Parameters:
        tc -
        -
      • -
      - - - -
        -
      • -

        addControls

        -
        public void addControls(GToggleControl... controls)
        -
        Add a set of comma separated GOptions.
        -
        Parameters:
        controls -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GValueControl.html b/Processing/libraries/G4P/reference/g4p_controls/GValueControl.html deleted file mode 100644 index 3c9d168..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GValueControl.html +++ /dev/null @@ -1,1607 +0,0 @@ - - - - - -GValueControl (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GValueControl

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    GConstants, processing.core.PConstants
    -
    -
    -
    Direct Known Subclasses:
    -
    GKnob, GLinearTrackControl
    -
    -
    -
    -
    public abstract class GValueControl
    -extends GAbstractControl
    -
    Base class for all slider and knob type controls. - - This class enables the creation of tick marks and constraining values to - the tick mark values.
    - - It also controls how the values are to be displayed INTEGER, DECIMAL or EXPONENT
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        GValueControl

        -
        public GValueControl(processing.core.PApplet theApplet,
        -             float p0,
        -             float p1,
        -             float p2,
        -             float p3)
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        setLimits

        -
        public void setLimits(int start,
        -             int end)
        -
        Sets the range of values to be returned. This method will - assume that you want to set the valueType to INTEGER
        -
        Parameters:
        start - the start value of the range
        end - the end value of the range
        -
      • -
      - - - -
        -
      • -

        setLimits

        -
        public void setLimits(int initValue,
        -             int start,
        -             int end)
        -
        Sets the initial value and the range of values to be returned. This - method will assume that you want to set the valueType to INTEGER.
        -
        Parameters:
        initValue - the initial value
        start - the start value of the range
        end - the end value of the range
        -
      • -
      - - - -
        -
      • -

        setLimits

        -
        public void setLimits(float start,
        -             float end)
        -
        Sets the range of values to be returned. This method will - assume that you want to set the valueType to DECIMAL
        -
        Parameters:
        start -
        end -
        -
      • -
      - - - -
        -
      • -

        setLimits

        -
        public void setLimits(float initValue,
        -             float start,
        -             float end)
        -
        Sets the initial value and the range of values to be returned. This - method will assume that you want to set the valueType to DECIMAL.
        -
        Parameters:
        initValue - the initial value
        start - the start value of the range
        end - the end value of the range
        -
      • -
      - - - -
        -
      • -

        setValue

        -
        public void setValue(float v)
        -
        Set the value for the slider.
        - The user must ensure that the value is valid for the slider range.
        -
        Parameters:
        v -
        -
      • -
      - - - -
        -
      • -

        setPrecision

        -
        public void setPrecision(int nd)
        -
        For DECIMAL values this sets the number of decimal places to - be displayed.
        -
        Parameters:
        nd - must be >= 1 otherwise will use 1
        -
      • -
      - - - -
        -
      • -

        setUnits

        -
        public void setUnits(String units)
        -
        The units to be displayed with the current and limit values e.g. - kg, m, ($), fps etc.
        - Do not use long labels such as 'miles per hour' as these take a - lot of space and can look messy.
        -
        Parameters:
        units - for example kg, m, ($), fps
        -
      • -
      - - - -
        -
      • -

        setNumberFormat

        -
        public void setNumberFormat(int numberFormat,
        -                   int precision,
        -                   String unit)
        -
        Set the numberFormat, precision and units in one go.
        - Valid number formats are INTEGER, DECIMAL, EXPONENT
        - Precision must be >= 1 and is ignored for INTEGER.
        -
        Parameters:
        numberFormat - INTEGER, DECIMAL or EXPONENT
        precision - must be >= 1
        unit - for example kg, m, ($), fps
        -
      • -
      - - - -
        -
      • -

        setNumberFormat

        -
        public void setNumberFormat(int numberFormat,
        -                   int precision)
        -
        Set the numberFormat and precision in one go.
        - Valid number formats are INTEGER, DECIMAL, EXPONENT
        - Precision must be >= 1 and is ignored for INTEGER.
        -
        Parameters:
        numberFormat - G4P.INTEGER, G4P.DECIMAL orG4P. EXPONENT
        precision - must be >= 1
        -
      • -
      - - - -
        -
      • -

        setNumberFormat

        -
        public void setNumberFormat(int numberFormat)
        -
        Set the numberFormat and precision in one go.
        - Valid number formats are INTEGER, DECIMAL, EXPONENT
        - Precision must be >= 1 and is ignored for INTEGER.
        -
        Parameters:
        numberFormat - G4P.INTEGER, G4P.DECIMAL or G4P.EXPONENT
        -
      • -
      - - - -
        -
      • -

        getValueF

        -
        public float getValueF()
        -
        Get the current value as a float
        -
      • -
      - - - -
        -
      • -

        getValueI

        -
        public int getValueI()
        -
        Get the current value as an integer.
        - DECIMAL and EXPONENT value types will be rounded to the nearest integer.
        -
      • -
      - - - -
        -
      • -

        getValueS

        -
        public String getValueS()
        -
        If we are using labels then this will get the label text - associated with the current value.
        - If labels have not been set then return null
        -
      • -
      - - - -
        -
      • -

        getEasing

        -
        public float getEasing()
        -
        Get the current value used for easing.
        -
        Returns:
        the easing
        -
      • -
      - - - -
        -
      • -

        setEasing

        -
        public void setEasing(float easeBy)
        -
        Set the amount of easing to be used when a value is changing. The default value - is 1 (no easing) values > 1 will cause the value to rush from its starting value - and decelerate towards its final values. In other words it smoothes the movement - of the slider thumb or knob rotation.
        -
        Parameters:
        easeBy - the easing to set
        -
      • -
      - - - -
        -
      • -

        getNbrTicks

        -
        public int getNbrTicks()
        -
        Get the number of tick marks.
        -
        Returns:
        the nbrTicks
        -
      • -
      - - - -
        -
      • -

        setNbrTicks

        -
        public void setNbrTicks(int noOfTicks)
        -
        The number of ticks must be >= 2 since 2 are required for the slider limits.
        -
        Parameters:
        noOfTicks - the nbrTicks to set
        -
      • -
      - - - -
        -
      • -

        setStickToTicks

        -
        public void setStickToTicks(boolean stickToTicks)
        -
        Specify whether the values are to be constrained to the tick marks or not. - It will automatically display tick marks if set true.
        -
        Parameters:
        stickToTicks - true if you want to constrain the values else false
        -
      • -
      - - - -
        -
      • -

        isStickToTicks

        -
        public boolean isStickToTicks()
        -
        Is the value constrained to the tick marks?
        -
        Returns:
        the stickToTicks true if values constrained else false
        -
      • -
      - - - -
        -
      • -

        isShowTicks

        -
        public boolean isShowTicks()
        -
        Are the tick marks visible?
        -
        Returns:
        the showTicks
        -
      • -
      - - - -
        -
      • -

        setShowTicks

        -
        public void setShowTicks(boolean showTicks)
        -
        Set whether the tick marks are to be displayed or not.
        -
        Parameters:
        showTicks - the showTicks to set
        -
      • -
      - - - -
        -
      • -

        isShowLimits

        -
        public boolean isShowLimits()
        -
        Are the limit values visible?
        -
        Returns:
        the showLimits
        -
      • -
      - - - -
        -
      • -

        setShowLimits

        -
        public void setShowLimits(boolean showLimits)
        -
        Set whether the limits are to be displayed or not.
        -
        Parameters:
        showLimits - the showLimits to set
        -
      • -
      - - - -
        -
      • -

        isShowValue

        -
        public boolean isShowValue()
        -
        Is the current value to be displayed?
        -
        Returns:
        the showValue
        -
      • -
      - - - -
        -
      • -

        setShowValue

        -
        public void setShowValue(boolean showValue)
        -
        Set whether the current value is to be displayed or not.
        -
        Parameters:
        showValue - the showValue to set
        -
      • -
      - - - -
        -
      • -

        setShowDecor

        -
        public void setShowDecor(boolean opaque,
        -                boolean ticks,
        -                boolean value,
        -                boolean limits)
        -
        Convenience method to set what is to be drawn to the screen.
        -
        Parameters:
        opaque - show background
        ticks - show tick marks
        value - show current value
        limits - show min and max values (limits)
        -
      • -
      - - - -
        -
      • -

        getStartLimit

        -
        public float getStartLimit()
        -
        Returns:
        the startLimit
        -
      • -
      - - - -
        -
      • -

        getEndLimit

        -
        public float getEndLimit()
        -
        Returns:
        the endLimit
        -
      • -
      - - - -
        -
      • -

        getValueType

        -
        public int getValueType()
        -
        Returns:
        the valueType
        -
      • -
      - - - -
        -
      • -

        getPrecision

        -
        public int getPrecision()
        -
        Precision used with floating point numbers
        -
        Returns:
        the precision
        -
      • -
      - - - -
        -
      • -

        getUnit

        -
        public String getUnit()
        -
        Returns:
        the unit
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GValueControl2D.html b/Processing/libraries/G4P/reference/g4p_controls/GValueControl2D.html deleted file mode 100644 index 6024a72..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GValueControl2D.html +++ /dev/null @@ -1,1042 +0,0 @@ - - - - - -GValueControl2D (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GValueControl2D

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    GConstants, processing.core.PConstants
    -
    -
    -
    Direct Known Subclasses:
    -
    GSlider2D
    -
    -
    -
    -
    public abstract class GValueControl2D
    -extends GAbstractControl
    -
    Base class for controls that have 2 variables e.f. GSlider2D
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
- -
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GWinData.html b/Processing/libraries/G4P/reference/g4p_controls/GWinData.html deleted file mode 100644 index ae4b8f2..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GWinData.html +++ /dev/null @@ -1,267 +0,0 @@ - - - - - -GWinData (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GWinData

-
-
- -
-
    -
  • -
    -
    -
    public class GWinData
    -extends Object
    -
    This class is used to hold the data associated with a GWindow object. - - You should extend this class to provide the data to be processed by - the window
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        GWinData

        -
        public GWinData()
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GWindow.html b/Processing/libraries/G4P/reference/g4p_controls/GWindow.html deleted file mode 100644 index a9b1753..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GWindow.html +++ /dev/null @@ -1,1558 +0,0 @@ - - - - - -GWindow (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GWindow

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • processing.core.PApplet
    • -
    • -
        -
      • g4p_controls.GWindow
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    GConstants, processing.core.PConstants
    -
    -
    -
    Direct Known Subclasses:
    -
    GWindowAWT, GWindowNEWT
    -
    -
    -
    -
    public abstract class GWindow
    -extends processing.core.PApplet
    -implements GConstants
    -
    Base class for independent windows using JAVA2D, P2D or P3D renderers. These - can be used to hold G4P GUI components or used for drawing or both combined. -

    - A number of examples are included in the library and more info can be found - at www.lagers.org.uk - - Updated for Processing V3
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
-
    -
  • - - - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      voidaddData(GWinData data) -
      To provide a unique fields for this window create a class that inherits - from GWinData with public access fields.
      -
      voidaddDrawHandler(Object obj, - String methodName) -
      Attempt to add the 'draw' handler method.
      -
      voidaddKeyHandler(Object obj, - String methodName) -
      Attempt to add the 'key' handler method.
      -
      voidaddMouseHandler(Object obj, - String methodName) -
      Attempt to add the 'mouse' handler method.
      -
      voidaddOnCloseHandler(Object obj, - String methodName) -
      Attempt to create the on-close-window event handler for this GWindow.
      -
      voidaddPostHandler(Object obj, - String methodName) -
      Attempt to add the 'post' handler method.
      -
      voidaddPreHandler(Object obj, - String methodName) -
      Attempt to add the 'pre' handler method.
      -
      voidclose() -
      This will close the window provided the action-on-close flag is CLOSE_WINDOW - otherwise the window remains open.
      -
      voiddraw() -
      Execute any draw handler for this window.
      -
      voidforceClose() -
      This will close the window provided the action-on-close flag is CLOSE_WINDOW - or KEEP_OPEN otherwise the window remains open.
      -
      abstract processing.core.PVectorgetPosition(processing.core.PVector pos) -
      Returns a PVector with the windows top-left coordinates.
      -
      abstract StringgetTitle() -
      Get the windowTitle
      -
      static GWindowgetWindow(processing.core.PApplet app, - String title, - int px, - int py, - int w, - int h, - String renderer) -
      Factory method to create and start a new window.
      -
      abstract booleanisVisible() -
      Returns the windows visibility
      -
      voidkeyEvent(processing.event.KeyEvent event) -
      Execute any key event handler associated with this window and its controls
      -
      voidmouseEvent(processing.event.MouseEvent event) -
      Execute any mouse event handler associated with this window and its controls
      -
      voidperformCloseAction() -
      This method is executed when the window closes.
      -
      voidpost() -
      Execute any post handler associated with this window and its controls.
      -
      voidpre() -
      Execute any pre handler associated with this window and its controls
      -
      abstract voidsetActionOnClose(int action) -
      This sets what happens when the users attempts to close the window.
      -
      voidsetAlwaysOnTop(boolean ontop) -
      Sets whether this window should always be above other windows.
      -
      voidsetLocation(int x, - int y) -
      Set the windows position
      -
      voidsettings() 
      voidsetTitle(String title) -
      Set the window title
      -
      voidsetup() 
      voidsetVisible(boolean visible) -
      Set the windows visibility
      -
      -
        -
      • - - -

        Methods inherited from class processing.core.PApplet

        -abs, abs, acos, alpha, ambient, ambient, ambient, ambientLight, ambientLight, append, append, append, append, append, append, applyMatrix, applyMatrix, applyMatrix, applyMatrix, applyMatrix, arc, arc, arraycopy, arrayCopy, arraycopy, arrayCopy, arraycopy, arrayCopy, asin, atan, atan2, attrib, attrib, attrib, attribColor, attribNormal, attribPosition, background, background, background, background, background, background, background, beginCamera, beginContour, beginPGL, beginRaw, beginRaw, beginRecord, beginRecord, beginShape, beginShape, bezier, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, bezierVertex, binary, binary, binary, binary, blend, blend, blendColor, blendMode, blue, box, box, brightness, camera, camera, ceil, checkExtension, clear, clip, color, color, color, color, color, color, color, color, colorMode, colorMode, colorMode, colorMode, concat, concat, concat, concat, concat, concat, concat, constrain, constrain, copy, copy, copy, cos, createFont, createFont, createFont, createGraphics, createGraphics, createGraphics, createImage, createInput, createInput, createInputRaw, createOutput, createOutput, createPath, createPath, createReader, createReader, createReader, createShape, createShape, createShape, createWriter, createWriter, createWriter, cursor, cursor, cursor, cursor, curve, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, curveVertex, dataFile, dataPath, day, debug, degrees, delay, desktopFile, desktopPath, die, die, directionalLight, displayDensity, displayDensity, dispose, dist, dist, edge, ellipse, ellipseMode, emissive, emissive, emissive, endCamera, endContour, endPGL, endRaw, endRecord, endShape, endShape, exec, exit, exitActual, exitCalled, exp, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, fill, fill, fill, fill, fill, fill, filter, filter, filter, floor, flush, focusGained, focusLost, frameMoved, frameRate, frameResized, frustum, fullScreen, fullScreen, fullScreen, fullScreen, get, get, get, getExtension, getGraphics, getMatrix, getMatrix, getMatrix, getSurface, green, handleDraw, hex, hex, hex, hex, hideMenuBar, hint, hour, hue, image, image, image, imageMode, insertFrame, isLooping, join, join, keyPressed, keyPressed, keyReleased, keyReleased, keyTyped, keyTyped, launch, lerp, lerpColor, lerpColor, lightFalloff, lights, lightSpecular, line, line, link, loadBytes, loadBytes, loadBytes, loadFont, loadImage, loadImage, loadJSONArray, loadJSONArray, loadJSONObject, loadJSONObject, loadPixels, loadShader, loadShader, loadShape, loadShape, loadStrings, loadStrings, loadStrings, loadStrings, loadTable, loadTable, loadXML, loadXML, log, loop, mag, mag, main, main, main, map, mask, match, matchAll, max, max, max, max, max, max, method, millis, min, min, min, min, min, min, minute, modelX, modelY, modelZ, month, mouseClicked, mouseClicked, mouseDragged, mouseDragged, mouseEntered, mouseEntered, mouseExited, mouseExited, mouseMoved, mouseMoved, mousePressed, mousePressed, mouseReleased, mouseReleased, mouseWheel, mouseWheel, nf, nf, nf, nf, nf, nf, nfc, nfc, nfc, nfc, nfp, nfp, nfp, nfp, nfs, nfs, nfs, nfs, noClip, noCursor, noFill, noise, noise, noise, noiseDetail, noiseDetail, noiseSeed, noLights, noLoop, norm, normal, noSmooth, noStroke, noTexture, noTint, orientation, ortho, ortho, ortho, parseBoolean, parseBoolean, parseBoolean, parseBoolean, parseByte, parseByte, parseByte, parseByte, parseByte, parseByte, parseByte, parseByte, parseChar, parseChar, parseChar, parseChar, parseFloat, parseFloat, parseFloat, parseFloat, parseFloat, parseFloat, parseFloat, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseJSONArray, parseJSONObject, parseXML, parseXML, pause, perspective, perspective, pixelDensity, point, point, pointLight, popMatrix, popStyle, postEvent, pow, print, print, print, print, print, print, print, print, print, printArray, printCamera, println, println, println, println, println, println, println, println, println, println, println, printMatrix, printProjection, pushMatrix, pushStyle, quad, quadraticVertex, quadraticVertex, radians, random, random, randomGaussian, randomSeed, rect, rect, rect, rectMode, red, redraw, registerMethod, requestImage, requestImage, resetMatrix, resetShader, resetShader, resume, reverse, reverse, reverse, reverse, reverse, reverse, reverse, rotate, rotate, rotateX, rotateY, rotateZ, round, runSketch, saturation, save, saveBytes, saveBytes, saveBytes, saveFile, saveFrame, saveFrame, saveJSONArray, saveJSONArray, saveJSONObject, saveJSONObject, savePath, saveStream, saveStream, saveStream, saveStream, saveStream, saveStrings, saveStrings, saveStrings, saveTable, saveTable, saveXML, saveXML, scale, scale, scale, screenX, screenX, screenY, screenY, screenZ, second, selectFolder, selectFolder, selectFolder, selectFolder, selectFolder, selectInput, selectInput, selectInput, selectInput, selectInput, selectOutput, selectOutput, selectOutput, selectOutput, selectOutput, set, set, setMatrix, setMatrix, setMatrix, setSize, shader, shader, shape, shape, shape, shapeMode, shearX, shearY, shininess, shorten, shorten, shorten, shorten, shorten, shorten, shorten, showDepthWarning, showDepthWarningXYZ, showMethodWarning, showMissingWarning, showVariationWarning, sin, size, size, size, sketchDisplay, sketchFile, sketchFullScreen, sketchHeight, sketchOutputPath, sketchOutputStream, sketchPath, sketchPath, sketchPixelDensity, sketchRenderer, sketchSmooth, sketchWidth, sketchWindowColor, smooth, smooth, sort, sort, sort, sort, sort, sort, sort, sort, sort, sort, specular, specular, specular, sphere, sphereDetail, sphereDetail, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, split, split, splitTokens, splitTokens, spotLight, sq, sqrt, start, stop, str, str, str, str, str, str, str, str, str, str, stroke, stroke, stroke, stroke, stroke, stroke, strokeCap, strokeJoin, strokeWeight, style, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, tan, text, text, text, text, text, text, text, text, text, text, text, textAlign, textAlign, textAscent, textDescent, textFont, textFont, textLeading, textMode, textSize, texture, textureMode, textureWrap, textWidth, textWidth, textWidth, thread, tint, tint, tint, tint, tint, tint, translate, translate, triangle, trim, trim, unbinary, unhex, unregisterMethod, updatePixels, updatePixels, urlDecode, urlEncode, vertex, vertex, vertex, vertex, vertex, year
      • -
      - -
    • -
    -
  • -
-
-
-
    -
  • - - - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getWindow

        -
        public static GWindow getWindow(processing.core.PApplet app,
        -                String title,
        -                int px,
        -                int py,
        -                int w,
        -                int h,
        -                String renderer)
        -
        Factory method to create and start a new window. The renderer - must be JAVA2D, P2D or P3D otherwise this method returns null.
        -
        Parameters:
        title - text to appear in frame title bar
        px - horizontal position of top-left corner
        py - vertical position of top-left corner
        w - width of drawing surface
        h - height of surface
        r - renderer must be JAVA2D, P3D or P3D
        -
        Returns:
        the window created (in case the user wants its.
        -
      • -
      - - - -
        -
      • -

        addData

        -
        public void addData(GWinData data)
        -
        To provide a unique fields for this window create a class that inherits - from GWinData with public access fields. Then use this method to associate - the data with this window.
        -
        Parameters:
        data -
        -
      • -
      - - - -
        -
      • -

        setVisible

        -
        public void setVisible(boolean visible)
        -
        Set the windows visibility
        -
      • -
      - - - -
        -
      • -

        isVisible

        -
        public abstract boolean isVisible()
        -
        Returns the windows visibility
        -
      • -
      - - - -
        -
      • -

        setTitle

        -
        public void setTitle(String title)
        -
        Set the window title
        -
      • -
      - - - -
        -
      • -

        getTitle

        -
        public abstract String getTitle()
        -
        Get the windowTitle
        -
      • -
      - - - -
        -
      • -

        setLocation

        -
        public void setLocation(int x,
        -               int y)
        -
        Set the windows position
        -
      • -
      - - - -
        -
      • -

        getPosition

        -
        public abstract processing.core.PVector getPosition(processing.core.PVector pos)
        -
        Returns a PVector with the windows top-left coordinates.
        -
      • -
      - - - -
        -
      • -

        setAlwaysOnTop

        -
        public void setAlwaysOnTop(boolean ontop)
        -
        Sets whether this window should always be above other windows. If there are - multiple always-on-top windows, their relative order is unspecified and - platform dependent.
        -
      • -
      - - - -
        -
      • -

        draw

        -
        public void draw()
        -
        Execute any draw handler for this window.
        -
        -
        Overrides:
        -
        draw in class processing.core.PApplet
        -
        -
      • -
      - - - -
        -
      • -

        pre

        -
        public void pre()
        -
        Execute any pre handler associated with this window and its controls
        -
      • -
      - - - -
        -
      • -

        post

        -
        public void post()
        -
        Execute any post handler associated with this window and its controls.
        - Add/remove any controls request by user, this is done here outside the drawing - phase to prevent crashes.
        -
      • -
      - - - -
        -
      • -

        mouseEvent

        -
        public void mouseEvent(processing.event.MouseEvent event)
        -
        Execute any mouse event handler associated with this window and its controls
        -
      • -
      - - - -
        -
      • -

        keyEvent

        -
        public void keyEvent(processing.event.KeyEvent event)
        -
        Execute any key event handler associated with this window and its controls
        -
      • -
      - - - -
        -
      • -

        addDrawHandler

        -
        public void addDrawHandler(Object obj,
        -                  String methodName)
        -
        Attempt to add the 'draw' handler method. - The default event handler is a method that returns void and has two - parameters PApplet and GWinData
        -
        Parameters:
        obj - the object to handle the event
        methodName - the method to execute in the object handler class
        -
      • -
      - - - -
        -
      • -

        addPreHandler

        -
        public void addPreHandler(Object obj,
        -                 String methodName)
        -
        Attempt to add the 'pre' handler method. - The default event handler is a method that returns void and has two - parameters GWinApplet and GWinData
        -
        Parameters:
        obj - the object to handle the event
        methodName - the method to execute in the object handler class
        -
      • -
      - - - -
        -
      • -

        addMouseHandler

        -
        public void addMouseHandler(Object obj,
        -                   String methodName)
        -
        Attempt to add the 'mouse' handler method. - The default event handler is a method that returns void and has three - parameters GWinApplet, GWinData and a MouseEvent
        -
        Parameters:
        obj - the object to handle the event
        methodName - the method to execute in the object handler class
        -
      • -
      - - - -
        -
      • -

        addKeyHandler

        -
        public void addKeyHandler(Object obj,
        -                 String methodName)
        -
        Attempt to add the 'key' handler method. - The default event handler is a method that returns void and has three - parameters GWinApplet, GWinData and a KeyEvent
        -
        Parameters:
        obj - the object to handle the event
        methodName - the method to execute in the object handler class
        -
      • -
      - - - -
        -
      • -

        addPostHandler

        -
        public void addPostHandler(Object obj,
        -                  String methodName)
        -
        Attempt to add the 'post' handler method. - The default event handler is a method that returns void and has two - parameters GWinApplet and GWinData
        -
        Parameters:
        obj - the object to handle the event
        methodName - the method to execute in the object handler class
        -
      • -
      - - - -
        -
      • -

        addOnCloseHandler

        -
        public void addOnCloseHandler(Object obj,
        -                     String methodName)
        -
        Attempt to create the on-close-window event handler for this GWindow. - The default event handler is a method that returns void and has a single - parameter of type GWindow (this will be a reference to the window that is - closing)
        - - The handler will not be called if the setActionOnClose flag is set - to EXIT_APP
        - If the flag is set to CLOSE_WINDOW then the handler is called when the window - is closed by clicking on the window-close-icon or using either the close or - forceClose methods.
        - If the flag is set to KEEP_OPEN the window can only be closed using the - forceClose method. In this case the handler will be called.
        -
        Parameters:
        obj - the object to handle the on-close-window event
        methodName - the method to execute in the object handler class
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -
        This will close the window provided the action-on-close flag is CLOSE_WINDOW - otherwise the window remains open.
        -
      • -
      - - - -
        -
      • -

        forceClose

        -
        public void forceClose()
        -
        This will close the window provided the action-on-close flag is CLOSE_WINDOW - or KEEP_OPEN otherwise the window remains open.
        -
      • -
      - - - -
        -
      • -

        setActionOnClose

        -
        public abstract void setActionOnClose(int action)
        -
        This sets what happens when the users attempts to close the window.
        - There are 3 possible actions depending on the value passed.
        - G4P.KEEP_OPEN - ignore attempt to close window (default action),
        - G4P.CLOSE_WINDOW - close this window,
        - G4P.EXIT_APP - exit the app, this will cause all windows to close.
        -
        Parameters:
        action - the required close action
        -
      • -
      - - - -
        -
      • -

        settings

        -
        public void settings()
        -
        -
        Overrides:
        -
        settings in class processing.core.PApplet
        -
        -
      • -
      - - - -
        -
      • -

        setup

        -
        public void setup()
        -
        -
        Overrides:
        -
        setup in class processing.core.PApplet
        -
        -
      • -
      - - - -
        -
      • -

        performCloseAction

        -
        public void performCloseAction()
        -
        This method is executed when the window closes. It will call the user defined - on-close-handler method set with
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GWindowAWT.html b/Processing/libraries/G4P/reference/g4p_controls/GWindowAWT.html deleted file mode 100644 index d8bfede..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GWindowAWT.html +++ /dev/null @@ -1,1094 +0,0 @@ - - - - - -GWindowAWT (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GWindowAWT

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    GConstants, processing.core.PConstants
    -
    -
    -
    -
    public class GWindowAWT
    -extends GWindow
    -
    Class for independent windows using the JAVA2D renderer. These - can be used to hold G4P GUI components or used for drawing or both combined. -

    - A number of examples are included in the library and more info can be found - at www.lagers.org.uk - - Updated for Processing V3
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
-
    -
  • - - - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      voiddraw() -
      Execute any draw handler for this window.
      -
      processing.core.PVectorgetPosition(processing.core.PVector pos) -
      Get the window position
      -
      StringgetTitle() -
      Get the window title
      -
      booleanisVisible() -
      Returns true if the window is visible else false
      -
      voidsetActionOnClose(int action) -
      This sets what happens when the users attempts to close the window.
      -
      - -
        -
      • - - -

        Methods inherited from class processing.core.PApplet

        -abs, abs, acos, alpha, ambient, ambient, ambient, ambientLight, ambientLight, append, append, append, append, append, append, applyMatrix, applyMatrix, applyMatrix, applyMatrix, applyMatrix, arc, arc, arraycopy, arrayCopy, arraycopy, arrayCopy, arraycopy, arrayCopy, asin, atan, atan2, attrib, attrib, attrib, attribColor, attribNormal, attribPosition, background, background, background, background, background, background, background, beginCamera, beginContour, beginPGL, beginRaw, beginRaw, beginRecord, beginRecord, beginShape, beginShape, bezier, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, bezierVertex, binary, binary, binary, binary, blend, blend, blendColor, blendMode, blue, box, box, brightness, camera, camera, ceil, checkExtension, clear, clip, color, color, color, color, color, color, color, color, colorMode, colorMode, colorMode, colorMode, concat, concat, concat, concat, concat, concat, concat, constrain, constrain, copy, copy, copy, cos, createFont, createFont, createFont, createGraphics, createGraphics, createGraphics, createImage, createInput, createInput, createInputRaw, createOutput, createOutput, createPath, createPath, createReader, createReader, createReader, createShape, createShape, createShape, createWriter, createWriter, createWriter, cursor, cursor, cursor, cursor, curve, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, curveVertex, dataFile, dataPath, day, debug, degrees, delay, desktopFile, desktopPath, die, die, directionalLight, displayDensity, displayDensity, dispose, dist, dist, edge, ellipse, ellipseMode, emissive, emissive, emissive, endCamera, endContour, endPGL, endRaw, endRecord, endShape, endShape, exec, exit, exitActual, exitCalled, exp, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, fill, fill, fill, fill, fill, fill, filter, filter, filter, floor, flush, focusGained, focusLost, frameMoved, frameRate, frameResized, frustum, fullScreen, fullScreen, fullScreen, fullScreen, get, get, get, getExtension, getGraphics, getMatrix, getMatrix, getMatrix, getSurface, green, handleDraw, hex, hex, hex, hex, hideMenuBar, hint, hour, hue, image, image, image, imageMode, insertFrame, isLooping, join, join, keyPressed, keyPressed, keyReleased, keyReleased, keyTyped, keyTyped, launch, lerp, lerpColor, lerpColor, lightFalloff, lights, lightSpecular, line, line, link, loadBytes, loadBytes, loadBytes, loadFont, loadImage, loadImage, loadJSONArray, loadJSONArray, loadJSONObject, loadJSONObject, loadPixels, loadShader, loadShader, loadShape, loadShape, loadStrings, loadStrings, loadStrings, loadStrings, loadTable, loadTable, loadXML, loadXML, log, loop, mag, mag, main, main, main, map, mask, match, matchAll, max, max, max, max, max, max, method, millis, min, min, min, min, min, min, minute, modelX, modelY, modelZ, month, mouseClicked, mouseClicked, mouseDragged, mouseDragged, mouseEntered, mouseEntered, mouseExited, mouseExited, mouseMoved, mouseMoved, mousePressed, mousePressed, mouseReleased, mouseReleased, mouseWheel, mouseWheel, nf, nf, nf, nf, nf, nf, nfc, nfc, nfc, nfc, nfp, nfp, nfp, nfp, nfs, nfs, nfs, nfs, noClip, noCursor, noFill, noise, noise, noise, noiseDetail, noiseDetail, noiseSeed, noLights, noLoop, norm, normal, noSmooth, noStroke, noTexture, noTint, orientation, ortho, ortho, ortho, parseBoolean, parseBoolean, parseBoolean, parseBoolean, parseByte, parseByte, parseByte, parseByte, parseByte, parseByte, parseByte, parseByte, parseChar, parseChar, parseChar, parseChar, parseFloat, parseFloat, parseFloat, parseFloat, parseFloat, parseFloat, parseFloat, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseJSONArray, parseJSONObject, parseXML, parseXML, pause, perspective, perspective, pixelDensity, point, point, pointLight, popMatrix, popStyle, postEvent, pow, print, print, print, print, print, print, print, print, print, printArray, printCamera, println, println, println, println, println, println, println, println, println, println, println, printMatrix, printProjection, pushMatrix, pushStyle, quad, quadraticVertex, quadraticVertex, radians, random, random, randomGaussian, randomSeed, rect, rect, rect, rectMode, red, redraw, registerMethod, requestImage, requestImage, resetMatrix, resetShader, resetShader, resume, reverse, reverse, reverse, reverse, reverse, reverse, reverse, rotate, rotate, rotateX, rotateY, rotateZ, round, runSketch, saturation, save, saveBytes, saveBytes, saveBytes, saveFile, saveFrame, saveFrame, saveJSONArray, saveJSONArray, saveJSONObject, saveJSONObject, savePath, saveStream, saveStream, saveStream, saveStream, saveStream, saveStrings, saveStrings, saveStrings, saveTable, saveTable, saveXML, saveXML, scale, scale, scale, screenX, screenX, screenY, screenY, screenZ, second, selectFolder, selectFolder, selectFolder, selectFolder, selectFolder, selectInput, selectInput, selectInput, selectInput, selectInput, selectOutput, selectOutput, selectOutput, selectOutput, selectOutput, set, set, setMatrix, setMatrix, setMatrix, setSize, shader, shader, shape, shape, shape, shapeMode, shearX, shearY, shininess, shorten, shorten, shorten, shorten, shorten, shorten, shorten, showDepthWarning, showDepthWarningXYZ, showMethodWarning, showMissingWarning, showVariationWarning, sin, size, size, size, sketchDisplay, sketchFile, sketchFullScreen, sketchHeight, sketchOutputPath, sketchOutputStream, sketchPath, sketchPath, sketchPixelDensity, sketchRenderer, sketchSmooth, sketchWidth, sketchWindowColor, smooth, smooth, sort, sort, sort, sort, sort, sort, sort, sort, sort, sort, specular, specular, specular, sphere, sphereDetail, sphereDetail, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, split, split, splitTokens, splitTokens, spotLight, sq, sqrt, start, stop, str, str, str, str, str, str, str, str, str, str, stroke, stroke, stroke, stroke, stroke, stroke, strokeCap, strokeJoin, strokeWeight, style, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, tan, text, text, text, text, text, text, text, text, text, text, text, textAlign, textAlign, textAscent, textDescent, textFont, textFont, textLeading, textMode, textSize, texture, textureMode, textureWrap, textWidth, textWidth, textWidth, thread, tint, tint, tint, tint, tint, tint, translate, translate, triangle, trim, trim, unbinary, unhex, unregisterMethod, updatePixels, updatePixels, urlDecode, urlEncode, vertex, vertex, vertex, vertex, vertex, year
      • -
      - -
    • -
    -
  • -
-
-
- -
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GWindowImpl.html b/Processing/libraries/G4P/reference/g4p_controls/GWindowImpl.html deleted file mode 100644 index 48b5ff2..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GWindowImpl.html +++ /dev/null @@ -1,1089 +0,0 @@ - - - - - -GWindowImpl (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GWindowImpl

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    GConstants
    -
    -
    -
    -
    public class GWindowImpl
    -extends Object
    -implements GConstants
    -
    This class calls the appropriate methods for G4P controls for the main applet window. - - This will be created when the first control is added to the main window.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
- -
-
- -
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/GWindowNEWT.html b/Processing/libraries/G4P/reference/g4p_controls/GWindowNEWT.html deleted file mode 100644 index 015f2db..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/GWindowNEWT.html +++ /dev/null @@ -1,1111 +0,0 @@ - - - - - -GWindowNEWT (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class GWindowNEWT

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    GConstants, processing.core.PConstants
    -
    -
    -
    -
    public class GWindowNEWT
    -extends GWindow
    -
    Class for independent windows using P2D or P3D renderers. These - can be used to hold G4P GUI components or used for drawing or both combined. -

    - A number of examples are included in the library and more info can be found - at www.lagers.org.uk - - Updated for Processing V3
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
-
    -
  • - - - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      voiddraw() -
      Execute any draw handler for this window.
      -
      processing.core.PVectorgetPosition(processing.core.PVector pos) -
      Get the window position.
      -
      StringgetTitle() -
      Get the window title
      -
      booleanisVisible() -
      Returns true if the window is visible else false
      -
      voidsetActionOnClose(int action) -
      This sets what happens when the users attempts to close the window.
      -
      voidsetup() 
      - -
        -
      • - - -

        Methods inherited from class processing.core.PApplet

        -abs, abs, acos, alpha, ambient, ambient, ambient, ambientLight, ambientLight, append, append, append, append, append, append, applyMatrix, applyMatrix, applyMatrix, applyMatrix, applyMatrix, arc, arc, arraycopy, arrayCopy, arraycopy, arrayCopy, arraycopy, arrayCopy, asin, atan, atan2, attrib, attrib, attrib, attribColor, attribNormal, attribPosition, background, background, background, background, background, background, background, beginCamera, beginContour, beginPGL, beginRaw, beginRaw, beginRecord, beginRecord, beginShape, beginShape, bezier, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, bezierVertex, binary, binary, binary, binary, blend, blend, blendColor, blendMode, blue, box, box, brightness, camera, camera, ceil, checkExtension, clear, clip, color, color, color, color, color, color, color, color, colorMode, colorMode, colorMode, colorMode, concat, concat, concat, concat, concat, concat, concat, constrain, constrain, copy, copy, copy, cos, createFont, createFont, createFont, createGraphics, createGraphics, createGraphics, createImage, createInput, createInput, createInputRaw, createOutput, createOutput, createPath, createPath, createReader, createReader, createReader, createShape, createShape, createShape, createWriter, createWriter, createWriter, cursor, cursor, cursor, cursor, curve, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, curveVertex, dataFile, dataPath, day, debug, degrees, delay, desktopFile, desktopPath, die, die, directionalLight, displayDensity, displayDensity, dispose, dist, dist, edge, ellipse, ellipseMode, emissive, emissive, emissive, endCamera, endContour, endPGL, endRaw, endRecord, endShape, endShape, exec, exit, exitActual, exitCalled, exp, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, expand, fill, fill, fill, fill, fill, fill, filter, filter, filter, floor, flush, focusGained, focusLost, frameMoved, frameRate, frameResized, frustum, fullScreen, fullScreen, fullScreen, fullScreen, get, get, get, getExtension, getGraphics, getMatrix, getMatrix, getMatrix, getSurface, green, handleDraw, hex, hex, hex, hex, hideMenuBar, hint, hour, hue, image, image, image, imageMode, insertFrame, isLooping, join, join, keyPressed, keyPressed, keyReleased, keyReleased, keyTyped, keyTyped, launch, lerp, lerpColor, lerpColor, lightFalloff, lights, lightSpecular, line, line, link, loadBytes, loadBytes, loadBytes, loadFont, loadImage, loadImage, loadJSONArray, loadJSONArray, loadJSONObject, loadJSONObject, loadPixels, loadShader, loadShader, loadShape, loadShape, loadStrings, loadStrings, loadStrings, loadStrings, loadTable, loadTable, loadXML, loadXML, log, loop, mag, mag, main, main, main, map, mask, match, matchAll, max, max, max, max, max, max, method, millis, min, min, min, min, min, min, minute, modelX, modelY, modelZ, month, mouseClicked, mouseClicked, mouseDragged, mouseDragged, mouseEntered, mouseEntered, mouseExited, mouseExited, mouseMoved, mouseMoved, mousePressed, mousePressed, mouseReleased, mouseReleased, mouseWheel, mouseWheel, nf, nf, nf, nf, nf, nf, nfc, nfc, nfc, nfc, nfp, nfp, nfp, nfp, nfs, nfs, nfs, nfs, noClip, noCursor, noFill, noise, noise, noise, noiseDetail, noiseDetail, noiseSeed, noLights, noLoop, norm, normal, noSmooth, noStroke, noTexture, noTint, orientation, ortho, ortho, ortho, parseBoolean, parseBoolean, parseBoolean, parseBoolean, parseByte, parseByte, parseByte, parseByte, parseByte, parseByte, parseByte, parseByte, parseChar, parseChar, parseChar, parseChar, parseFloat, parseFloat, parseFloat, parseFloat, parseFloat, parseFloat, parseFloat, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseInt, parseJSONArray, parseJSONObject, parseXML, parseXML, pause, perspective, perspective, pixelDensity, point, point, pointLight, popMatrix, popStyle, postEvent, pow, print, print, print, print, print, print, print, print, print, printArray, printCamera, println, println, println, println, println, println, println, println, println, println, println, printMatrix, printProjection, pushMatrix, pushStyle, quad, quadraticVertex, quadraticVertex, radians, random, random, randomGaussian, randomSeed, rect, rect, rect, rectMode, red, redraw, registerMethod, requestImage, requestImage, resetMatrix, resetShader, resetShader, resume, reverse, reverse, reverse, reverse, reverse, reverse, reverse, rotate, rotate, rotateX, rotateY, rotateZ, round, runSketch, saturation, save, saveBytes, saveBytes, saveBytes, saveFile, saveFrame, saveFrame, saveJSONArray, saveJSONArray, saveJSONObject, saveJSONObject, savePath, saveStream, saveStream, saveStream, saveStream, saveStream, saveStrings, saveStrings, saveStrings, saveTable, saveTable, saveXML, saveXML, scale, scale, scale, screenX, screenX, screenY, screenY, screenZ, second, selectFolder, selectFolder, selectFolder, selectFolder, selectFolder, selectInput, selectInput, selectInput, selectInput, selectInput, selectOutput, selectOutput, selectOutput, selectOutput, selectOutput, set, set, setMatrix, setMatrix, setMatrix, setSize, shader, shader, shape, shape, shape, shapeMode, shearX, shearY, shininess, shorten, shorten, shorten, shorten, shorten, shorten, shorten, showDepthWarning, showDepthWarningXYZ, showMethodWarning, showMissingWarning, showVariationWarning, sin, size, size, size, sketchDisplay, sketchFile, sketchFullScreen, sketchHeight, sketchOutputPath, sketchOutputStream, sketchPath, sketchPath, sketchPixelDensity, sketchRenderer, sketchSmooth, sketchWidth, sketchWindowColor, smooth, smooth, sort, sort, sort, sort, sort, sort, sort, sort, sort, sort, specular, specular, specular, sphere, sphereDetail, sphereDetail, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, splice, split, split, splitTokens, splitTokens, spotLight, sq, sqrt, start, stop, str, str, str, str, str, str, str, str, str, str, stroke, stroke, stroke, stroke, stroke, stroke, strokeCap, strokeJoin, strokeWeight, style, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, subset, tan, text, text, text, text, text, text, text, text, text, text, text, textAlign, textAlign, textAscent, textDescent, textFont, textFont, textLeading, textMode, textSize, texture, textureMode, textureWrap, textWidth, textWidth, textWidth, thread, tint, tint, tint, tint, tint, tint, translate, translate, triangle, trim, trim, unbinary, unhex, unregisterMethod, updatePixels, updatePixels, urlDecode, urlEncode, vertex, vertex, vertex, vertex, vertex, year
      • -
      - -
    • -
    -
  • -
-
-
- -
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/ImageManager.html b/Processing/libraries/G4P/reference/g4p_controls/ImageManager.html deleted file mode 100644 index ff8f173..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/ImageManager.html +++ /dev/null @@ -1,336 +0,0 @@ - - - - - -ImageManager (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class ImageManager

-
-
- -
-
    -
  • -
    -
    -
    public class ImageManager
    -extends Object
    -
    This class is used to load bitmap files and create images.
    - - Although there maybe multiple requests for a particular bitmap file only - one PImage is created for each file.
    -
    Author:
    -
    Peter Lager
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      ImageManager() 
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      static processing.core.PImageloadImage(processing.core.PApplet app, - String filename) -
      Load a single bitmap file return a reference to the PImage created.
      -
      static processing.core.PImage[]loadImage(processing.core.PApplet app, - String[] filename) -
      Load images from multiple files
      -
      static processing.core.PImage[]makeTiles1D(processing.core.PApplet app, - processing.core.PImage img, - int nCols, - int nRows) -
      Make multiple images from a given image.
      -
      static processing.core.PImage[][]makeTiles2D(processing.core.PApplet app, - processing.core.PImage img, - int nCols, - int nRows) -
      Make multiple images from a given image.
      -
      - -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ImageManager

        -
        public ImageManager()
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        loadImage

        -
        public static processing.core.PImage loadImage(processing.core.PApplet app,
        -                               String filename)
        -
        Load a single bitmap file return a reference to the PImage created.
        -
        Parameters:
        app -
        filename -
        -
        Returns:
        null if the file does not exist else the PImage object
        -
      • -
      - - - -
        -
      • -

        loadImage

        -
        public static processing.core.PImage[] loadImage(processing.core.PApplet app,
        -                                 String[] filename)
        -
        Load images from multiple files
        -
        Parameters:
        app -
        filename - an array of filenames
        -
        Returns:
        an array of images
        -
      • -
      - - - -
        -
      • -

        makeTiles2D

        -
        public static processing.core.PImage[][] makeTiles2D(processing.core.PApplet app,
        -                                     processing.core.PImage img,
        -                                     int nCols,
        -                                     int nRows)
        -
        Make multiple images from a given image. This method creates - a 2D array (size [nCols, nRows] ) of PImage objects.
        -
        Parameters:
        app -
        img - the tiled image
        nCols - number of tiles across
        nRows - number of tiles down
        -
        Returns:
        a 2D array of images (tiles)
        -
      • -
      - - - -
        -
      • -

        makeTiles1D

        -
        public static processing.core.PImage[] makeTiles1D(processing.core.PApplet app,
        -                                   processing.core.PImage img,
        -                                   int nCols,
        -                                   int nRows)
        -
        Make multiple images from a given image. This method creates - a 1D array of PImage objects. The order is left-right and top-down.
        -
        Parameters:
        app -
        img - the tiled image
        nCols - number of tiles across
        nRows - number of tiles down
        -
        Returns:
        a 1D array of images (tiles)
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/StyledString.TextLayoutHitInfo.html b/Processing/libraries/G4P/reference/g4p_controls/StyledString.TextLayoutHitInfo.html deleted file mode 100644 index 22b16ca..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/StyledString.TextLayoutHitInfo.html +++ /dev/null @@ -1,408 +0,0 @@ - - - - - -StyledString.TextLayoutHitInfo (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class StyledString.TextLayoutHitInfo

-
-
- -
- -
-
- -
-
- -
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/StyledString.TextLayoutInfo.html b/Processing/libraries/G4P/reference/g4p_controls/StyledString.TextLayoutInfo.html deleted file mode 100644 index 07bce3f..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/StyledString.TextLayoutInfo.html +++ /dev/null @@ -1,384 +0,0 @@ - - - - - -StyledString.TextLayoutInfo (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class StyledString.TextLayoutInfo

-
-
- -
- -
-
- -
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - - - - - -
        -
      • -

        lineNo

        -
        public int lineNo
        -
      • -
      - - - -
        -
      • -

        startCharIndex

        -
        public int startCharIndex
        -
      • -
      - - - -
        -
      • -

        nbrChars

        -
        public int nbrChars
        -
      • -
      - - - -
        -
      • -

        yPosInPara

        -
        public float yPosInPara
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        StyledString.TextLayoutInfo

        -
        public StyledString.TextLayoutInfo(int lineNo,
        -                           TextLayout layout,
        -                           int startCharIndex,
        -                           int nbrChars,
        -                           float yPosInPara)
        -
        Parameters:
        startCharIndex -
        nbrChars -
        yPosInPara -
        -
      • -
      -
    • -
    - - -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/StyledString.html b/Processing/libraries/G4P/reference/g4p_controls/StyledString.html deleted file mode 100644 index 1ce1a21..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/StyledString.html +++ /dev/null @@ -1,1617 +0,0 @@ - - - - - -StyledString (Javadocs: G4P) - - - - - - - - - - - -
-
g4p_controls
-

Class StyledString

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Serializable
    -
    -
    -
    -
    public final class StyledString
    -extends Object
    -implements Serializable
    -
    This class is used to represent text with attributes.
    - It means that you don't have to have the same style of font - or even the same font face over the whole length of the text.
    - - Most font features can be modified all except the text background - which is transparent. There is a feature to highlight part of the string - by having a different background colour but this is used for highlighting - selected text in GTextField and GTextArea components.
    - - It is also used for all controls that use text.
    -
    Author:
    -
    Peter Lager
    -
    See Also:
    Serialized Form
    -
  • -
-
-
- -
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        StyledString

        -
        public StyledString(String startText)
        -
        This is assumed to be a single line of text (i.e. no wrap). - EOL characters will be stripped from the text before use.
        -
        Parameters:
        startText -
        -
      • -
      - - - -
        -
      • -

        StyledString

        -
        public StyledString(String startText,
        -            int wrapWidth)
        -
        Supports multiple lines of text wrapped on word boundaries.
        -
        Parameters:
        startText - the text to use
        wrapWidth - the wrap width
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setText

        -
        public void setText(String text)
        -
        Change the text for single line styled string
        -
        Parameters:
        text - the text to use
        -
      • -
      - - - -
        -
      • -

        setText

        -
        public void setText(String text,
        -           int wrapWidth)
        -
        Change the text for single line styled string
        -
        Parameters:
        text - the text to use
        wrapWidth - the wrap width
        -
      • -
      - - - -
        -
      • -

        getPlainText

        -
        public String getPlainText()
        -
        Get the plain text as a String. Any line breaks will kept and will - be represented by the character 'backslash n'
        -
        Returns:
        the associated plain text
        -
      • -
      - - - -
        -
      • -

        getPlainText

        -
        public String getPlainText(int beginIdx,
        -                  int endIdx)
        -
        Get the plain text as a String. Any line breaks will kept and will - be represented by the character 'backslash n'
        -
        Parameters:
        beginIdx - the beginning index inclusive
        endIdx - the ending index exclusive
        -
        Returns:
        the substring starting at beginIdx to endIdx-1
        -
      • -
      - - - -
        -
      • -

        getPlainText

        -
        public String getPlainText(int lineNo)
        -
        Get a line of text from the plain text. Lines are separated by - End-of-line (EOL) characters.
        -
        Parameters:
        lineNo - the line number we want the text for
        -
        Returns:
        the line of text or an empty string if the line number is invalid.
        -
      • -
      - - - -
        -
      • -

        getPlainTextAsArray

        -
        public String[] getPlainTextAsArray()
        -
        Get the plain text as a String array. (splitting on line breaks)
        -
        Returns:
        the associated plain text as a String array split on line breaks
        -
      • -
      - - - -
        -
      • -

        length

        -
        public int length()
        -
        Get the number of characters in this styled string
        -
      • -
      - - - -
        -
      • -

        setJustify

        -
        public void setJustify(boolean justify)
        -
        Text can be either left or fully justified.
        -
        Parameters:
        justify - true for full justification
        -
      • -
      - - - -
        -
      • -

        setJustifyRatio

        -
        public void setJustifyRatio(float jRatio)
        -
        Justify only if the line has sufficient text to do so.
        -
        Parameters:
        jRatio - ratio of text length to visibleWidth
        -
      • -
      - - - -
        -
      • -

        addAttribute

        -
        public void addAttribute(AttributedCharacterIterator.Attribute type,
        -                Object value)
        -
        Add an attribute that affects the whole length of the string.
        -
        Parameters:
        type - attribute type
        value - attribute value
        -
      • -
      - - - -
        -
      • -

        addAttribute

        -
        public void addAttribute(AttributedCharacterIterator.Attribute type,
        -                Object value,
        -                int lineNo,
        -                int charStart,
        -                int charEnd)
        -
        Add a text attribute (style) to the specifies range of characters
        -
        Parameters:
        type - attribute type
        value - attribute value
        lineNo - the line of test affected
        charStart - the first character affected
        charEnd - the character position after the last character affected.
        -
      • -
      - - - -
        -
      • -

        addAttribute

        -
        public void addAttribute(AttributedCharacterIterator.Attribute type,
        -                Object value,
        -                int lineNo)
        -
        Add a text attribute (style) to an entire display line
        -
        Parameters:
        type - attribute type
        value - attribute value
        lineNo - the line of test affected
        -
      • -
      - - - -
        -
      • -

        addAttribute

        -
        public void addAttribute(AttributedCharacterIterator.Attribute type,
        -                Object value,
        -                int beginIdx,
        -                int endIdx)
        -
        Set the attribute to be applied to a range of characters starting at - beginIdx and ending with endIdx-1.
        -
        Parameters:
        type - attribute type
        value - attribute value
        beginIdx - the index of the first character (inclusive)
        endIdx - the index of the last character (exclusive)
        -
      • -
      - - - -
        -
      • -

        clearAttributes

        -
        public void clearAttributes(int lineNo,
        -                   int beginIdx,
        -                   int endIdx)
        -
        Remove text attributes (style) to the specified line and range of characters.
        -
        Parameters:
        lineNo - the line of test affected
        beginIdx - the index of the first character (inclusive)
        endIdx - the index of the last character (exclusive)
        -
      • -
      - - - -
        -
      • -

        clearAttributes

        -
        public void clearAttributes(int lineNo)
        -
        Parameters:
        lineNo -
        -
      • -
      - - - -
        -
      • -

        clearAttributes

        -
        public void clearAttributes(int beginIdx,
        -                   int endIdx)
        -
        Remove text attributes (style) to the specified range of characters.
        -
        Parameters:
        beginIdx - the index of the first character (inclusive)
        endIdx - the index of the last character (exclusive)
        -
      • -
      - - - -
        -
      • -

        clearAttributes

        -
        public void clearAttributes()
        -
        Removes all styling from the string.
        -
      • -
      - - - -
        -
      • -

        insertCharacters

        -
        public int insertCharacters(String chars,
        -                   int lineNo,
        -                   int charStart,
        -                   boolean startNewLine,
        -                   boolean endNewLine)
        -
        Insert some text into the position indicated.
        -
        Parameters:
        lineNo - a valid line number
        charStart - the position in the line >= 0
        chars - the characters to insert
        startNewLine - prefix the chars with a EOL
        endNewLine - postfix the chars with a EOL
        -
        Returns:
        the number of characters inserted
        -
      • -
      - - - -
        -
      • -

        insertCharacters

        -
        public int insertCharacters(String chars,
        -                   int insertPos)
        -
        Insert 1 or more characters into the string. The inserted text will first be made - safe by removing any inappropriate EOL characters.
        - Do not use this method to insert EOL characters, use the
        insertEOL(int)
        - method instead.
        -
        Parameters:
        insertPos - position in string to insert characters
        chars - the characters to insert
        -
        Returns:
        the number of characters inserted
        -
      • -
      - - - -
        -
      • -

        insertCharacters

        -
        public int insertCharacters(String chars,
        -                   int insertPos,
        -                   boolean startNewLine,
        -                   boolean endNewLine)
        -
        Insert 1 or more characters into the string. The inserted text will first be made - safe by removing any inappropriate EOL characters.
        - Do not use this method to insert EOL characters, use the
        insertEOL(int)
        - method instead.
        -
        Parameters:
        insertPos - position in string to insert characters
        chars - the characters to insert
        startNewLine - if true insert onto a new line
        -
        Returns:
        the number of characters inserted
        -
      • -
      - - - -
        -
      • -

        insertEOL

        -
        public boolean insertEOL(int insertPos)
        -
        Use this method to insert an EOL character.
        -
        Parameters:
        insertPos - index position to insert EOL
        -
        Returns:
        true if an EOL was inserted into the string
        -
      • -
      - - - -
        -
      • -

        deleteCharacters

        -
        public boolean deleteCharacters(int fromPos,
        -                       int nbrToRemove)
        -
        Remove a number of characters from the string
        -
        Parameters:
        nbrToRemove - number of characters to remove
        fromPos - start location for removal
        -
        Returns:
        true if the deletion was successful else false
        -
      • -
      - - - -
        -
      • -

        invalidateText

        -
        public void invalidateText()
        -
      • -
      - - - -
        -
      • -

        getLines

        -
        public LinkedList<StyledString.TextLayoutInfo> getLines(Graphics2D g2d)
        -
        Get the text layouts for display if the string has changed since last call - to this method regenerate them.
        -
        Parameters:
        g2d - Graphics2D display context
        -
        Returns:
        a list of text layouts for rendering
        -
      • -
      - - - -
        -
      • -

        getNbrLines

        -
        public int getNbrLines()
        -
        Get the number of lines in the layout
        -
      • -
      - - - -
        -
      • -

        getTextAreaHeight

        -
        public float getTextAreaHeight()
        -
        Return the height of the text line(s)
        -
      • -
      - - - -
        -
      • -

        getMaxLineLength

        -
        public float getMaxLineLength()
        -
        Return the length of the longest line.
        -
      • -
      - - - -
        -
      • -

        getMaxLineHeight

        -
        public float getMaxLineHeight()
        -
        Get the height of the tallest line
        -
      • -
      - - - -
        -
      • -

        getWrapWidth

        -
        public int getWrapWidth()
        -
        Get the break width used to create the lines.
        -
      • -
      - - - -
        -
      • -

        setWrapWidth

        -
        public void setWrapWidth(int wrapWidth)
        -
        Set the maximum width of a line.
        -
        Parameters:
        wrapWidth -
        -
      • -
      - - - -
        -
      • -

        save

        -
        public static void save(processing.core.PApplet papp,
        -        StyledString ss,
        -        String fname)
        -
        Save the named StyleString in the named file.
        -
        Parameters:
        papp -
        ss - the styled string
        fname -
        -
      • -
      - - - -
        -
      • -

        load

        -
        public static StyledString load(processing.core.PApplet papp,
        -                String fname)
        -
        Load and return a StyledString object from the given file.
        -
        Parameters:
        papp -
        fname - the filename of the StyledString
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/package-frame.html b/Processing/libraries/G4P/reference/g4p_controls/package-frame.html deleted file mode 100644 index 3d969d7..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/package-frame.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - - -g4p_controls (Javadocs: G4P) - - - - -

g4p_controls

- - - diff --git a/Processing/libraries/G4P/reference/g4p_controls/package-summary.html b/Processing/libraries/G4P/reference/g4p_controls/package-summary.html deleted file mode 100644 index aaabef2..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/package-summary.html +++ /dev/null @@ -1,453 +0,0 @@ - - - - - -g4p_controls (Javadocs: G4P) - - - - - - - - - - -
-

Package g4p_controls

-
-
-
    -
  • - - - - - - - - - - - - - - - - -
    Interface Summary 
    InterfaceDescription
    Focusable -
    Any text input control that can receive or lose focus when the tab key is typed must - implement this interface.
    -
    GConstants -
    These constants can all be available to the Processor.
    -
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Class Summary 
    ClassDescription
    FontManager -
    This class is used to access system fonts.
    -
    G4P -
    The core class for the global manipulation and execution of G4P.
    -
    GAbstractControl -
    Abstract base class for all GUI controls.
    -
    GAbstractControl.Z_Order -
    Comparator used for controlling the order components are drawn
    -
    GButton -
    This class is the Button component.
    -
    GCheckbox -
    A two-state toggle control.
    -
    GClip -
    Clipboard functionaliy for plain text
    - - This provides clipboard functionality for text and is currently only used by the - GTextField and GTextArea classes.
    -
    GCScheme -
    Defines a number of color schemes for the GUI components.
    -
    GCustomSlider -
    Slider that can be customised with user provided graphics.
    -
    GDropList -
    A drop down list component.
    -
    GEditableTextControl -
    This class is the basis for the GTextField and GTextArea classes.
    -
    GGroup -
    This class allows you to group GUI controls so that they can be treated as a single - entity for common GUI actions.
    -
    GImageButton -
    Buttons create from this class use a number of images to represent it's - state.
    -
    GImageToggleButton -
    Buttons created from this class have 2 or more toggle states.
    -
    GKnob -
    The provides an extremely configurable GUI knob controller.
    -
    GLabel -
    The label component.
    -
    GLinearTrackControl -
    Base class for linear sliders.
    -
    GOption -
    A two-state toggle control.
    -
    GPanel -
    A component that can be used to group GUI components that can be - dragged, collapsed (leaves title tab only) and un-collapsed.
    -
    GPassword -
    The password field component.
    -
    GSketchPad -
    Display area for user generated graphics.
    -
    GSlider -
    A simple graphical slider.
    -
    GSlider2D -
    This slider is used to control 2 variables by dragging the thumb over - a 2D surface.
    -
    GStick -
    This control simulates a digital joystick and is designed to give more - intuitive control in game scenarios where you might use the keyboard - e.g.
    -
    GTabManager -
    Allows TABBING between text controls.
    -
    GTextAlign -
    Is the basis for all classes that have some simple non-editable text element to them.
    -
    GTextArea -
    The text area component.
    -
    GTextBase -
    Base class for any control that uses styled text.
    -
    GTextField -
    The text field component.
    -
    GTextIconAlignBase -
    Base class for controls with text and/or icon.
    - - This class forms the basis for any control that has text and/or an icon.
    -
    GTimer -
    This class is used to trigger events at user defined intervals.
    -
    GToggleControl -
    This class forms the basis for any two-state type control (toggle switch).
    -
    GToggleGroup -
    Use this class to create a single selection collection of options.
    -
    GValueControl -
    Base class for all slider and knob type controls.
    -
    GValueControl2D -
    Base class for controls that have 2 variables e.f.
    -
    GWinData -
    This class is used to hold the data associated with a GWindow object.
    -
    GWindow -
    Base class for independent windows using JAVA2D, P2D or P3D renderers.
    -
    GWindowAWT -
    Class for independent windows using the JAVA2D renderer.
    -
    GWindowImpl -
    This class calls the appropriate methods for G4P controls for the main applet window.
    -
    GWindowNEWT -
    Class for independent windows using P2D or P3D renderers.
    -
    ImageManager -
    This class is used to load bitmap files and create images.
    -
    StyledString -
    This class is used to represent text with attributes.
    -
    StyledString.TextLayoutHitInfo -
    For multi-line text, the TextHitInfo class is not enough.
    -
    StyledString.TextLayoutInfo -
    Class to hold information about a text layout.
    -
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - -
    Enum Summary 
    EnumDescription
    GAlign -
    This class provides an enumeration that is used to control the alignment - of text and images.
    -
    GControlMode 
    GEvent -
    Enumeration of events that can be fired by G4P.
    -
    -
  • -
-
- - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/g4p_controls/package-tree.html b/Processing/libraries/G4P/reference/g4p_controls/package-tree.html deleted file mode 100644 index 743277e..0000000 --- a/Processing/libraries/G4P/reference/g4p_controls/package-tree.html +++ /dev/null @@ -1,217 +0,0 @@ - - - - - -g4p_controls Class Hierarchy (Javadocs: G4P) - - - - - - - -
- - - - - -
- - -
-

Hierarchy For Package g4p_controls

-
-
-

Class Hierarchy

- -

Interface Hierarchy

- -

Enum Hierarchy

- -
- -
- - - - - -
- - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/help-doc.html b/Processing/libraries/G4P/reference/help-doc.html deleted file mode 100644 index 1e31eb1..0000000 --- a/Processing/libraries/G4P/reference/help-doc.html +++ /dev/null @@ -1,209 +0,0 @@ - - - - - -API Help (Javadocs: G4P) - - - - - - - -
- - - - - -
- - -
-

How This API Document Is Organized

-
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
-
-
-
    -
  • -

    Package

    -

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    -
      -
    • Interfaces (italic)
    • -
    • Classes
    • -
    • Enums
    • -
    • Exceptions
    • -
    • Errors
    • -
    • Annotation Types
    • -
    -
  • -
  • -

    Class/Interface

    -

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    -
      -
    • Class inheritance diagram
    • -
    • Direct Subclasses
    • -
    • All Known Subinterfaces
    • -
    • All Known Implementing Classes
    • -
    • Class/interface declaration
    • -
    • Class/interface description
    • -
    -
      -
    • Nested Class Summary
    • -
    • Field Summary
    • -
    • Constructor Summary
    • -
    • Method Summary
    • -
    -
      -
    • Field Detail
    • -
    • Constructor Detail
    • -
    • Method Detail
    • -
    -

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    -
  • -
  • -

    Annotation Type

    -

    Each annotation type has its own separate page with the following sections:

    -
      -
    • Annotation Type declaration
    • -
    • Annotation Type description
    • -
    • Required Element Summary
    • -
    • Optional Element Summary
    • -
    • Element Detail
    • -
    -
  • -
  • -

    Enum

    -

    Each enum has its own separate page with the following sections:

    -
      -
    • Enum declaration
    • -
    • Enum description
    • -
    • Enum Constant Summary
    • -
    • Enum Constant Detail
    • -
    -
  • -
  • -

    Tree (Class Hierarchy)

    -

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    -
      -
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • -
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • -
    -
  • -
  • -

    Deprecated API

    -

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    -
  • -
  • -

    Index

    -

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    -
  • -
  • -

    Prev/Next

    -

    These links take you to the next or previous class, interface, package, or related page.

    -
  • -
  • -

    Frames/No Frames

    -

    These links show and hide the HTML frames. All pages are available with or without frames.

    -
  • -
  • -

    All Classes

    -

    The All Classes link shows all classes and interfaces except non-static nested types.

    -
  • -
  • -

    Serialized Form

    -

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    -
  • -
  • -

    Constant Field Values

    -

    The Constant Field Values page lists the static final fields and their values.

    -
  • -
-This help file applies to API documentation generated using the standard doclet.
- -
- - - - - -
- - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/index-all.html b/Processing/libraries/G4P/reference/index-all.html deleted file mode 100644 index 3cab99f..0000000 --- a/Processing/libraries/G4P/reference/index-all.html +++ /dev/null @@ -1,2718 +0,0 @@ - - - - - -Index (Javadocs: G4P) - - - - - - - -
- - - - - -
- - -
A B C D E F G H I K L M N O P Q R S T U V W X Y  - - -

A

-
-
addAttribute(AttributedCharacterIterator.Attribute, Object) - Method in class g4p_controls.StyledString
-
-
Add an attribute that affects the whole length of the string.
-
-
addAttribute(AttributedCharacterIterator.Attribute, Object, int, int, int) - Method in class g4p_controls.StyledString
-
-
Add a text attribute (style) to the specifies range of characters
-
-
addAttribute(AttributedCharacterIterator.Attribute, Object, int) - Method in class g4p_controls.StyledString
-
-
Add a text attribute (style) to an entire display line
-
-
addAttribute(AttributedCharacterIterator.Attribute, Object, int, int) - Method in class g4p_controls.StyledString
-
-
Set the attribute to be applied to a range of characters starting at - beginIdx and ending with endIdx-1.
-
-
addControl(GAbstractControl, float, float, float) - Method in class g4p_controls.GAbstractControl
-
-
This will set the rotation of the control to angle overwriting - any previous rotation set.
-
-
addControl(GAbstractControl, float, float) - Method in class g4p_controls.GAbstractControl
-
-
Add a control at the given position with zero rotation angle.
-
-
addControl(GAbstractControl) - Method in class g4p_controls.GAbstractControl
-
-
Add a control at the position and rotation specified in the control.
-
-
addControl(GAbstractControl) - Method in class g4p_controls.GGroup
-
-
A single G4P control to add to this group.
-
-
addControl(Focusable) - Method in class g4p_controls.GTabManager
-
-
Add the next text control to this tab manager.
-
-
addControl(GToggleControl) - Method in class g4p_controls.GToggleGroup
-
-
Add a GOption object to this group.
-
-
addControls(GAbstractControl...) - Method in class g4p_controls.GAbstractControl
-
-
Add several control at the position and rotation specified in each control.
-
-
addControls(GAbstractControl...) - Method in class g4p_controls.GGroup
-
-
Add one or more G4P controls to this group.
-
-
addControls(Focusable...) - Method in class g4p_controls.GTabManager
-
-
Attempt to add multiple controls to the tab manager.
-
-
addControls(GToggleControl...) - Method in class g4p_controls.GToggleGroup
-
-
Add a set of comma separated GOptions.
-
-
addData(GWinData) - Method in class g4p_controls.GWindow
-
-
To provide a unique fields for this window create a class that inherits - from GWinData with public access fields.
-
-
addDrawHandler(Object, String) - Method in class g4p_controls.GWindow
-
-
Attempt to add the 'draw' handler method.
-
-
addEventHandler(Object, String) - Method in class g4p_controls.GAbstractControl
-
-
Attempt to create the default event handler for the component class.
-
-
addItem(String) - Method in class g4p_controls.GDropList
-
-
Add an item to the end of the list.
-
-
addKeyHandler(Object, String) - Method in class g4p_controls.GWindow
-
-
Attempt to add the 'key' handler method.
-
-
addMouseHandler(Object, String) - Method in class g4p_controls.GWindow
-
-
Attempt to add the 'mouse' handler method.
-
-
addOnCloseHandler(Object, String) - Method in class g4p_controls.GWindow
-
-
Attempt to create the on-close-window event handler for this GWindow.
-
-
addPostHandler(Object, String) - Method in class g4p_controls.GWindow
-
-
Attempt to add the 'post' handler method.
-
-
addPreHandler(Object, String) - Method in class g4p_controls.GWindow
-
-
Attempt to add the 'pre' handler method.
-
-
addStyle(TextAttribute, Object, int, int) - Method in class g4p_controls.GEditableTextControl
-
-
Adds the text attribute to a range of characters on a particular line.
-
-
addStyle(TextAttribute, Object) - Method in class g4p_controls.GEditableTextControl
-
-
Adds the text attribute to a range of characters on a particular line.
-
-
addStyle(TextAttribute, Object, int, int, int) - Method in class g4p_controls.GTextArea
-
-
Adds the text attribute to a range of characters on a particular display line.
-
-
addStyle(TextAttribute, Object, int) - Method in class g4p_controls.GTextArea
-
-
Adds the text attribute to an entire display line.
-
-
ALPHA_BLOCK - Static variable in interface g4p_controls.GConstants
-
 
-
ALPHA_PICK - Static variable in interface g4p_controls.GConstants
-
 
-
appendText(String) - Method in class g4p_controls.GTextArea
-
-
Add text to the end of the current text.
-
-
appendText(String) - Method in class g4p_controls.GTextField
-
-
Add some plain text to the end of the existing text.
-
-
- - - -

B

-
-
BACKGROUND - Static variable in interface g4p_controls.GConstants
-
 
-
BLUE_SCHEME - Static variable in interface g4p_controls.GConstants
-
 
-
buttonShowListHandler(GButton, GEvent) - Method in class g4p_controls.GDropList
-
-
This method should not be called by the user.
-
-
- - - -

C

-
-
CANCEL - Static variable in interface g4p_controls.GConstants
-
 
-
changePalette(int, int[]) - Static method in class g4p_controls.GCScheme
-
-
Change a colour scheme to use the colours passed in the third parameter.
-
-
changePaletteColor(int, int, int) - Static method in class g4p_controls.GCScheme
-
-
Change a single colour within an existing scheme
-
-
clearAttributes(int, int, int) - Method in class g4p_controls.StyledString
-
-
Remove text attributes (style) to the specified line and range of characters.
-
-
clearAttributes(int) - Method in class g4p_controls.StyledString
-
 
-
clearAttributes(int, int) - Method in class g4p_controls.StyledString
-
-
Remove text attributes (style) to the specified range of characters.
-
-
clearAttributes() - Method in class g4p_controls.StyledString
-
-
Removes all styling from the string.
-
-
clearDragArea() - Method in class g4p_controls.GPanel
-
-
Remove any drag constraint from this panel.
-
-
clearSelectionStyle() - Method in class g4p_controls.GEditableTextControl
-
-
Clear any styles applied to the selected text.
-
-
clearStyles(int, int) - Method in class g4p_controls.GEditableTextControl
-
-
Clears all text attribute from a range of characters starting at position - charStart and ending with the character preceding charEnd.
-
-
clearStyles() - Method in class g4p_controls.GEditableTextControl
-
-
Clear all styles from the entire text.
-
-
clearStyles(int, int, int) - Method in class g4p_controls.GTextArea
-
-
Clears all text attribute from a range of characters on a particular display line.
-
-
clearStyles(int) - Method in class g4p_controls.GTextArea
-
-
Clears all text attribute from an entire display line.
-
-
close() - Method in class g4p_controls.GWindow
-
-
This will close the window provided the action-on-close flag is CLOSE_WINDOW - otherwise the window remains open.
-
-
CLOSE_WINDOW - Static variable in interface g4p_controls.GConstants
-
 
-
CLOSED - Static variable in interface g4p_controls.GConstants
-
 
-
compare(GAbstractControl, GAbstractControl) - Method in class g4p_controls.GAbstractControl.Z_Order
-
 
-
compareTo(StyledString.TextLayoutHitInfo) - Method in class g4p_controls.StyledString.TextLayoutHitInfo
-
 
-
compareTo(StyledString.TextLayoutInfo) - Method in class g4p_controls.StyledString.TextLayoutInfo
-
 
-
copy(String) - Static method in class g4p_controls.GClip
-
-
Copy a string to the clipboard
-
-
copyFrom(StyledString.TextLayoutHitInfo) - Method in class g4p_controls.StyledString.TextLayoutHitInfo
-
 
-
copyPalette(int, int) - Static method in class g4p_controls.GCScheme
-
-
Copies the colours from the source scheme to the destination scheme.
-
-
CTRL_ANGULAR - Static variable in interface g4p_controls.GConstants
-
 
-
CTRL_HORIZONTAL - Static variable in interface g4p_controls.GConstants
-
 
-
CTRL_VERTICAL - Static variable in interface g4p_controls.GConstants
-
 
-
CYAN_SCHEME - Static variable in interface g4p_controls.GConstants
-
 
-
- - - -

D

-
-
data - Variable in class g4p_controls.GWindow
-
-
Used to associated data to a GWindow
-
-
DECIMAL - Static variable in interface g4p_controls.GConstants
-
 
-
deleteCharacters(int, int) - Method in class g4p_controls.StyledString
-
-
Remove a number of characters from the string
-
-
description - Variable in enum g4p_controls.GControlMode
-
 
-
dispose() - Method in class g4p_controls.GAbstractControl
-
-
This will remove all references to this control in the library.
-
-
draw() - Method in class g4p_controls.GAbstractControl
-
 
-
draw() - Method in class g4p_controls.GButton
-
 
-
draw() - Method in class g4p_controls.GDropList
-
 
-
draw() - Method in class g4p_controls.GImageButton
-
 
-
draw() - Method in class g4p_controls.GImageToggleButton
-
 
-
draw() - Method in class g4p_controls.GKnob
-
 
-
draw() - Method in class g4p_controls.GLabel
-
 
-
draw() - Method in class g4p_controls.GLinearTrackControl
-
 
-
draw() - Method in class g4p_controls.GPanel
-
-
Draw the panel.
-
-
draw() - Method in class g4p_controls.GPassword
-
 
-
draw() - Method in class g4p_controls.GSketchPad
-
 
-
draw() - Method in class g4p_controls.GSlider2D
-
 
-
draw() - Method in class g4p_controls.GStick
-
 
-
draw() - Method in class g4p_controls.GTextArea
-
 
-
draw() - Method in class g4p_controls.GTextField
-
 
-
draw() - Method in class g4p_controls.GToggleControl
-
 
-
draw() - Method in class g4p_controls.GWindow
-
-
Execute any draw handler for this window.
-
-
draw() - Method in class g4p_controls.GWindowAWT
-
 
-
draw() - Method in class g4p_controls.GWindowImpl
-
 
-
draw() - Method in class g4p_controls.GWindowNEWT
-
 
-
- - - -

E

-
-
END - Static variable in interface g4p_controls.GConstants
-
 
-
ERROR - Static variable in interface g4p_controls.GConstants
-
 
-
EXIT_APP - Static variable in interface g4p_controls.GConstants
-
 
-
EXPONENT - Static variable in interface g4p_controls.GConstants
-
 
-
- - - -

F

-
-
fadeIn(int, int) - Method in class g4p_controls.GGroup
-
-
Fade to fully opaque.
-
-
fadeOut(int, int) - Method in class g4p_controls.GGroup
-
-
Fade to invisible.
-
-
fadeTo(int, int, int) - Method in class g4p_controls.GGroup
-
-
Fade to an alpha value
-
-
FAMILY - Static variable in interface g4p_controls.GConstants
-
 
-
fireAllEvents(boolean) - Method in class g4p_controls.GButton
-
-
If the parameter is true all 3 event types are generated, if false - only CLICKED events are generated (default behaviour).
-
-
fireAllEvents(boolean) - Method in class g4p_controls.GImageButton
-
-
If the parameter is true all 3 event types are generated, if false - only CLICKED events are generated (default behaviour).
-
-
fireAllEvents(boolean) - Method in class g4p_controls.GImageToggleButton
-
-
If the parameter is true all 3 event types are generated, if false - only CLICKED events are generated (default behaviour).
-
-
flashCaret(GTimer) - Method in class g4p_controls.GEditableTextControl
-
-
Do not call this directly.
-
-
flashCaret(GTimer) - Method in class g4p_controls.GPassword
-
-
Do not call this directly.
-
-
Focusable - Interface in g4p_controls
-
-
Any text input control that can receive or lose focus when the tab key is typed must - implement this interface.
-
-
FontManager - Class in g4p_controls
-
-
This class is used to access system fonts.
-
-
FontManager() - Constructor for class g4p_controls.FontManager
-
 
-
forceBufferUpdate() - Method in class g4p_controls.GAbstractControl
-
-
This is for emergency use only!!!!
- In this version of the library a visual controls is drawn to off-screen buffer - and then drawn to the screen by copying the buffer.
-
-
forceBufferUpdate() - Method in class g4p_controls.GTextBase
-
 
-
forceClose() - Method in class g4p_controls.GWindow
-
-
This will close the window provided the action-on-close flag is CLOSE_WINDOW - or KEEP_OPEN otherwise the window remains open.
-
-
FOREGROUND - Static variable in interface g4p_controls.GConstants
-
 
-
FORWARD - Static variable in interface g4p_controls.GConstants
-
 
-
- - - -

G

-
-
G4P - Class in g4p_controls
-
-
The core class for the global manipulation and execution of G4P.
-
-
G4P() - Constructor for class g4p_controls.G4P
-
 
-
g4p_controls - package g4p_controls
-
 
-
GAbstractControl - Class in g4p_controls
-
-
Abstract base class for all GUI controls.
-
-
GAbstractControl(PApplet) - Constructor for class g4p_controls.GAbstractControl
-
-
Base constructor for ALL control ctors that do not have a visible UI but require - access to a PApplet object.
-
-
GAbstractControl(PApplet, float, float) - Constructor for class g4p_controls.GAbstractControl
-
-
Base constructor for ALL control ctors that have a visible UI but whose width and height - are determined elsewhere e.g.
-
-
GAbstractControl(PApplet, float, float, float, float) - Constructor for class g4p_controls.GAbstractControl
-
-
Base constructor for ALL control ctors that have a visible UI.
-
-
GAbstractControl.Z_Order - Class in g4p_controls
-
-
Comparator used for controlling the order components are drawn
-
-
GAbstractControl.Z_Order() - Constructor for class g4p_controls.GAbstractControl.Z_Order
-
 
-
GAlign - Enum in g4p_controls
-
-
This class provides an enumeration that is used to control the alignment - of text and images.
-
-
GButton - Class in g4p_controls
-
-
This class is the Button component.
-
-
GButton(PApplet, float, float, float, float) - Constructor for class g4p_controls.GButton
-
 
-
GButton(PApplet, float, float, float, float, String) - Constructor for class g4p_controls.GButton
-
 
-
GCheckbox - Class in g4p_controls
-
-
A two-state toggle control.
-
-
GCheckbox(PApplet, float, float, float, float) - Constructor for class g4p_controls.GCheckbox
-
-
Create an option button without text.
-
-
GCheckbox(PApplet, float, float, float, float, String) - Constructor for class g4p_controls.GCheckbox
-
-
Create an option button with text.
-
-
GClip - Class in g4p_controls
-
-
Clipboard functionaliy for plain text
- - This provides clipboard functionality for text and is currently only used by the - GTextField and GTextArea classes.
-
-
GConstants - Interface in g4p_controls
-
-
These constants can all be available to the Processor.
-
-
GControlMode - Enum in g4p_controls
-
 
-
GCScheme - Class in g4p_controls
-
-
Defines a number of color schemes for the GUI components.
-
-
GCScheme() - Constructor for class g4p_controls.GCScheme
-
 
-
GCustomSlider - Class in g4p_controls
-
-
Slider that can be customised with user provided graphics.
-
-
GCustomSlider(PApplet, float, float, float, float) - Constructor for class g4p_controls.GCustomSlider
-
-
Create a custom slider using the default skin.
-
-
GCustomSlider(PApplet, float, float, float, float, String) - Constructor for class g4p_controls.GCustomSlider
-
-
Create a custom slider using the skin specified.
-
-
GDropList - Class in g4p_controls
-
-
A drop down list component.
-
-
GDropList(PApplet, float, float, float, float) - Constructor for class g4p_controls.GDropList
-
-
Create a drop down list component with a list size of 4.
-
-
GDropList(PApplet, float, float, float, float, int) - Constructor for class g4p_controls.GDropList
-
-
Create a drop down list component with a specified list size.
-
-
GEditableTextControl - Class in g4p_controls
-
-
This class is the basis for the GTextField and GTextArea classes.
-
-
GEditableTextControl(PApplet, float, float, float, float, int) - Constructor for class g4p_controls.GEditableTextControl
-
 
-
getCaretPos() - Method in class g4p_controls.GTextArea
-
-
Get the current caret position.
-
-
getCaretPos(int[]) - Method in class g4p_controls.GTextArea
-
-
Get the current caret position.
-
-
getCtrlMode() - Static method in class g4p_controls.G4P
-
-
Get the control creation mode @see ctrlMode(int mode)
-
-
getCursor() - Static method in class g4p_controls.G4P
-
-
Get the cursor shape used when the mouse is not over a G4P - control - set for the
-
-
getCursorOff() - Static method in class g4p_controls.G4P
-
-
Deprecated. -
use getCursor()
-
-
-
getCursorOver() - Method in class g4p_controls.GAbstractControl
-
-
Get the shape type when the cursor is over a control
-
-
getCX() - Method in class g4p_controls.GAbstractControl
-
-
Get the centre x position of the control.
-
-
getCY() - Method in class g4p_controls.GAbstractControl
-
-
Get the centre y position of the control.
-
-
getDesc() - Method in enum g4p_controls.GAlign
-
-
Get the description of this alignment
-
-
getDesc() - Method in enum g4p_controls.GEvent
-
-
Get a textual description of this event
-
-
getEasing() - Method in class g4p_controls.GValueControl
-
-
Get the current value used for easing.
-
-
getEndLimit() - Method in class g4p_controls.GValueControl
-
 
-
getFont(String, int, int) - Static method in class g4p_controls.FontManager
-
-
Get a system font that matches the font family name, style and size.
-
-
getFromID(int) - Static method in enum g4p_controls.GAlign
-
-
Get an alignment based on its ID number.
-
-
getFromText(String) - Static method in enum g4p_controls.GAlign
-
-
Get an alignment based on its alignment text.
-
-
getHeight() - Method in class g4p_controls.GAbstractControl
-
 
-
getID() - Method in enum g4p_controls.GAlign
-
-
Get the id number associated with this alignment
-
-
getInitialDelay() - Method in class g4p_controls.GTimer
-
-
Get the initial delay time (milliseconds).
-
-
getInterval() - Method in class g4p_controls.GTimer
-
-
Get the interval time (milliseconds) between - events.
-
-
getJavaColor(int) - Static method in class g4p_controls.GCScheme
-
-
DO NOT CALL THIS METHOD
- - This method is only to be used by GUI Builder.
-
-
getLines(Graphics2D) - Method in class g4p_controls.StyledString
-
-
Get the text layouts for display if the string has changed since last call - to this method regenerate them.
-
-
getLocalColorScheme() - Method in class g4p_controls.GAbstractControl
-
-
Get the local color scheme ID number.
-
-
getMaxLineHeight() - Method in class g4p_controls.StyledString
-
-
Get the height of the tallest line
-
-
getMaxLineLength() - Method in class g4p_controls.StyledString
-
-
Return the length of the longest line.
-
-
getMode() - Method in class g4p_controls.GStick
-
-
Get the current mode
-
-
getNbrLines() - Method in class g4p_controls.StyledString
-
-
Get the number of lines in the layout
-
-
getNbrTicks() - Method in class g4p_controls.GValueControl
-
-
Get the number of tick marks.
-
-
getOpenWindowsAsArray() - Static method in class g4p_controls.G4P
-
-
Get an array of GWindow objects even if minimised or invisible.
-
-
getOpenWindowsAsList(ArrayList<GWindow>) - Static method in class g4p_controls.G4P
-
-
Get a list of all open GWindow objects even if minimised or invisible.
-
-
getPalette(int) - Static method in class g4p_controls.GCScheme
-
-
Set the color scheme to one of the preset schemes - BLUE / GREEN / RED / PURPLE / YELLOW / CYAN / BROWN - or if you have created your own schemes following the instructions - at gui4processing.lagers.org.uk/colorscheme.html then you can enter - the appropriate numeric value of the scheme.
-
-
getPApplet() - Method in class g4p_controls.GAbstractControl
-
-
Get the PApplet that manages this component
-
-
getParent() - Method in class g4p_controls.GAbstractControl
-
-
Get the parent control.
-
-
getPassword() - Method in class g4p_controls.GPassword
-
-
Get the current password (hidden) value of this field.
-
-
getPlainText() - Method in class g4p_controls.StyledString
-
-
Get the plain text as a String.
-
-
getPlainText(int, int) - Method in class g4p_controls.StyledString
-
-
Get the plain text as a String.
-
-
getPlainText(int) - Method in class g4p_controls.StyledString
-
-
Get a line of text from the plain text.
-
-
getPlainTextAsArray() - Method in class g4p_controls.StyledString
-
-
Get the plain text as a String array.
-
-
getPosition() - Method in class g4p_controls.GStick
-
-
Returns the current position of the stick based on
-
-
getPosition(PVector) - Method in class g4p_controls.GWindow
-
-
Returns a PVector with the windows top-left coordinates.
-
-
getPosition(PVector) - Method in class g4p_controls.GWindowAWT
-
-
Get the window position
-
-
getPosition(PVector) - Method in class g4p_controls.GWindowNEWT
-
-
Get the window position.
-
-
getPrecision() - Method in class g4p_controls.GValueControl
-
-
Precision used with floating point numbers
-
-
getPrettyVersion() - Static method in class g4p_controls.G4P
-
-
return the pretty version of the library.
-
-
getPriorityFont(String[], int, int) - Static method in class g4p_controls.FontManager
-
-
Get a system font that matches one the font family names with the style and size.
-
-
getPromptText() - Method in class g4p_controls.GEditableTextControl
-
-
Get the prompt text used in this control.
-
-
getSelectedIndex() - Method in class g4p_controls.GDropList
-
-
Get the index position of the selected item
-
-
getSelectedText() - Method in class g4p_controls.GDropList
-
-
Get the text for the selected item
-
-
getSelectedText() - Method in class g4p_controls.GEditableTextControl
-
-
Get the text that has been selected (highlighted) by the user.
-
-
getSensitivity() - Method in class g4p_controls.GKnob
-
-
This gets the sensitivity to be used in modes CTRL_HORIZONTAL and CTRL_VERTICAL
-
-
getSnapshot() - Method in class g4p_controls.GAbstractControl
-
-
This method should be used sparingly since it is heavy on resources.
-
-
getSnapshot() - Method in class g4p_controls.GDropList
-
 
-
getSnapshot() - Method in class g4p_controls.GPassword
-
 
-
getSnapshot() - Method in class g4p_controls.GTextArea
-
 
-
getSnapshot() - Method in class g4p_controls.GTextField
-
 
-
getStartLimit() - Method in class g4p_controls.GValueControl
-
 
-
getState() - Method in class g4p_controls.GImageToggleButton
-
-
Get the current state value of the button.
-
-
getStickX() - Method in class g4p_controls.GStick
-
-
Get the X position of the stick from
- *
-
-
getStickY() - Method in class g4p_controls.GStick
-
-
Get the Y position of the stick from
- *
-
-
getStyledText() - Method in class g4p_controls.GEditableTextControl
-
-
Get the styled text in the control
-
-
getStyledText() - Method in class g4p_controls.GTextBase
-
-
Get the text used for this control.
-
-
getTabHeight() - Method in class g4p_controls.GPanel
-
 
-
getText() - Method in class g4p_controls.GEditableTextControl
-
-
Get the text in the control
-
-
getText(int) - Method in class g4p_controls.GTextArea
-
-
Get the text on a particular line in the text area.
-
-
getText() - Method in class g4p_controls.GTextBase
-
-
Get the text used for this control.
-
-
getTextAreaHeight() - Method in class g4p_controls.StyledString
-
-
Return the height of the text line(s)
-
-
getTextAsArray() - Method in class g4p_controls.GTextArea
-
-
Get the text as a String array.
-
-
getTextID() - Method in enum g4p_controls.GAlign
-
-
Get the text ID associated with this alignment.
-
-
getTextLength(int, boolean) - Method in class g4p_controls.GTextArea
-
-
Get the length of text on a particular line in the text area.
-
-
getTitle() - Method in class g4p_controls.GWindow
-
-
Get the windowTitle
-
-
getTitle() - Method in class g4p_controls.GWindowAWT
-
-
Get the window title
-
-
getTitle() - Method in class g4p_controls.GWindowNEWT
-
-
Get the window title
-
-
getToggleGroup() - Method in class g4p_controls.GToggleControl
-
-
Get the toggle group.
-
-
getTrackOffset() - Method in class g4p_controls.GLinearTrackControl
-
-
Get the visual offset for the value/label text.
-
-
getTurnMode() - Method in class g4p_controls.GKnob
-
-
Get the current mouse controller mode possible values are
- GKnob.CTRL_ANGULAR or GKnob.CTRL_HORIZONTAL) orGKnob.CTRL_VERTICAL
-
-
getType() - Method in enum g4p_controls.GEvent
-
-
Get the error identifier.
-
-
getUnit() - Method in class g4p_controls.GValueControl
-
 
-
getValueF() - Method in class g4p_controls.GValueControl
-
-
Get the current value as a float
-
-
getValueI() - Method in class g4p_controls.GValueControl
-
-
Get the current value as an integer.
-
-
getValueS() - Method in class g4p_controls.GLinearTrackControl
-
-
If we are using labels then this will get the label text - associated with the current value.
-
-
getValueS() - Method in class g4p_controls.GValueControl
-
-
If we are using labels then this will get the label text - associated with the current value.
-
-
getValueType() - Method in class g4p_controls.GValueControl
-
 
-
getValueXF() - Method in class g4p_controls.GSlider2D
-
-
Get the current X value as a float
-
-
getValueXI() - Method in class g4p_controls.GSlider2D
-
-
Get the current X value as an integer.
-
-
getValueXS() - Method in class g4p_controls.GSlider2D
-
-
Get the current X value as a string taking into account the number format.
-
-
getValueYF() - Method in class g4p_controls.GSlider2D
-
-
Get the current Y value as a float
-
-
getValueYI() - Method in class g4p_controls.GSlider2D
-
-
Get the current Y value as an integer.
-
-
getValueYS() - Method in class g4p_controls.GSlider2D
-
-
Get the current Y value as a string taking into account the number format.
-
-
getVersion() - Static method in class g4p_controls.G4P
-
-
return the version of the library used by Processing
-
-
getWidth() - Method in class g4p_controls.GAbstractControl
-
 
-
getWindow(PApplet, String, int, int, int, int, String) - Static method in class g4p_controls.GWindow
-
-
Factory method to create and start a new window.
-
-
getWordLength() - Method in class g4p_controls.GPassword
-
-
Get the current length of the password entered.
-
-
getWrapWidth() - Method in class g4p_controls.GEditableTextControl
-
 
-
getWrapWidth() - Method in class g4p_controls.StyledString
-
-
Get the break width used to create the lines.
-
-
getX() - Method in class g4p_controls.GAbstractControl
-
-
Get the left position of the control.
-
-
getY() - Method in class g4p_controls.GAbstractControl
-
-
Get the top position of the control.
-
-
GEvent - Enum in g4p_controls
-
-
Enumeration of events that can be fired by G4P.
-
-
GGroup - Class in g4p_controls
-
-
This class allows you to group GUI controls so that they can be treated as a single - entity for common GUI actions.
-
-
GGroup(PApplet) - Constructor for class g4p_controls.GGroup
-
-
Create a control group for the indicated PApplet.
-
-
GGroup(PApplet, int) - Constructor for class g4p_controls.GGroup
-
-
Create a control group for the indicated PApplet.
-
-
GGroup(GWindow) - Constructor for class g4p_controls.GGroup
-
-
Create a control group for the indicated GWindow.
-
-
GImageButton - Class in g4p_controls
-
-
Buttons create from this class use a number of images to represent it's - state.
-
-
GImageButton(PApplet, float, float, String[]) - Constructor for class g4p_controls.GImageButton
-
-
The control size will be set to the size of the image file used for the button OFF state.
-
-
GImageButton(PApplet, float, float, String[], String) - Constructor for class g4p_controls.GImageButton
-
-
The control size will be set to the size of the image file used for the button OFF state.
-
-
GImageButton(PApplet, float, float, float, float, String[]) - Constructor for class g4p_controls.GImageButton
-
-
Create an image button of the size specified by the parameters.
-
-
GImageButton(PApplet, float, float, float, float, String[], String) - Constructor for class g4p_controls.GImageButton
-
-
Create an image button of the size specified by the parameters.
-
-
GImageToggleButton - Class in g4p_controls
-
-
Buttons created from this class have 2 or more toggle states.
-
-
GImageToggleButton(PApplet, float, float) - Constructor for class g4p_controls.GImageToggleButton
-
-
Create the library default image-toggle-button at the stated position.
-
-
GImageToggleButton(PApplet, float, float, String, int) - Constructor for class g4p_controls.GImageToggleButton
-
-
Create an image-toggle-button.
-
-
GImageToggleButton(PApplet, float, float, String, int, int) - Constructor for class g4p_controls.GImageToggleButton
-
-
Create an image-toggle-button.
-
-
GImageToggleButton(PApplet, float, float, String, String, int) - Constructor for class g4p_controls.GImageToggleButton
-
-
Create an image-toggle-button.
-
-
GImageToggleButton(PApplet, float, float, String, String, int, int) - Constructor for class g4p_controls.GImageToggleButton
-
-
Create an image-toggle-button.
-
-
GKnob - Class in g4p_controls
-
-
The provides an extremely configurable GUI knob controller.
-
-
GKnob(PApplet, float, float, float, float, float) - Constructor for class g4p_controls.GKnob
-
-
Will create the a circular knob control that fits the rectangle define by - the values passed as parameters.
-
-
GLabel - Class in g4p_controls
-
-
The label component.
-
-
GLabel(PApplet, float, float, float, float) - Constructor for class g4p_controls.GLabel
-
 
-
GLabel(PApplet, float, float, float, float, String) - Constructor for class g4p_controls.GLabel
-
-
Create a label control.
-
-
GLinearTrackControl - Class in g4p_controls
-
-
Base class for linear sliders.
-
-
GLinearTrackControl(PApplet, float, float, float, float) - Constructor for class g4p_controls.GLinearTrackControl
-
 
-
GOLD_SCHEME - Static variable in interface g4p_controls.GConstants
-
 
-
GOption - Class in g4p_controls
-
-
A two-state toggle control.
-
-
GOption(PApplet, float, float, float, float) - Constructor for class g4p_controls.GOption
-
-
Create an option button without text.
-
-
GOption(PApplet, float, float, float, float, String) - Constructor for class g4p_controls.GOption
-
-
Create an option button with text.
-
-
GPanel - Class in g4p_controls
-
-
A component that can be used to group GUI components that can be - dragged, collapsed (leaves title tab only) and un-collapsed.
-
-
GPanel(PApplet, float, float, float, float) - Constructor for class g4p_controls.GPanel
-
-
Create a Panel that comprises of 2 parts the tab which is used to - select and move the panel and the container window below the tab which - is used to hold other components.
-
-
GPanel(PApplet, float, float, float, float, String) - Constructor for class g4p_controls.GPanel
-
-
Create a Panel that comprises of 2 parts the tab which is used to - select and move the panel and the container window below the tab which - is used to hold other components.
-
-
GPassword - Class in g4p_controls
-
-
The password field component.
-
-
GPassword(PApplet, float, float, float, float) - Constructor for class g4p_controls.GPassword
-
-
Create a password field without a scrollbar.
-
-
GPassword(PApplet, float, float, float, float, int) - Constructor for class g4p_controls.GPassword
-
-
Create a password field with the given scrollbar policy.
-
-
GREEN_SCHEME - Static variable in interface g4p_controls.GConstants
-
 
-
GSketchPad - Class in g4p_controls
-
-
Display area for user generated graphics.
-
-
GSketchPad(PApplet, float, float, float, float) - Constructor for class g4p_controls.GSketchPad
-
 
-
GSlider - Class in g4p_controls
-
-
A simple graphical slider.
-
-
GSlider(PApplet, float, float, float, float, float) - Constructor for class g4p_controls.GSlider
-
 
-
GSlider2D - Class in g4p_controls
-
-
This slider is used to control 2 variables by dragging the thumb over - a 2D surface.
-
-
GSlider2D(PApplet, float, float, float, float) - Constructor for class g4p_controls.GSlider2D
-
-
Create a 2D slider inside the specified rectangle.
-
-
GStick - Class in g4p_controls
-
-
This control simulates a digital joystick and is designed to give more - intuitive control in game scenarios where you might use the keyboard - e.g.
-
-
GStick(PApplet, float, float, float, float) - Constructor for class g4p_controls.GStick
-
-
Create the stick inside the specified rectangle.
-
-
GTabManager - Class in g4p_controls
-
-
Allows TABBING between text controls.
-
-
GTabManager() - Constructor for class g4p_controls.GTabManager
-
 
-
GTextAlign - Class in g4p_controls
-
-
Is the basis for all classes that have some simple non-editable text element to them.
-
-
GTextAlign(PApplet, float, float, float, float) - Constructor for class g4p_controls.GTextAlign
-
 
-
GTextArea - Class in g4p_controls
-
-
The text area component.
-
-
GTextArea(PApplet, float, float, float, float) - Constructor for class g4p_controls.GTextArea
-
-
Create a text area without scrollbars and a text wrap width to fit the control.
-
-
GTextArea(PApplet, float, float, float, float, int) - Constructor for class g4p_controls.GTextArea
-
-
Create a text field with the given scrollbar policy and a text wrap width to fit the control.
-
-
GTextArea(PApplet, float, float, float, float, int, int) - Constructor for class g4p_controls.GTextArea
-
-
Create a text field with the given scrollbar policy with a user specified text wrap length
-
-
GTextBase - Class in g4p_controls
-
-
Base class for any control that uses styled text.
-
-
GTextBase(PApplet, float, float, float, float) - Constructor for class g4p_controls.GTextBase
-
-
Constructor
-
-
GTextField - Class in g4p_controls
-
-
The text field component.
-
-
GTextField(PApplet, float, float, float, float) - Constructor for class g4p_controls.GTextField
-
-
Create a text field without a scrollbar.
-
-
GTextField(PApplet, float, float, float, float, int) - Constructor for class g4p_controls.GTextField
-
-
Create a text field with the given scrollbar policy.
-
-
GTextIconAlignBase - Class in g4p_controls
-
-
Base class for controls with text and/or icon.
- - This class forms the basis for any control that has text and/or an icon.
-
-
GTextIconAlignBase(PApplet, float, float, float, float) - Constructor for class g4p_controls.GTextIconAlignBase
-
 
-
GTimer - Class in g4p_controls
-
-
This class is used to trigger events at user defined intervals.
-
-
GTimer(PApplet, Object, String, int) - Constructor for class g4p_controls.GTimer
-
-
Create the GTimer object with this ctor.
-
-
GTimer(PApplet, Object, String, int, int) - Constructor for class g4p_controls.GTimer
-
-
Create the GTimer object with this ctor.
-
-
GToggleControl - Class in g4p_controls
-
-
This class forms the basis for any two-state type control (toggle switch).
-
-
GToggleControl(PApplet, float, float, float, float) - Constructor for class g4p_controls.GToggleControl
-
 
-
GToggleGroup - Class in g4p_controls
-
-
Use this class to create a single selection collection of options.
-
-
GToggleGroup() - Constructor for class g4p_controls.GToggleGroup
-
-
Create a toggle group object.
-
-
GValueControl - Class in g4p_controls
-
-
Base class for all slider and knob type controls.
-
-
GValueControl(PApplet, float, float, float, float) - Constructor for class g4p_controls.GValueControl
-
 
-
GValueControl2D - Class in g4p_controls
-
-
Base class for controls that have 2 variables e.f.
-
-
GValueControl2D(PApplet, float, float, float, float) - Constructor for class g4p_controls.GValueControl2D
-
 
-
GWinData - Class in g4p_controls
-
-
This class is used to hold the data associated with a GWindow object.
-
-
GWinData() - Constructor for class g4p_controls.GWinData
-
 
-
GWindow - Class in g4p_controls
-
-
Base class for independent windows using JAVA2D, P2D or P3D renderers.
-
-
GWindowAWT - Class in g4p_controls
-
-
Class for independent windows using the JAVA2D renderer.
-
-
GWindowImpl - Class in g4p_controls
-
-
This class calls the appropriate methods for G4P controls for the main applet window.
-
-
GWindowImpl(PApplet) - Constructor for class g4p_controls.GWindowImpl
-
 
-
GWindowNEWT - Class in g4p_controls
-
-
Class for independent windows using P2D or P3D renderers.
-
-
- - - -

H

-
-
hasFocus() - Method in class g4p_controls.GAbstractControl
-
-
Does this component have focus
-
-
hasSelection() - Method in class g4p_controls.GEditableTextControl
-
-
Find out if some text is selected (highlighted)
-
-
HOME - Static variable in interface g4p_controls.GConstants
-
 
-
hsbEventHandler(GScrollbar, GEvent) - Method in class g4p_controls.GEditableTextControl
-
-
Do not call this method directly, G4P uses it to handle input from - the horizontal scrollbar.
-
-
hsbEventHandler(GScrollbar, GEvent) - Method in class g4p_controls.GTextField
-
-
Do not call this method directly, G4P uses it to handle input from - the horizontal scrollbar.
-
-
- - - -

I

-
-
ImageManager - Class in g4p_controls
-
-
This class is used to load bitmap files and create images.
-
-
ImageManager() - Constructor for class g4p_controls.ImageManager
-
 
-
INFO - Static variable in interface g4p_controls.GConstants
-
 
-
insertCharacters(String, int, int, boolean, boolean) - Method in class g4p_controls.StyledString
-
-
Insert some text into the position indicated.
-
-
insertCharacters(String, int) - Method in class g4p_controls.StyledString
-
-
Insert 1 or more characters into the string.
-
-
insertCharacters(String, int, boolean, boolean) - Method in class g4p_controls.StyledString
-
-
Insert 1 or more characters into the string.
-
-
insertEOL(int) - Method in class g4p_controls.StyledString
-
-
Use this method to insert an EOL character.
-
-
insertItem(int, String) - Method in class g4p_controls.GDropList
-
-
Insert an item at the specified position in the list.
-
-
insertText(String, int, int) - Method in class g4p_controls.GTextArea
-
-
Insert text at the display position specified.
-
-
insertText(String, int, int, boolean, boolean) - Method in class g4p_controls.GTextArea
-
-
Insert text at the display position specified.
-
-
insertText(String, boolean, boolean) - Method in class g4p_controls.GTextArea
-
-
Insert text at the current caret position.
-
-
insertText(String) - Method in class g4p_controls.GTextArea
-
-
Insert text at the current caret position.
-
-
INTEGER - Static variable in interface g4p_controls.GConstants
-
 
-
invalidateText() - Method in class g4p_controls.StyledString
-
 
-
isCollapsed() - Method in class g4p_controls.GPanel
-
-
Find out if the panel is collapsed
-
-
isCollapsible() - Method in class g4p_controls.GPanel
-
-
Is this panel collapsible
-
-
isDraggable() - Method in class g4p_controls.GPanel
-
-
Can we drag this panel with the mouse?
-
-
isDragging() - Method in class g4p_controls.GAbstractControl
-
 
-
isDragging() - Method in class g4p_controls.GPanel
-
-
This method is used to discover whether the panel is being - dragged to a new position on the screen.
-
-
isEnabled() - Method in class g4p_controls.GAbstractControl
-
-
Is this component enabled
-
-
isFading() - Method in class g4p_controls.GGroup
-
 
-
isHorzAlign() - Method in enum g4p_controls.GAlign
-
-
Is this a horizontal alignment constant?
-
-
isIncludeOverBezel() - Method in class g4p_controls.GKnob
-
-
Is the bezel included when considering when the mouse is over.
-
-
isOpaque() - Method in class g4p_controls.GAbstractControl
-
-
Find out if the component is opaque
-
-
isOver(float, float) - Method in class g4p_controls.GAbstractControl
-
-
Determines if a particular pixel position is over the panel.
-
-
isOver(float, float) - Method in class g4p_controls.GDropList
-
-
Determines if a particular pixel position is over this control taking - into account whether it is collapsed or not.
-
-
isOver(float, float) - Method in class g4p_controls.GPanel
-
-
Determines if a particular pixel position is over the panel taking - into account whether it is collapsed or not.
-
-
isOverArcOnly() - Method in class g4p_controls.GKnob
-
-
Does the mouse only respond when over the arc?
-
-
isRunning() - Method in class g4p_controls.GTimer
-
-
Is the timer running?
-
-
isSelected() - Method in class g4p_controls.GToggleControl
-
 
-
isShowArcOnly() - Method in class g4p_controls.GKnob
-
-
Are we showing arc only?
-
-
isShowLimits() - Method in class g4p_controls.GValueControl
-
-
Are the limit values visible?
-
-
isShowTicks() - Method in class g4p_controls.GValueControl
-
-
Are the tick marks visible?
-
-
isShowTrack() - Method in class g4p_controls.GKnob
-
-
Are we showing the the value track bar.
-
-
isShowValue() - Method in class g4p_controls.GValueControl
-
-
Is the current value to be displayed?
-
-
isStickToTicks() - Method in class g4p_controls.GValueControl
-
-
Is the value constrained to the tick marks?
-
-
isTextEditEnabled() - Method in class g4p_controls.GEditableTextControl
-
-
Is this control keyboard enabled
-
-
isValid() - Method in class g4p_controls.GTimer
-
-
See if the GTimer object has been created successfully
-
-
isVertAlign() - Method in enum g4p_controls.GAlign
-
-
Is this a vertical alignment constant?
-
-
isVisible() - Method in class g4p_controls.GAbstractControl
-
 
-
isVisible() - Method in class g4p_controls.GWindow
-
-
Returns the windows visibility
-
-
isVisible() - Method in class g4p_controls.GWindowAWT
-
-
Returns true if the window is visible else false
-
-
isVisible() - Method in class g4p_controls.GWindowNEWT
-
-
Returns true if the window is visible else false
-
-
isWindowOpen(GWindow) - Static method in class g4p_controls.G4P
-
-
Use this to check whether a GWindow window is still open (as far as G4P is concerned).
-
-
- - - -

K

-
-
KEEP_OPEN - Static variable in interface g4p_controls.GConstants
-
 
-
keyEvent(KeyEvent) - Method in class g4p_controls.GAbstractControl
-
 
-
keyEvent(KeyEvent) - Method in class g4p_controls.GEditableTextControl
-
 
-
keyEvent(KeyEvent) - Method in class g4p_controls.GPassword
-
 
-
keyEvent(KeyEvent) - Method in class g4p_controls.GTextField
-
 
-
keyEvent(KeyEvent) - Method in class g4p_controls.GWindow
-
-
Execute any key event handler associated with this window and its controls
-
-
keyEvent(KeyEvent) - Method in class g4p_controls.GWindowImpl
-
-
The key method registered with Processing
-
-
- - - -

L

-
-
layout - Variable in class g4p_controls.StyledString.TextLayoutInfo
-
 
-
length() - Method in class g4p_controls.StyledString
-
-
Get the number of characters in this styled string
-
-
lineNo - Variable in class g4p_controls.StyledString.TextLayoutInfo
-
 
-
load(PApplet, String) - Static method in class g4p_controls.StyledString
-
-
Load and return a StyledString object from the given file.
-
-
loadImage(PApplet, String) - Static method in class g4p_controls.ImageManager
-
-
Load a single bitmap file return a reference to the PImage created.
-
-
loadImage(PApplet, String[]) - Static method in class g4p_controls.ImageManager
-
-
Load images from multiple files
-
-
loadText(String) - Method in class g4p_controls.GEditableTextControl
-
-
Load the styled string to be used by this control.
-
-
loadText(String) - Method in class g4p_controls.GTextBase
-
-
Load the styled string to be used by this control.
-
-
lostOwnership(Clipboard, Transferable) - Method in class g4p_controls.GClip
-
-
Reqd by ClipboardOwner interface
-
-
- - - -

M

-
-
makeColorSchemes(PApplet) - Static method in class g4p_controls.GCScheme
-
-
Called every time we create a control.
-
-
makeColorSchemes() - Static method in class g4p_controls.GCScheme
-
-
DO NOT CALL THIS METHOD
- - This method is only to be used by GUI Builder.
-
-
makeTiles1D(PApplet, PImage, int, int) - Static method in class g4p_controls.ImageManager
-
-
Make multiple images from a given image.
-
-
makeTiles2D(PApplet, PImage, int, int) - Static method in class g4p_controls.ImageManager
-
-
Make multiple images from a given image.
-
-
markForDisposal() - Method in class g4p_controls.GAbstractControl
-
-
If the control is permanently no longer required then call - this method to remove it and free up resources.
-
-
markForDisposal() - Method in class g4p_controls.GEditableTextControl
-
-
Permanently dispose of this control.
-
-
messagesEnabled(boolean) - Static method in class g4p_controls.G4P
-
-
G4P has a range of support messages eg
if you create a GUI component - without an event handler or,
a slider where the visible size of the - slider is less than the difference between min and max values.
-
-
mode - Variable in enum g4p_controls.GControlMode
-
 
-
mouseEvent(MouseEvent) - Method in class g4p_controls.GAbstractControl
-
 
-
mouseEvent(MouseEvent) - Method in class g4p_controls.GButton
-
-
When a mouse button is clicked on a GButton it generates the GEvent.CLICKED event.
-
-
mouseEvent(MouseEvent) - Method in class g4p_controls.GDropList
-
 
-
mouseEvent(MouseEvent) - Method in class g4p_controls.GImageButton
-
-
When a mouse button is clicked on a GImageButton it generates the GEvent.CLICKED event.
-
-
mouseEvent(MouseEvent) - Method in class g4p_controls.GImageToggleButton
-
-
When a mouse button is clicked on a GImageToggleButton it generates the GEvent.CLICKED event.
-
-
mouseEvent(MouseEvent) - Method in class g4p_controls.GKnob
-
 
-
mouseEvent(MouseEvent) - Method in class g4p_controls.GLinearTrackControl
-
 
-
mouseEvent(MouseEvent) - Method in class g4p_controls.GPanel
-
-
All GUI components are registered for mouseEvents
-
-
mouseEvent(MouseEvent) - Method in class g4p_controls.GPassword
-
 
-
mouseEvent(MouseEvent) - Method in class g4p_controls.GSlider2D
-
 
-
mouseEvent(MouseEvent) - Method in class g4p_controls.GStick
-
 
-
mouseEvent(MouseEvent) - Method in class g4p_controls.GTextArea
-
-
Will respond to mouse events.
-
-
mouseEvent(MouseEvent) - Method in class g4p_controls.GTextField
-
 
-
mouseEvent(MouseEvent) - Method in class g4p_controls.GToggleControl
-
 
-
mouseEvent(MouseEvent) - Method in class g4p_controls.GWindow
-
-
Execute any mouse event handler associated with this window and its controls
-
-
mouseEvent(MouseEvent) - Method in class g4p_controls.GWindowImpl
-
-
The mouse method registered with Processing
-
-
mouseWheelForScrollbar(int) - Static method in class g4p_controls.G4P
-
-
Determines how the direction of the mouse wheel rotation is interpreted - for sliders.
-
-
mouseWheelForSlider(int) - Static method in class g4p_controls.G4P
-
-
Determines how the direction of the mouse wheel rotation is interpreted - for sliders.
-
-
moveCaretTo(int, int) - Method in class g4p_controls.GTextArea
-
-
Move the insertion point (caret) to the specified line and character.
-
-
moveTo(float, float) - Method in class g4p_controls.GAbstractControl
-
-
Move the control to the given position based on the mode.
-
-
moveTo(float, float, GControlMode) - Method in class g4p_controls.GAbstractControl
-
-
Move the control to the given position based on the mode.
-
-
- - - -

N

-
-
nbrChars - Variable in class g4p_controls.StyledString.TextLayoutInfo
-
 
-
NO - Static variable in interface g4p_controls.GConstants
-
 
-
- - - -

O

-
-
OK - Static variable in interface g4p_controls.GConstants
-
 
-
OK_CANCEL - Static variable in interface g4p_controls.GConstants
-
 
-
ORANGE_SCHEME - Static variable in interface g4p_controls.GConstants
-
 
-
ORIENT_LEFT - Static variable in interface g4p_controls.GConstants
-
 
-
ORIENT_RIGHT - Static variable in interface g4p_controls.GConstants
-
 
-
ORIENT_TRACK - Static variable in interface g4p_controls.GConstants
-
 
-
owner - Variable in class g4p_controls.GWinData
-
 
-
- - - -

P

-
-
paste() - Static method in class g4p_controls.GClip
-
-
Get a string from the clipboard
-
-
performCloseAction() - Method in class g4p_controls.GWindow
-
-
This method is executed when the window closes.
-
-
PLAIN - Static variable in interface g4p_controls.GConstants
-
 
-
post() - Method in class g4p_controls.GAbstractControl
-
 
-
post() - Method in class g4p_controls.GWindow
-
-
Execute any post handler associated with this window and its controls.
-
-
post() - Method in class g4p_controls.GWindowImpl
-
 
-
POSTURE - Static variable in interface g4p_controls.GConstants
-
 
-
POSTURE_OBLIQUE - Static variable in interface g4p_controls.GConstants
-
 
-
POSTURE_REGULAR - Static variable in interface g4p_controls.GConstants
-
 
-
pre() - Method in class g4p_controls.GAbstractControl
-
 
-
pre() - Method in class g4p_controls.GGroup
-
 
-
pre() - Method in class g4p_controls.GPassword
-
 
-
pre() - Method in class g4p_controls.GTextArea
-
 
-
pre() - Method in class g4p_controls.GTextField
-
 
-
pre() - Method in class g4p_controls.GValueControl
-
 
-
pre() - Method in class g4p_controls.GValueControl2D
-
 
-
pre() - Method in class g4p_controls.GWindow
-
-
Execute any pre handler associated with this window and its controls
-
-
pre() - Method in class g4p_controls.GWindowImpl
-
-
The pre method registered with Processing
-
-
ps_name - Variable in enum g4p_controls.GControlMode
-
 
-
PURPLE_SCHEME - Static variable in interface g4p_controls.GConstants
-
 
-
- - - -

Q

-
-
QUERY - Static variable in interface g4p_controls.GConstants
-
 
-
- - - -

R

-
-
RED_SCHEME - Static variable in interface g4p_controls.GConstants
-
 
-
registerSketch(PApplet) - Static method in class g4p_controls.G4P
-
-
Used to register the main sketch window with G4P.
-
-
removeControl(GAbstractControl) - Method in class g4p_controls.GGroup
-
-
Remove a single G4P control from this group.
-
-
removeControl(Focusable) - Method in class g4p_controls.GTabManager
-
-
Remove a control from the tab manager.
-
-
removeControls(GAbstractControl...) - Method in class g4p_controls.GGroup
-
-
Remove one or more G4P controls from this group.
-
-
removeItem(int) - Method in class g4p_controls.GDropList
-
-
Remove an item from the list.
-
-
REVERSE - Static variable in interface g4p_controls.GConstants
-
 
-
- - - -

S

-
-
save(PApplet, StyledString, String) - Static method in class g4p_controls.StyledString
-
-
Save the named StyleString in the named file.
-
-
savePalettes(PApplet) - Static method in class g4p_controls.GCScheme
-
-
Save the current colour schemes as an image in the sketch's data folder.
-
-
savePalettes(PApplet, String) - Static method in class g4p_controls.GCScheme
-
-
Save the current colour schemes as an image in the sketch's data folder.
-
-
saveSnapshot() - Method in class g4p_controls.GAbstractControl
-
-
Save a snapshot of the control using class name and sketch runtime as the filename
-
-
saveSnapshot(String) - Method in class g4p_controls.GAbstractControl
-
-
Save a snapshot of the control using the specified filename
-
-
saveText(String) - Method in class g4p_controls.GEditableTextControl
-
-
Save the styled text used by this control to file.
-
-
saveText(String) - Method in class g4p_controls.GTextBase
-
-
Save the styled text used by this control to file.
-
-
SCHEME_10 - Static variable in interface g4p_controls.GConstants
-
 
-
SCHEME_11 - Static variable in interface g4p_controls.GConstants
-
 
-
SCHEME_12 - Static variable in interface g4p_controls.GConstants
-
 
-
SCHEME_13 - Static variable in interface g4p_controls.GConstants
-
 
-
SCHEME_14 - Static variable in interface g4p_controls.GConstants
-
 
-
SCHEME_15 - Static variable in interface g4p_controls.GConstants
-
 
-
SCHEME_8 - Static variable in interface g4p_controls.GConstants
-
 
-
SCHEME_9 - Static variable in interface g4p_controls.GConstants
-
 
-
SCROLLBARS_AUTOHIDE - Static variable in interface g4p_controls.GConstants
-
-
whether to hide when not required
-
-
SCROLLBARS_BOTH - Static variable in interface g4p_controls.GConstants
-
-
Create and display both vertical and horizontal scrollbars.
-
-
SCROLLBARS_HORIZONTAL_ONLY - Static variable in interface g4p_controls.GConstants
-
-
Create and display horizontal scrollbar only.
-
-
SCROLLBARS_NONE - Static variable in interface g4p_controls.GConstants
-
-
Do not create or display any scrollbars for the text control.
-
-
SCROLLBARS_VERTICAL_ONLY - Static variable in interface g4p_controls.GConstants
-
-
Create and display vertical scrollbar only.
-
-
selectColor() - Static method in class g4p_controls.G4P
-
-
This will open a version of the Java Swing color chooser dialog.
-
-
selectFolder(String) - Static method in class g4p_controls.G4P
-
-
Select a folder from the local file system.
-
-
selectInput(String) - Static method in class g4p_controls.G4P
-
-
Select a file for input from the local file system.
-
-
selectInput(String, String, String) - Static method in class g4p_controls.G4P
-
-
Select a file for input from the local file system.
-
-
selectOption(PApplet, String, String, int, int) - Static method in class g4p_controls.G4P
-
-
Display a simple message dialog window.
-
-
selectOutput(String) - Static method in class g4p_controls.G4P
-
-
Select a file for output from the local file system.
-
-
selectOutput(String, String, String) - Static method in class g4p_controls.G4P
-
-
Select a file for output from the local file system.
-
-
setActionOnClose(int) - Method in class g4p_controls.GWindow
-
-
This sets what happens when the users attempts to close the window.
-
-
setActionOnClose(int) - Method in class g4p_controls.GWindowAWT
-
-
This sets what happens when the users attempts to close the window.
-
-
setActionOnClose(int) - Method in class g4p_controls.GWindowNEWT
-
-
This sets what happens when the users attempts to close the window.
-
-
setAlpha(int) - Method in class g4p_controls.GAbstractControl
-
-
Set the transparency of the component and make it unavailable to - mouse and keyboard events if below the threshold.
-
-
setAlpha(int, boolean) - Method in class g4p_controls.GAbstractControl
-
-
Set the transparency of the component and make it unavailable to - mouse and keyboard events if below the threshold.
-
-
setAlwaysOnTop(boolean) - Method in class g4p_controls.GWindow
-
-
Sets whether this window should always be above other windows.
-
-
setArcPolicy(boolean, boolean, boolean) - Method in class g4p_controls.GKnob
-
-
Convenience method to set both the show and the mouse over arc only properties - for this knob
-
-
setCollapsed(boolean) - Method in class g4p_controls.GPanel
-
-
Collapse or open the panel
-
-
setCollapsible(boolean) - Method in class g4p_controls.GPanel
-
-
Determine whether the panel can be collapsed when the title bar is clicked.
-
-
setCtrlMode(GControlMode) - Static method in class g4p_controls.G4P
-
-
Change the way position and size parameters are interpreted when a control is created.
-
-
setCursor(int) - Static method in class g4p_controls.G4P
-
-
Set the cursor shape to be used when the mouse is not over a - G4P control for the entire application including secondary - windows.
-
-
setCursorOff(int) - Static method in class g4p_controls.G4P
-
-
Deprecated. -
use setCursor(int)
-
-
-
setCursorOver(int) - Method in class g4p_controls.GAbstractControl
-
-
Set the shape type to use when the cursor is over a control
-
-
setDelay(int) - Method in class g4p_controls.GTimer
-
-
Sets the initial delay and the interval between events.
-
-
setDragArea(float, float, float, float) - Method in class g4p_controls.GPanel
-
-
Provided the panel is physically small enough this method will set the area - within which the panel can be dragged and move the panel inside the area if - not already inside.
-
-
setDragArea() - Method in class g4p_controls.GPanel
-
-
Provided the panel is small enough to fit inside the display area then - the panel will be constrained to fit inside the display area.
-
-
setDraggable(boolean) - Method in class g4p_controls.GPanel
-
-
Sets whether the panel can be dragged by the mouse or not.
-
-
setEasing(float) - Method in class g4p_controls.GSlider2D
-
-
Set the amount of easing to be used when a value is changing.
-
-
setEasing(float) - Method in class g4p_controls.GValueControl
-
-
Set the amount of easing to be used when a value is changing.
-
-
setEnabled(boolean) - Method in class g4p_controls.GAbstractControl
-
-
Enable or disable the ability of the component to generate mouse events.
- GTextField - it also controls key press events
- GPanel - controls whether the panel can be moved/collapsed/expanded
-
-
setEnabled(boolean) - Method in class g4p_controls.GButton
-
-
Enable or disable the ability of the component to generate mouse events.
- If the control is to be disabled when it is clicked then this will force the - mouse off button image is used.
-
-
setEnabled(int, boolean) - Method in class g4p_controls.GGroup
-
-
Enable / disable the controls.
-
-
setEnabled(boolean) - Method in class g4p_controls.GGroup
-
-
Enable / disable the controls immediately.
-
-
setEnabled(boolean) - Method in class g4p_controls.GImageButton
-
-
Enable or disable the ability of the component to generate mouse events.
- If the control is to be disabled when it is clicked then this will force the - mouse off button image is used.
-
-
setEnabled(boolean) - Method in class g4p_controls.GSlider
-
-
Enable or disable the ability of the component to generate mouse events.
- GTextField - it also controls key press events
- GPanel - controls whether the panel can be moved/collapsed/expanded
-
-
setFocus(boolean) - Method in class g4p_controls.GAbstractControl
-
-
Determines whether this component is to have focus or not
-
-
setFocus(boolean) - Method in class g4p_controls.GEditableTextControl
-
-
Determines whether this component is to have focus or not.
-
-
setFocus(boolean) - Method in class g4p_controls.GPassword
-
-
Determines whether this component is to have focus or not.
-
-
setFont(Font) - Method in class g4p_controls.GEditableTextControl
-
-
Set the font for this control.
-
-
setFont(Font) - Method in class g4p_controls.GPanel
-
 
-
setFont(Font) - Method in class g4p_controls.GPassword
-
-
Set the font to be used in this control
-
-
setFont(Font) - Method in class g4p_controls.GTextBase
-
-
Set the font to be used in this control
-
-
setGlobalAlpha(int) - Static method in class g4p_controls.G4P
-
-
Set the transparency of all controls.
-
-
setGlobalColorScheme(int) - Static method in class g4p_controls.G4P
-
-
Set the global colour scheme.
-
-
setGraphic(PGraphics) - Method in class g4p_controls.GSketchPad
-
 
-
setGripAmount(float) - Method in class g4p_controls.GKnob
-
-
The radius of the inner griper radius is calculated from the bezel radius - and the parameter gripAmount using
-
-
setHeightToFit() - Method in class g4p_controls.GTextIconAlignBase
-
-
This will change the controls height without changing the width so that it just - fits round the text and icon (if any).
-
-
setIcon(String, int, GAlign, GAlign) - Method in class g4p_controls.GTextIconAlignBase
-
-
Set the icon to be used and the horizontal and/or vertical icon alignment.
-
-
setIcon(PImage, int, GAlign, GAlign) - Method in class g4p_controls.GTextIconAlignBase
-
-
Set the icon to be used and the horizontal and/or vertical icon alignment.
-
-
setIconAlign(GAlign, GAlign) - Method in class g4p_controls.GTextIconAlignBase
-
-
Change the alignment of an existing icon.
-
-
setIncludeOverBezel(boolean) - Method in class g4p_controls.GKnob
-
-
Whether to include the bezel when deciding when the mouse is over.
-
-
setInfo(StyledString.TextLayoutInfo, TextHitInfo) - Method in class g4p_controls.StyledString.TextLayoutHitInfo
-
 
-
setInitialDelay(int) - Method in class g4p_controls.GTimer
-
-
Set the delay before the first event is triggered
-
-
setInterval(int) - Method in class g4p_controls.GTimer
-
-
Set the interval between events
-
-
setItems(String[], int) - Method in class g4p_controls.GDropList
-
-
Use this to set or change the list of items to appear in the list.
-
-
setItems(List<String>, int) - Method in class g4p_controls.GDropList
-
 
-
setJustify(boolean) - Method in class g4p_controls.GEditableTextControl
-
 
-
setJustify(boolean) - Method in class g4p_controls.StyledString
-
-
Text can be either left or fully justified.
-
-
setJustifyRatio(float) - Method in class g4p_controls.StyledString
-
-
Justify only if the line has sufficient text to do so.
-
-
setLimits(int, int) - Method in class g4p_controls.GValueControl
-
-
Sets the range of values to be returned.
-
-
setLimits(int, int, int) - Method in class g4p_controls.GValueControl
-
-
Sets the initial value and the range of values to be returned.
-
-
setLimits(float, float) - Method in class g4p_controls.GValueControl
-
-
Sets the range of values to be returned.
-
-
setLimits(float, float, float) - Method in class g4p_controls.GValueControl
-
-
Sets the initial value and the range of values to be returned.
-
-
setLimitsX(int, int, int) - Method in class g4p_controls.GSlider2D
-
-
X (horz) limits - Sets the initial value and the range of values to be returned.
-
-
setLimitsX(float, float) - Method in class g4p_controls.GSlider2D
-
-
X (horz) limits - Sets the range of values to be returned.
-
-
setLimitsX(float, float, float) - Method in class g4p_controls.GSlider2D
-
-
X (horz) limits - Sets the initial value and the range of values to be returned.
-
-
setLimitsY(int, int) - Method in class g4p_controls.GSlider2D
-
-
Y (vert) limits - Sets the range of values to be returned.
-
-
setLimitsY(int, int, int) - Method in class g4p_controls.GSlider2D
-
-
Y (vert) limits - Sets the initial value and the range of values to be returned.
-
-
setLimitsY(float, float) - Method in class g4p_controls.GSlider2D
-
-
Y (vert) limits - Sets the range of values to be returned.
-
-
setLimitsY(float, float, float) - Method in class g4p_controls.GSlider2D
-
-
Y (vert) limits - Sets the initial value and the range of values to be returned.
-
-
setLocalColor(int, int) - Method in class g4p_controls.GAbstractControl
-
-
Change a specific colour within the scheme.
-
-
setLocalColorScheme(int) - Method in class g4p_controls.GAbstractControl
-
-
Set the local colour scheme for this control.
-
-
setLocalColorScheme(int, boolean) - Method in class g4p_controls.GAbstractControl
-
-
Set the local colour scheme for this control.
-
-
setLocalColorScheme(int) - Method in class g4p_controls.GDropList
-
-
Sets the local colour scheme for this control
-
-
setLocalColorScheme(int) - Method in class g4p_controls.GEditableTextControl
-
-
Sets the local colour scheme for this control
-
-
setLocalColorScheme(int) - Method in class g4p_controls.GGroup
-
-
Set the color scheme used by these controls with immediate effect.
-
-
setLocalColorScheme(int, int) - Method in class g4p_controls.GGroup
-
-
Set the color scheme used by these controls after a delay.
-
-
setLocalColorScheme(int) - Method in class g4p_controls.GPassword
-
-
Sets the local colour scheme for this control
-
-
setLocation(int, int) - Method in class g4p_controls.GWindow
-
-
Set the windows position
-
-
setMaxWordLength(int) - Method in class g4p_controls.GPassword
-
-
Sets the max length of the password.
-
-
setMode(int) - Method in class g4p_controls.GStick
-
-
Sets the stick mode to either 4 or 8 directions.
-
-
setMouseOverEnabled(boolean) - Static method in class g4p_controls.G4P
-
-
Enables or disables cursor over component change.
-
-
setNbrTicks(int) - Method in class g4p_controls.GValueControl
-
-
The number of ticks must be >= 2 since 2 are required for the slider limits.
-
-
setNumberFormat(int, int) - Method in class g4p_controls.GSlider2D
-
-
Set the numberFormat and precision in one go.
-
-
setNumberFormat(int) - Method in class g4p_controls.GSlider2D
-
-
Set the numberFormat and precision in one go.
-
-
setNumberFormat(int, int, String) - Method in class g4p_controls.GValueControl
-
-
Set the numberFormat, precision and units in one go.
-
-
setNumberFormat(int, int) - Method in class g4p_controls.GValueControl
-
-
Set the numberFormat and precision in one go.
-
-
setNumberFormat(int) - Method in class g4p_controls.GValueControl
-
-
Set the numberFormat and precision in one go.
-
-
setOpaque(boolean) - Method in class g4p_controls.GAbstractControl
-
-
Determines whether to show the back colour or not.
-
-
setOpaque(boolean) - Method in class g4p_controls.GPanel
-
-
Determines whether to show the tab and panel back colour.
-
-
setOverArcOnly(boolean) - Method in class g4p_controls.GKnob
-
-
Decides when the knob will respond to the mouse buttons.
-
-
setPrecision(int) - Method in class g4p_controls.GSlider2D
-
-
For DECIMAL values this sets the number of decimal places to - be displayed.
-
-
setPrecision(int) - Method in class g4p_controls.GValueControl
-
-
For DECIMAL values this sets the number of decimal places to - be displayed.
-
-
setPromptText(String) - Method in class g4p_controls.GEditableTextControl
-
-
Set the prompt text for this control.
-
-
setRotation(float) - Method in class g4p_controls.GAbstractControl
-
-
Set the rotation to apply when displaying this control.
-
-
setRotation(float, GControlMode) - Method in class g4p_controls.GAbstractControl
-
-
Set the rotation to apply when displaying this control.
-
-
setSelected(int) - Method in class g4p_controls.GDropList
-
-
Set the currently selected item from the droplist by index position.
-
-
setSelected(boolean) - Method in class g4p_controls.GToggleControl
-
 
-
setSelectedTextStyle(TextAttribute, Object) - Method in class g4p_controls.GEditableTextControl
-
-
If some text has been selected then set the style.
-
-
setSensitivity(float) - Method in class g4p_controls.GKnob
-
-
This gets the sensitivity to be used in modes CTRL_HORIZONTAL and CTRL_VERTICAL
- A value of 1 is 1 degree per pixel and a value of 2 is 2 degrees per pixel.
-
-
setShowArcOnly(boolean) - Method in class g4p_controls.GKnob
-
-
This will decide whether the knob is draw as a full circle or as an arc.
-
-
setShowDecor(boolean, boolean, boolean, boolean) - Method in class g4p_controls.GValueControl
-
-
Convenience method to set what is to be drawn to the screen.
-
-
setShowLimits(boolean) - Method in class g4p_controls.GValueControl
-
-
Set whether the limits are to be displayed or not.
-
-
setShowTicks(boolean) - Method in class g4p_controls.GLinearTrackControl
-
-
Set whether the tick marks are to be displayed or not.
-
-
setShowTicks(boolean) - Method in class g4p_controls.GValueControl
-
-
Set whether the tick marks are to be displayed or not.
-
-
setShowTrack(boolean) - Method in class g4p_controls.GKnob
-
-
Whether or not to show the circular progress bar.
-
-
setShowValue(boolean) - Method in class g4p_controls.GValueControl
-
-
Set whether the current value is to be displayed or not.
-
-
setState(int) - Method in class g4p_controls.GImageToggleButton
-
-
Change the current toggle state.
-
-
setStickToTicks(boolean) - Method in class g4p_controls.GValueControl
-
-
Specify whether the values are to be constrained to the tick marks or not.
-
-
setStyle(String) - Method in class g4p_controls.GCustomSlider
-
-
Change the skin used for the slider.
-
-
setStyledText(StyledString) - Method in class g4p_controls.GTextArea
-
-
Set the styled text to be displayed.
-
-
setStyledText(StyledString) - Method in class g4p_controls.GTextBase
-
-
Allows the user to provide their own styled text for this component
-
-
setStyledText(StyledString) - Method in class g4p_controls.GTextField
-
-
Set the styled text for this textfield after ensuring that all EOL characters - have been removed.
-
-
setTabManager(GTabManager) - Method in interface g4p_controls.Focusable
-
 
-
setTabManager(GTabManager) - Method in class g4p_controls.GEditableTextControl
-
 
-
setTabManager(GTabManager) - Method in class g4p_controls.GPassword
-
 
-
setText(String) - Method in class g4p_controls.GPanel
-
 
-
setText(String, GAlign, GAlign) - Method in class g4p_controls.GTextAlign
-
-
Combines setting the text and text alignment in one method.
-
-
setText(String, int) - Method in class g4p_controls.GTextArea
-
-
Set the text to display and adjust any scrollbars
-
-
setText(String) - Method in class g4p_controls.GTextArea
-
-
Set the text to be used.
-
-
setText(String[]) - Method in class g4p_controls.GTextArea
-
-
Set the text to display and adjust any scrollbars
-
-
setText(String[], int) - Method in class g4p_controls.GTextArea
-
-
Set the text to display and adjust any scrollbars
-
-
setText(String) - Method in class g4p_controls.GTextBase
-
-
Set the text to be displayed.
-
-
setText(String) - Method in class g4p_controls.GTextField
-
-
Set the text to be displayed.
-
-
setText(String) - Method in class g4p_controls.GTextIconAlignBase
-
-
Set the text to be displayed and calculate the wrap length taking into - account any icon set.
-
-
setText(String) - Method in class g4p_controls.StyledString
-
-
Change the text for single line styled string
-
-
setText(String, int) - Method in class g4p_controls.StyledString
-
-
Change the text for single line styled string
-
-
setTextAlign(GAlign, GAlign) - Method in class g4p_controls.GTextAlign
-
-
Set the horizontal and/or vertical text alignment.
-
-
setTextBold(int, int) - Method in class g4p_controls.GTextBase
-
-
Make the selected characters bold.
-
-
setTextBold() - Method in class g4p_controls.GTextBase
-
-
Make all the characters bold.
-
-
setTextEditEnabled(boolean) - Method in class g4p_controls.GEditableTextControl
-
-
Determines whether the text can be edited using the keyboard or mouse.
-
-
setTextItalic(int, int) - Method in class g4p_controls.GTextBase
-
-
Make the selected characters italic.
-
-
setTextItalic() - Method in class g4p_controls.GTextBase
-
-
Make all the characters italic.
-
-
setTextOrientation(int) - Method in class g4p_controls.GLinearTrackControl
-
-
Set the text orientation for the display of the limits and value if appropriate.
-
-
setTextPlain() - Method in class g4p_controls.GTextBase
-
-
Clear all applied styles from the whole text.
-
-
setTickLabels(String[]) - Method in class g4p_controls.GLinearTrackControl
-
-
This method is used to set the text to appear alongside the tick marks.
-
-
settings() - Method in class g4p_controls.GWindow
-
 
-
setTitle(String) - Method in class g4p_controls.GWindow
-
-
Set the window title
-
-
setTrackOffset(float) - Method in class g4p_controls.GLinearTrackControl
-
-
The offset is the distance the value/labels are drawn from the - centre of the track.
-
-
setTurnMode(int) - Method in class g4p_controls.GKnob
-
-
Set the mouse control mode to use, acceptable values are
- GKnob.CTRL_ANGULAR or GKnob.CTRL_HORIZONTAL) orGKnob.CTRL_VERTICAL any - other value will be ignored.
-
-
setTurnRange(float, float) - Method in class g4p_controls.GKnob
-
-
Set the limits for the range of valid rotation angles for the knob.
-
-
setUnits(String) - Method in class g4p_controls.GValueControl
-
-
The units to be displayed with the current and limit values e.g.
-
-
setup() - Method in class g4p_controls.GWindow
-
 
-
setup() - Method in class g4p_controls.GWindowNEWT
-
 
-
setValue(float) - Method in class g4p_controls.GKnob
-
-
Set the value for the slider.
-
-
setValue(float) - Method in class g4p_controls.GValueControl
-
-
Set the value for the slider.
-
-
setValueX(float) - Method in class g4p_controls.GSlider2D
-
-
Set the X (horz) value for the slider.
-
-
setValueXY(float, float) - Method in class g4p_controls.GSlider2D
-
-
Set both the XY values for the slider.
-
-
setValueY(float) - Method in class g4p_controls.GSlider2D
-
-
Set the Y (vert) value for the slider.
-
-
setVisible(boolean) - Method in class g4p_controls.GAbstractControl
-
 
-
setVisible(int, boolean) - Method in class g4p_controls.GGroup
-
-
Make the control visible or invisible.
-
-
setVisible(boolean) - Method in class g4p_controls.GGroup
-
-
Make the control visible or invisible with immediate effect.
-
-
setVisible(boolean) - Method in class g4p_controls.GWindow
-
-
Set the windows visibility
-
-
setVisibleChar(char) - Method in class g4p_controls.GPassword
-
-
Set the character that will be displayed instead of the actual character - entered by the user.
-
-
setWindowAlpha(PApplet, int) - Static method in class g4p_controls.G4P
-
-
Set the transparency level for all controls drawn by the given - PApplet.
-
-
setWindowColorScheme(PApplet, int) - Static method in class g4p_controls.G4P
-
-
Set the colour scheme for all the controls drawn by the given - PApplet.
-
-
setWrapWidth(int) - Method in class g4p_controls.GEditableTextControl
-
 
-
setWrapWidth(int) - Method in class g4p_controls.StyledString
-
-
Set the maximum width of a line.
-
-
setXlimits(int, int) - Method in class g4p_controls.GSlider2D
-
-
X (horz) limits - Sets the range of values to be returned.
-
-
showMessage(PApplet, String, String, int) - Static method in class g4p_controls.G4P
-
-
Display a simple message dialog window.
-
-
SIZE - Static variable in interface g4p_controls.GConstants
-
 
-
start() - Method in class g4p_controls.GTimer
-
-
Start the timer (call the method forever)
-
-
start(int) - Method in class g4p_controls.GTimer
-
-
Start the timer and call the method for the number of - times indicated by nrepeats - If nrepeats is <=0 then repeat forever
-
-
startCharIndex - Variable in class g4p_controls.StyledString.TextLayoutInfo
-
 
-
stateValue() - Method in class g4p_controls.GImageToggleButton
-
-
Deprecated. -
use getState()
-
-
-
stateValue(int) - Method in class g4p_controls.GImageToggleButton
-
-
Deprecated. -
use setState(int)
-
-
-
stop() - Method in class g4p_controls.GTimer
-
-
Stop the timer (can be restarted with start() method)
-
-
STRIKETHROUGH - Static variable in interface g4p_controls.GConstants
-
 
-
STRIKETHROUGH_OFF - Static variable in interface g4p_controls.GConstants
-
 
-
STRIKETHROUGH_ON - Static variable in interface g4p_controls.GConstants
-
 
-
StyledString - Class in g4p_controls
-
-
This class is used to represent text with attributes.
-
-
StyledString(String) - Constructor for class g4p_controls.StyledString
-
-
This is assumed to be a single line of text (i.e.
-
-
StyledString(String, int) - Constructor for class g4p_controls.StyledString
-
-
Supports multiple lines of text wrapped on word boundaries.
-
-
StyledString.TextLayoutHitInfo - Class in g4p_controls
-
-
For multi-line text, the TextHitInfo class is not enough.
-
-
StyledString.TextLayoutHitInfo() - Constructor for class g4p_controls.StyledString.TextLayoutHitInfo
-
 
-
StyledString.TextLayoutHitInfo(StyledString.TextLayoutInfo) - Constructor for class g4p_controls.StyledString.TextLayoutHitInfo
-
 
-
StyledString.TextLayoutHitInfo(StyledString.TextLayoutInfo, TextHitInfo) - Constructor for class g4p_controls.StyledString.TextLayoutHitInfo
-
 
-
StyledString.TextLayoutHitInfo(StyledString.TextLayoutHitInfo) - Constructor for class g4p_controls.StyledString.TextLayoutHitInfo
-
-
Copy constructor
-
-
StyledString.TextLayoutInfo - Class in g4p_controls
-
-
Class to hold information about a text layout.
-
-
StyledString.TextLayoutInfo(int, TextLayout, int, int, float) - Constructor for class g4p_controls.StyledString.TextLayoutInfo
-
 
-
SUPERSCRIPT - Static variable in interface g4p_controls.GConstants
-
 
-
SUPERSCRIPT_OFF - Static variable in interface g4p_controls.GConstants
-
 
-
SUPERSCRIPT_SUB - Static variable in interface g4p_controls.GConstants
-
 
-
SUPERSCRIPT_SUPER - Static variable in interface g4p_controls.GConstants
-
 
-
- - - -

T

-
-
tag - Variable in class g4p_controls.GAbstractControl
-
-
Simple tag that can be used by the user
-
-
tag - Variable in class g4p_controls.GWindow
-
-
Simple tag that can be used by the user
-
-
tagNo - Variable in class g4p_controls.GAbstractControl
-
-
Allows user to specify a number for this component
-
-
tagNo - Variable in class g4p_controls.GWindow
-
-
Allows user to specify a number for this component
-
-
thi - Variable in class g4p_controls.StyledString.TextLayoutHitInfo
-
 
-
timeLeftFading() - Method in class g4p_controls.GGroup
-
 
-
tli - Variable in class g4p_controls.StyledString.TextLayoutHitInfo
-
 
-
toAdd - Variable in class g4p_controls.GWindow
-
 
-
toAdd - Variable in class g4p_controls.GWindowImpl
-
 
-
toRemove - Variable in class g4p_controls.GWindow
-
 
-
toRemove - Variable in class g4p_controls.GWindowImpl
-
 
-
toString() - Method in class g4p_controls.GAbstractControl
-
 
-
toString() - Method in enum g4p_controls.GAlign
-
-
Get the alignment text.
-
-
toString() - Method in enum g4p_controls.GControlMode
-
 
-
toString() - Method in enum g4p_controls.GEvent
-
 
-
toString() - Method in class g4p_controls.GPanel
-
 
-
toString() - Method in class g4p_controls.GTextIconAlignBase
-
 
-
toString() - Method in class g4p_controls.StyledString.TextLayoutHitInfo
-
 
-
toString() - Method in class g4p_controls.StyledString.TextLayoutInfo
-
 
-
- - - -

U

-
-
usePre35Fonts() - Static method in class g4p_controls.G4P
-
-
Versions of G4P prior to 3.5 used logical fonts for the controls.
-
-
USER_COL_SCHEME - Static variable in interface g4p_controls.GConstants
-
 
-
useRoundCorners(boolean) - Static method in class g4p_controls.GButton
-
 
-
- - - -

V

-
-
valueOf(String) - Static method in enum g4p_controls.GAlign
-
-
Returns the enum constant of this type with the specified name.
-
-
valueOf(String) - Static method in enum g4p_controls.GControlMode
-
-
Returns the enum constant of this type with the specified name.
-
-
valueOf(String) - Static method in enum g4p_controls.GEvent
-
-
Returns the enum constant of this type with the specified name.
-
-
values() - Static method in enum g4p_controls.GAlign
-
-
Returns an array containing the constants of this enum type, in -the order they are declared.
-
-
values() - Static method in enum g4p_controls.GControlMode
-
-
Returns an array containing the constants of this enum type, in -the order they are declared.
-
-
values() - Static method in enum g4p_controls.GEvent
-
-
Returns an array containing the constants of this enum type, in -the order they are declared.
-
-
vsbEventHandler(GScrollbar, GEvent) - Method in class g4p_controls.GDropList
-
-
This method should not be called by the user.
-
-
vsbEventHandler(GScrollbar, GEvent) - Method in class g4p_controls.GEditableTextControl
-
-
Do not call this method directly, G4P uses it to handle input from - the vertical scrollbar.
-
-
- - - -

W

-
-
WARNING - Static variable in interface g4p_controls.GConstants
-
 
-
WEIGHT - Static variable in interface g4p_controls.GConstants
-
 
-
WEIGHT_BOLD - Static variable in interface g4p_controls.GConstants
-
 
-
WEIGHT_DEMIBOLD - Static variable in interface g4p_controls.GConstants
-
 
-
WEIGHT_DEMILIGHT - Static variable in interface g4p_controls.GConstants
-
 
-
WEIGHT_EXTRA_LIGHT - Static variable in interface g4p_controls.GConstants
-
 
-
WEIGHT_EXTRABOLD - Static variable in interface g4p_controls.GConstants
-
 
-
WEIGHT_HEAVY - Static variable in interface g4p_controls.GConstants
-
 
-
WEIGHT_LIGHT - Static variable in interface g4p_controls.GConstants
-
 
-
WEIGHT_MEDIUM - Static variable in interface g4p_controls.GConstants
-
 
-
WEIGHT_REGULAR - Static variable in interface g4p_controls.GConstants
-
 
-
WEIGHT_SEMIBOLD - Static variable in interface g4p_controls.GConstants
-
 
-
WEIGHT_ULTRABOLD - Static variable in interface g4p_controls.GConstants
-
 
-
WIDTH - Static variable in interface g4p_controls.GConstants
-
 
-
WIDTH_CONDENSED - Static variable in interface g4p_controls.GConstants
-
 
-
WIDTH_EXTENDED - Static variable in interface g4p_controls.GConstants
-
 
-
WIDTH_REGULAR - Static variable in interface g4p_controls.GConstants
-
 
-
WIDTH_SEMI_CONDENSED - Static variable in interface g4p_controls.GConstants
-
 
-
WIDTH_SEMI_EXTENDED - Static variable in interface g4p_controls.GConstants
-
 
-
windowControls - Variable in class g4p_controls.GWindow
-
 
-
windowControls - Variable in class g4p_controls.GWindowImpl
-
 
-
- - - -

X

-
-
X4 - Static variable in interface g4p_controls.GConstants
-
 
-
X8 - Static variable in interface g4p_controls.GConstants
-
 
-
- - - -

Y

-
-
YELLOW_SCHEME - Static variable in interface g4p_controls.GConstants
-
 
-
YES - Static variable in interface g4p_controls.GConstants
-
 
-
YES_NO - Static variable in interface g4p_controls.GConstants
-
 
-
YES_NO_CANCEL - Static variable in interface g4p_controls.GConstants
-
 
-
yPosInPara - Variable in class g4p_controls.StyledString.TextLayoutInfo
-
 
-
-A B C D E F G H I K L M N O P Q R S T U V W X Y 
- -
- - - - - -
- - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/index.html b/Processing/libraries/G4P/reference/index.html deleted file mode 100644 index be57bc0..0000000 --- a/Processing/libraries/G4P/reference/index.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - -Javadocs: G4P - - - - - - -<noscript> -<div>JavaScript is disabled on your browser.</div> -</noscript> -<h2>Frame Alert</h2> -<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="g4p_controls/package-summary.html">Non-frame version</a>.</p> - - - diff --git a/Processing/libraries/G4P/reference/overview-tree.html b/Processing/libraries/G4P/reference/overview-tree.html deleted file mode 100644 index 58f2a7a..0000000 --- a/Processing/libraries/G4P/reference/overview-tree.html +++ /dev/null @@ -1,221 +0,0 @@ - - - - - -Class Hierarchy (Javadocs: G4P) - - - - - - - -
- - - - - -
- - -
-

Hierarchy For All Packages

-Package Hierarchies: - -
-
-

Class Hierarchy

- -

Interface Hierarchy

- -

Enum Hierarchy

- -
- -
- - - - - -
- - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/package-list b/Processing/libraries/G4P/reference/package-list deleted file mode 100644 index 7a1d42d..0000000 --- a/Processing/libraries/G4P/reference/package-list +++ /dev/null @@ -1 +0,0 @@ -g4p_controls diff --git a/Processing/libraries/G4P/reference/resources/background.gif b/Processing/libraries/G4P/reference/resources/background.gif deleted file mode 100644 index f471940..0000000 Binary files a/Processing/libraries/G4P/reference/resources/background.gif and /dev/null differ diff --git a/Processing/libraries/G4P/reference/resources/tab.gif b/Processing/libraries/G4P/reference/resources/tab.gif deleted file mode 100644 index 1a73a83..0000000 Binary files a/Processing/libraries/G4P/reference/resources/tab.gif and /dev/null differ diff --git a/Processing/libraries/G4P/reference/resources/titlebar.gif b/Processing/libraries/G4P/reference/resources/titlebar.gif deleted file mode 100644 index 17443b3..0000000 Binary files a/Processing/libraries/G4P/reference/resources/titlebar.gif and /dev/null differ diff --git a/Processing/libraries/G4P/reference/resources/titlebar_end.gif b/Processing/libraries/G4P/reference/resources/titlebar_end.gif deleted file mode 100644 index 3ad78d4..0000000 Binary files a/Processing/libraries/G4P/reference/resources/titlebar_end.gif and /dev/null differ diff --git a/Processing/libraries/G4P/reference/serialized-form.html b/Processing/libraries/G4P/reference/serialized-form.html deleted file mode 100644 index e4f48ec..0000000 --- a/Processing/libraries/G4P/reference/serialized-form.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - - -Serialized Form (Javadocs: G4P) - - - - - - - - - - -
-

Serialized Form

-
-
-
    -
  • -

    Package g4p_controls

    -
      -
    • - - -

      Class g4p_controls.StyledString extends Object implements Serializable

      -
      -
      serialVersionUID:
      -
      -8272976313009558508L
      -
      -
        -
      • - - -

        Serialization Methods

        - -
      • -
      • - - -

        Serialized Fields

        -
          -
        • -

          plainText

          -
          String plainText
          -
        • -
        • -

          baseStyle

          -
          LinkedList<E> baseStyle
          -
        • -
        • -

          atrun

          -
          LinkedList<E> atrun
          -
        • -
        • -

          wrapWidth

          -
          int wrapWidth
          -
        • -
        • -

          invalidLayout

          -
          boolean invalidLayout
          -
        • -
        • -

          invalidText

          -
          boolean invalidText
          -
        • -
        • -

          justify

          -
          boolean justify
          -
        • -
        • -

          justifyRatio

          -
          float justifyRatio
          -
        • -
        • -

          textHeight

          -
          float textHeight
          -
        • -
        • -

          maxLineLength

          -
          float maxLineLength
          -
        • -
        • -

          maxLineHeight

          -
          float maxLineHeight
          -
        • -
        • -

          nbrLines

          -
          int nbrLines
          -
        • -
        • -

          startIdx

          -
          int startIdx
          -
        • -
        • -

          endIdx

          -
          int endIdx
          -
        • -
        -
      • -
      -
    • -
    -
  • -
-
- - - - -

Processing library G4P by Peter Lager. (c) 2016

- - diff --git a/Processing/libraries/G4P/reference/stylesheet.css b/Processing/libraries/G4P/reference/stylesheet.css deleted file mode 100644 index 54998c2..0000000 --- a/Processing/libraries/G4P/reference/stylesheet.css +++ /dev/null @@ -1,310 +0,0 @@ -/* Javadoc style sheet */ -/* Define colors, fonts and other style attributes here to override the defaults */ -/* processingLibs style by andreas schlegel, sojamo */ - - -body { - margin : 0; - padding : 0; - padding-left : 10px; - padding-right : 8px; - background-color : #FFFFFF; - font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; - font-size : 100%; - font-size : 0.7em; - font-weight : normal; - line-height : normal; - margin-bottom:30px; -} - - - - -/* Headings */ -h1, h2, h3, h4, h5, th { - font-family :Arial, Helvetica, sans-serif; - font-size:1.2em; -} - - -p { - font-size : 1em; - width:80%; -} - -pre, code { - font-family : "Courier New", Courier, monospace; - font-size : 12px; - line-height : normal; -} - - - -table { - border:0; - margin-bottom:10px; - margin-top:10px; -} - - -tr, td { - border-top: 0px solid; - border-left: 0px solid; - padding-top:8px; - padding-bottom:8px; -} - - - -hr { - border:0; - height:1px; - padding:0; - margin:0; - margin-bottom:4px; - -} - - - -dd, th, td, font { - font-size:1.0em; - line-height:1.0em; -} - - - -dt { - margin-bottom:0px; -} - - - -dd { - margin-top:2px; - margin-bottom:4px; -} - - - -a { - text-decoration: underline; - font-weight: normal; -} - -a:hover, -a:active { - text-decoration: underline; - font-weight: normal; -} - -a:visited, -a:link:visited { - text-decoration: underline; - font-weight: normal; -} - - -img { - border: 0px solid #000000; -} - - - -/* Navigation bar fonts */ -.NavBarCell1 { - border:0; -} - -.NavBarCell1Rev { - border:0; -} - -.NavBarFont1 { - font-family: Arial, Helvetica, sans-serif; - font-size:1.1em; -} - - -.NavBarFont1 b { - font-weight:normal; -} - - - -.NavBarFont1:after, .NavBarFont1Rev:after { - font-weight:normal; - content: " \\"; -} - - -.NavBarFont1Rev { - font-family: Arial, Helvetica, sans-serif; - font-size:1.1em; -} - -.NavBarFont1Rev b { - font-family: Arial, Helvetica, sans-serif; - font-size:1.1em; - font-weight:normal; -} - -.NavBarCell2 { - font-family: Arial, Helvetica, sans-serif; -} - -.NavBarCell3 { - font-family: Arial, Helvetica, sans-serif; -} - - - -font.FrameItemFont { - font-family: Helvetica, Arial, sans-serif; - font-size:1.1em; - line-height:1.1em; -} - -font.FrameHeadingFont { - font-family: Helvetica, Arial, sans-serif; - line-height:32px; -} - -/* Font used in left-hand frame lists */ -.FrameTitleFont { - font-family: Helvetica, Arial, sans-serif -} - - -.toggleList { - padding:0; - margin:0; - margin-top:12px; -} - -.toggleList dt { - font-weight:bold; - font-size:12px; - font-family:arial,sans-serif; - padding:0px; - margin:10px 0px 10px 0px; -} - -.toggleList dt span { - font-family: monospace; - padding:0; - margin:0; -} - - -.toggleList dd { - margin:0; - padding:0; -} - -html.isjs .toggleList dd { - display: none; -} - -.toggleList pre { - padding: 4px 4px 4px 4px; -} - - - - - -/* COLORS */ - -pre, code { - color: #000000; -} - - -body { - color : #333333; - background-color :#FFFFFF; -} - - -h1, h2, h3, h4, h5, h6 { - color:#555; -} - -a, -.toggleList dt { - color: #1a7eb0; -} - -a:hover, -a:active { - color: #1a7eb0; -} - -a:visited, -a:link:visited { - color: #1a7eb0; -} - -td,tr { - border-color: #999999; -} - -hr { - color:#999999; - background:#999999; -} - - -.TableHeadingColor { - background: #dcdcdc; - color: #555; -} - - -.TableSubHeadingColor { - background: #EEEEFF -} - -.TableRowColor { - background: #FFFFFF -} - - -.NavBarCell1 { - background-color:#dcdcdc; - color:#000; -} - -.NavBarCell1 a { - color:#333; -} - - -.NavBarCell1Rev { - background-color:transparent; -} - -.NavBarFont1 { - color:#333; -} - - -.NavBarFont1Rev { - color:#fff; -} - -.NavBarCell2 { - background-color:#999; -} - -.NavBarCell2 a { - color:#fff; -} - - - -.NavBarCell3 { - background-color:#dcdcdc; -} - diff --git a/Processing/libraries/G4P/src/data/blue18px/centre.png b/Processing/libraries/G4P/src/data/blue18px/centre.png deleted file mode 100644 index 6b11682..0000000 Binary files a/Processing/libraries/G4P/src/data/blue18px/centre.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/blue18px/end_left.png b/Processing/libraries/G4P/src/data/blue18px/end_left.png deleted file mode 100644 index d794461..0000000 Binary files a/Processing/libraries/G4P/src/data/blue18px/end_left.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/blue18px/end_right.png b/Processing/libraries/G4P/src/data/blue18px/end_right.png deleted file mode 100644 index 569f43a..0000000 Binary files a/Processing/libraries/G4P/src/data/blue18px/end_right.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/blue18px/handle.png b/Processing/libraries/G4P/src/data/blue18px/handle.png deleted file mode 100644 index 6d9ced6..0000000 Binary files a/Processing/libraries/G4P/src/data/blue18px/handle.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/blue18px/handle_mouseover.png b/Processing/libraries/G4P/src/data/blue18px/handle_mouseover.png deleted file mode 100644 index 0c3be66..0000000 Binary files a/Processing/libraries/G4P/src/data/blue18px/handle_mouseover.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/combo0.png b/Processing/libraries/G4P/src/data/combo0.png deleted file mode 100644 index b9cbf23..0000000 Binary files a/Processing/libraries/G4P/src/data/combo0.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/default_gui_palette.png b/Processing/libraries/G4P/src/data/default_gui_palette.png deleted file mode 100644 index 01204e5..0000000 Binary files a/Processing/libraries/G4P/src/data/default_gui_palette.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/err0.png b/Processing/libraries/G4P/src/data/err0.png deleted file mode 100644 index 91ef9ae..0000000 Binary files a/Processing/libraries/G4P/src/data/err0.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/err1.png b/Processing/libraries/G4P/src/data/err1.png deleted file mode 100644 index 3f17af5..0000000 Binary files a/Processing/libraries/G4P/src/data/err1.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/err2.png b/Processing/libraries/G4P/src/data/err2.png deleted file mode 100644 index dc3cfcc..0000000 Binary files a/Processing/libraries/G4P/src/data/err2.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/green_red20px/centre.png b/Processing/libraries/G4P/src/data/green_red20px/centre.png deleted file mode 100644 index eab6bd0..0000000 Binary files a/Processing/libraries/G4P/src/data/green_red20px/centre.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/green_red20px/end_left.png b/Processing/libraries/G4P/src/data/green_red20px/end_left.png deleted file mode 100644 index 3e730dc..0000000 Binary files a/Processing/libraries/G4P/src/data/green_red20px/end_left.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/green_red20px/end_right.png b/Processing/libraries/G4P/src/data/green_red20px/end_right.png deleted file mode 100644 index 1b4ff65..0000000 Binary files a/Processing/libraries/G4P/src/data/green_red20px/end_right.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/green_red20px/handle.png b/Processing/libraries/G4P/src/data/green_red20px/handle.png deleted file mode 100644 index 3a00333..0000000 Binary files a/Processing/libraries/G4P/src/data/green_red20px/handle.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/green_red20px/handle_mouseover.png b/Processing/libraries/G4P/src/data/green_red20px/handle_mouseover.png deleted file mode 100644 index 40b5a3e..0000000 Binary files a/Processing/libraries/G4P/src/data/green_red20px/handle_mouseover.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/grey_blue/centre.png b/Processing/libraries/G4P/src/data/grey_blue/centre.png deleted file mode 100644 index 8c0c09f..0000000 Binary files a/Processing/libraries/G4P/src/data/grey_blue/centre.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/grey_blue/end_left.png b/Processing/libraries/G4P/src/data/grey_blue/end_left.png deleted file mode 100644 index 5424edf..0000000 Binary files a/Processing/libraries/G4P/src/data/grey_blue/end_left.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/grey_blue/end_right.png b/Processing/libraries/G4P/src/data/grey_blue/end_right.png deleted file mode 100644 index 273d188..0000000 Binary files a/Processing/libraries/G4P/src/data/grey_blue/end_right.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/grey_blue/full_back.png b/Processing/libraries/G4P/src/data/grey_blue/full_back.png deleted file mode 100644 index 34b8684..0000000 Binary files a/Processing/libraries/G4P/src/data/grey_blue/full_back.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/grey_blue/handle.png b/Processing/libraries/G4P/src/data/grey_blue/handle.png deleted file mode 100644 index 02c219d..0000000 Binary files a/Processing/libraries/G4P/src/data/grey_blue/handle.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/grey_blue/handle_mouseover.png b/Processing/libraries/G4P/src/data/grey_blue/handle_mouseover.png deleted file mode 100644 index 53e423a..0000000 Binary files a/Processing/libraries/G4P/src/data/grey_blue/handle_mouseover.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/noimage3.png b/Processing/libraries/G4P/src/data/noimage3.png deleted file mode 100644 index beef91e..0000000 Binary files a/Processing/libraries/G4P/src/data/noimage3.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/pinhead.png b/Processing/libraries/G4P/src/data/pinhead.png deleted file mode 100644 index 4d50bd5..0000000 Binary files a/Processing/libraries/G4P/src/data/pinhead.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/purple18px/centre.png b/Processing/libraries/G4P/src/data/purple18px/centre.png deleted file mode 100644 index 6b11682..0000000 Binary files a/Processing/libraries/G4P/src/data/purple18px/centre.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/purple18px/end_left.png b/Processing/libraries/G4P/src/data/purple18px/end_left.png deleted file mode 100644 index d794461..0000000 Binary files a/Processing/libraries/G4P/src/data/purple18px/end_left.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/purple18px/end_right.png b/Processing/libraries/G4P/src/data/purple18px/end_right.png deleted file mode 100644 index 569f43a..0000000 Binary files a/Processing/libraries/G4P/src/data/purple18px/end_right.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/purple18px/handle.png b/Processing/libraries/G4P/src/data/purple18px/handle.png deleted file mode 100644 index 4cfece5..0000000 Binary files a/Processing/libraries/G4P/src/data/purple18px/handle.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/purple18px/handle_mouseover.png b/Processing/libraries/G4P/src/data/purple18px/handle_mouseover.png deleted file mode 100644 index 2ef2286..0000000 Binary files a/Processing/libraries/G4P/src/data/purple18px/handle_mouseover.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/red_yellow18px/centre.png b/Processing/libraries/G4P/src/data/red_yellow18px/centre.png deleted file mode 100644 index 6b11682..0000000 Binary files a/Processing/libraries/G4P/src/data/red_yellow18px/centre.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/red_yellow18px/end_left.png b/Processing/libraries/G4P/src/data/red_yellow18px/end_left.png deleted file mode 100644 index d794461..0000000 Binary files a/Processing/libraries/G4P/src/data/red_yellow18px/end_left.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/red_yellow18px/end_right.png b/Processing/libraries/G4P/src/data/red_yellow18px/end_right.png deleted file mode 100644 index 569f43a..0000000 Binary files a/Processing/libraries/G4P/src/data/red_yellow18px/end_right.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/red_yellow18px/handle.png b/Processing/libraries/G4P/src/data/red_yellow18px/handle.png deleted file mode 100644 index ecb3784..0000000 Binary files a/Processing/libraries/G4P/src/data/red_yellow18px/handle.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/red_yellow18px/handle_mouseover.png b/Processing/libraries/G4P/src/data/red_yellow18px/handle_mouseover.png deleted file mode 100644 index fc153a7..0000000 Binary files a/Processing/libraries/G4P/src/data/red_yellow18px/handle_mouseover.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/tick.png b/Processing/libraries/G4P/src/data/tick.png deleted file mode 100644 index 22118e8..0000000 Binary files a/Processing/libraries/G4P/src/data/tick.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/data/toggle.png b/Processing/libraries/G4P/src/data/toggle.png deleted file mode 100644 index c71a49e..0000000 Binary files a/Processing/libraries/G4P/src/data/toggle.png and /dev/null differ diff --git a/Processing/libraries/G4P/src/g4p_controls/ColorPreviewPanel.java b/Processing/libraries/G4P/src/g4p_controls/ColorPreviewPanel.java deleted file mode 100644 index a98c3a0..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/ColorPreviewPanel.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2013 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import java.awt.Color; -import java.awt.FlowLayout; - -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.colorchooser.ColorSelectionModel; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - -/** - * The preview panel class for the color selector. - * - * @author Peter Lager - * - */ -@SuppressWarnings("serial") -class ColorPreviewPanel extends JPanel implements ChangeListener { - JLabel lblPrev, lblCurr; - JLabel lblPrevColor, lblCurrColor; - - - public ColorPreviewPanel(Color c){ - setLayout(new FlowLayout()); - lblPrev = new JLabel("Initial Color"); - lblCurr = new JLabel("Current Color"); - lblPrevColor = new JLabel(" "); - lblPrevColor.setOpaque(true); - lblPrevColor.setBackground(c); - lblCurrColor = new JLabel(" "); - lblCurrColor.setOpaque(true); - lblCurrColor.setBackground(c); - add(lblCurr); - add(lblCurrColor); - add(lblPrevColor); - add(lblPrev); - } - - - public void stateChanged(ChangeEvent e) { - ColorSelectionModel csm = (ColorSelectionModel)e.getSource(); - lblCurrColor.setBackground(csm.getSelectedColor()); - } - - public void setPrevColor(Color pcol){ - lblPrevColor.setBackground(pcol); - } -} diff --git a/Processing/libraries/G4P/src/g4p_controls/FileChooserFilter.java b/Processing/libraries/G4P/src/g4p_controls/FileChooserFilter.java deleted file mode 100644 index 431dcac..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/FileChooserFilter.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import java.io.File; -import javax.swing.filechooser.FileFilter; -import processing.core.PApplet; - -class FileChooserFilter extends FileFilter { - - private final String[] ftypes; - private String description = null; - - public FileChooserFilter(String types){ - this(types, null); - } - - public FileChooserFilter(String types, String desc){ - ftypes = PApplet.split(types.toLowerCase(), ','); - for(String e : ftypes) - e = e.trim(); - description = desc; - } - - @Override - public boolean accept(File f) { - String fext = getExtension(f); - if(fext != null){ - for(String e : ftypes) - if(fext.equals(e)) - return true; - } - return false; - } - - @Override - public String getDescription() { - return description; - } - - public String getExtension(File f) { - String ext = null; - String s = f.getName(); - int i = s.lastIndexOf('.'); - - if (i > 0 && i < s.length() - 1) - ext = s.substring(i+1).toLowerCase(); - return ext; - } -} diff --git a/Processing/libraries/G4P/src/g4p_controls/FilenameChooserFilter.java b/Processing/libraries/G4P/src/g4p_controls/FilenameChooserFilter.java deleted file mode 100644 index 8a754a1..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/FilenameChooserFilter.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import java.io.File; -import java.io.FilenameFilter; - -import processing.core.PApplet; - -class FilenameChooserFilter implements FilenameFilter { - - private final String[] ftypes; - - public FilenameChooserFilter(String types){ - ftypes = PApplet.split(types.toLowerCase(), ','); - for(String e : ftypes) - e = e.trim(); - } - - public boolean accept(File dir, String name) { - String fext = null; - int i = name.lastIndexOf('.'); - if (i > 0 && i < name.length() - 1) - fext = name.substring(i+1).toLowerCase(); - if(fext != null){ - for(String e : ftypes) - if(fext.equals(e)) - return true; - } - return false; - } - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/Focusable.java b/Processing/libraries/G4P/src/g4p_controls/Focusable.java deleted file mode 100644 index 3a6ac42..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/Focusable.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2014 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -/** - * Any text input control that can receive or lose focus when the tab key is typed must - * implement this interface. - * - * @author Peter Lager - * - */ -public interface Focusable { - - void setTabManager(GTabManager tm); - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/FontManager.java b/Processing/libraries/G4P/src/g4p_controls/FontManager.java deleted file mode 100644 index 0218524..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/FontManager.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2014 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import java.awt.Font; - -/** - * - * This class is used to access system fonts.
- * - * Only basic functionality is available in 3.5 but will be extended hopefully :) - * - * Introduced v3.5 - * - * - * @author Peter Lager - * - */ -public class FontManager { - - - /** Default list of font family names in priority order */ - private static String[] pfnames = {"Arial", "Trebuchet MS", "Tahoma", "Helvetica", "Verdana" }; - - - /** - * Get a system font that matches one the font family names with the style and size. If - * it can't find a suitable system font from the font family it returns a logical - * font (Dialog) of the specified style and size. - * - * @param familyFontNamnes user defined list of family font names or null to use default list - * @param style Font.PLAIN, Font.BOLD, Font.Italic - * @param size font size - * @return a system font, or if none found a logical font - */ - public static Font getPriorityFont(String[] familyFontNamnes, int style, int size){ - Font font = null; - String[] names = (familyFontNamnes == null || familyFontNamnes.length == 0) - ? pfnames : familyFontNamnes; - for(String name : names){ - font = getFont(name, style, size); - if(font != null) return font; - } - return getFont("Dialog", style, size); - } - - /** - * Get a system font that matches the font family name, style and size. If - * it can't find a system font from the font family it returns null. - * - * @param familyName font family name e.g. "Arial", "Trebuchet MS" ... - * @param style Font.PLAIN, Font.BOLD, Font.Italic - * @param size font size - * @return a system font from the specified family name, if not found returns null - */ - public static Font getFont(String familyName, int style, int size){ - Font font = new Font(familyName, style, size); - if(familyName.equalsIgnoreCase(font.getFamily())) - return font; - return null; - } - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/G4P.java b/Processing/libraries/G4P/src/g4p_controls/G4P.java deleted file mode 100644 index c3e81a4..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/G4P.java +++ /dev/null @@ -1,863 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2008-13 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - - -import java.awt.Color; -import java.awt.FileDialog; -import java.awt.Font; -import java.awt.Frame; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.File; -import java.io.FilenameFilter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; - -import javax.swing.JColorChooser; -import javax.swing.JDialog; -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; -import javax.swing.colorchooser.AbstractColorChooserPanel; -import javax.swing.filechooser.FileFilter; - -import processing.core.PApplet; -import processing.core.PConstants; - -/** - * The core class for the global manipulation and execution of G4P.
- * All the methods and constants are static so to call a method or - * reference a constant prefix it's name with 'G4P.' for example
- *
- * G4P.method_name(parameters);
- * G4P.name_of_constant;
- * 

- * - * Prior to version 3.5 G4P used logical fonts to be cross-platform, - * unfortunately logical fonts do not use uniform metrics so it caused - * serious errors when formatting the text layout. In version 3.5 G4P - * will attempt to use a system fonts selected from this list
- * "Arial", "Trebuchet MS", "Tahoma", "Helvetica", "Verdana"
- * - * Arial is the preferred font (since most systems will have it installed) - * but if not found it will attempt to use the next one in the list. If - * the list is exhausted and no matching system font found it will use - * a logical font.
- * If this causes a problem with older sketches simple call
- *
- * G4P.usePre35Fonts();
- * 
- * before you create any GUI controls.
- * - * - * @author Peter Lager - * - */ -public class G4P implements GConstants, PConstants { - - static PApplet sketchWindow = null; - // Relays events to main sketch window - static GWindowImpl sketchWindowImpl = null; - - // List of all GWindows currently open - static List allWindows = new LinkedList(); - // List of all GWindows marked for closure - static List windowsForClosing = new LinkedList(); - - static boolean announced = false; - - /** - * return the pretty version of the library. - */ - public static String getPrettyVersion() { - return "4.0.4"; - } - - /** - * return the version of the library used by Processing - */ - public static String getVersion() { - return "27"; - } - - static int globalColorScheme = GCScheme.BLUE_SCHEME; - static int globalAlpha = 255; - - // Font used for all text controls - static Font globalFont = FontManager.getPriorityFont(null, Font.PLAIN, 12); - // Font used for slider numbers - static Font numericLabelFont = FontManager.getPriorityFont(null, Font.BOLD, 11);; - - // Used to order controls - static GAbstractControl.Z_Order zorder = new GAbstractControl.Z_Order(); - - /* INTERNAL USE ONLY Mouse over changer */ - static boolean cursorChangeEnabled = true; - static int mouseOff = ARROW; - - static boolean showMessages = true; - - // Determines how position and size parameters are interpreted when - // a control is created. Introduced G4P V3.0 - static GControlMode control_mode = GControlMode.CORNER; - - // Used to create a stack of styles with pushStyle and popStyle - static LinkedList styles = new LinkedList(); - - // Colour chooser - static JColorChooser chooser = null; - static Color lastColor = Color.white; // White - - // Mouse wheel direction - static int wheelForSlider = FORWARD; - static int wheelForScrollbar = FORWARD; - - /** - * Register a GWindow so we can keep track of all GWindows in the application. - * This will be needed for global transformations e.g. setGlobalAlpha(...) - * This is called from the controls constructor, and also when a GWindow is created. - * @param window - */ - static void registerWindow(GWindow window){ - if(!allWindows.contains(window)){ - allWindows.add(window); - } - } - - /** - * De-register a window , this is done when a window is closed - * @param window - */ - static void deregisterWindow(GWindow window){ - allWindows.remove(window); - } - - /** - * Used internally to register a control with its window. - * It will replace the addControl method in the controls constructors - * @param control - */ - static void registerControl(GAbstractControl control){ - PApplet app = control.getPApplet(); - if(app == sketchWindow) - sketchWindowImpl.addToWindow(control); - else if(app instanceof GWindow) - ((GWindow)app).addToWindow(control); - } - - /** - * Used to register the main sketch window with G4P. This is ignored if any - * G4P controls or windows have already been created because the act of - * creating a control will do this for you.
- * - * Some controls are created without passing a reference to the sketch applet - * but still need to know it. An example is the GColorChooser control which - * cannot be used until this method is called or some other G4P control has - * been created. - * - * Also some other libraries such as PeasyCam change the transformation matrix. - * In which case either a G4P control should be created or this method called - * before creating a PeasyCam object. - * - * @param app - */ - public static void registerSketch(PApplet app){ - if(sketchWindow == null && app != null) { - sketchWindow = app; - sketchWindowImpl = new GWindowImpl(sketchWindow); - announceG4P(); - } - } - - /** - * Set the global colour scheme. This will change the local - * colour scheme for every control. - * @param cs colour scheme to use (0-15) - */ - static void invalidateBuffers(){ - for(GWindow window : allWindows) - window.invalidateBuffers(); - if(sketchWindowImpl != null) - sketchWindowImpl.invalidateBuffers(); - } - - /** - * Set the global colour scheme. This will change the local - * colour scheme for every control. - * @param cs colour scheme to use (0-15) - */ - public static void setGlobalColorScheme(int cs){ - cs = Math.abs(cs) % 16; // Force into valid range - if(globalColorScheme != cs){ - globalColorScheme = cs; - for(GWindow window : allWindows) - window.setColorScheme(globalColorScheme); - if(sketchWindowImpl != null) - sketchWindowImpl.setColorScheme(globalColorScheme); - } - } - - /** - * Versions of G4P prior to 3.5 used logical fonts for the controls. So if you - * have old sketches then the text may look different with this and later versions - * of G4P.
- * If this is causing a problem then call this method before creating any controls. - */ - public static void usePre35Fonts(){ - globalFont = new Font("Dialog", Font.PLAIN, 10); - numericLabelFont = new Font("DialogInput", Font.BOLD, 12); - } - - /** - * Set the colour scheme for all the controls drawn by the given - * PApplet. This will override any previous colour scheme for - * these controls. - * @param app - * @param cs - */ - public static void setWindowColorScheme(PApplet app, int cs){ - cs = Math.abs(cs) % 16; // Force into valid range - if(app == sketchWindow){ - if(sketchWindowImpl != null) - sketchWindowImpl.setColorScheme(cs); - } - else if(app instanceof GWindow) - ((GWindow)app).setColorScheme(cs); - } - - /** - * Set the transparency of all controls. If the alpha level for a - * control falls below G4P.ALPHA_BLOCK then it will no longer - * respond to mouse and keyboard events. - * - * @param alpha value in the range 0 (transparent) to 255 (opaque) - */ - public static void setGlobalAlpha(int alpha){ - alpha = Math.abs(alpha) % 256; // Force into valid range - if(globalAlpha != alpha){ - globalAlpha = alpha; - for(GWindow window : allWindows) - window.setAlpha(globalAlpha); - if(sketchWindowImpl != null) - sketchWindowImpl.setAlpha(globalAlpha); - } - } - - /** - * Set the transparency level for all controls drawn by the given - * PApplet. If the alpha level for a control falls below - * G4P.ALPHA_BLOCK then it will no longer respond to mouse - * and keyboard events. - * - * @param app - * @param alpha value in the range 0 (transparent) to 255 (opaque) - */ - public static void setWindowAlpha(PApplet app, int alpha){ - alpha = Math.abs(alpha) % 256; // Force into valid range - if(app == sketchWindow){ - if(sketchWindowImpl != null) - sketchWindowImpl.setAlpha(alpha); - } - else if(app instanceof GWindow) - ((GWindow)app).setAlpha(alpha); - } - - /** - * Display the library version in the ProcessingIDE - */ - static void announceG4P(){ - if(!announced){ - System.out.println("==================================================="); - System.out.println(" G4P V4.0.4 created by Peter Lager"); - System.out.println("==================================================="); - announced = true; - } - } - - /** - * Remove a control from the window. This is used in preparation - * for disposing of a control. - * @param control - * @return true if control was remove else false - */ - static boolean removeControl(GAbstractControl control){ - PApplet app = control.getPApplet(); - if(app == sketchWindow){ - if(sketchWindowImpl != null){ - sketchWindowImpl.removeFromWindow(control); - return true; - } - return false; - } - if(app instanceof GWindow){ - ((GWindow)app).removeFromWindow(control); - return true; - } - return false; - } - - /** - * Change the way position and size parameters are interpreted when a control is created. - * or added to another control e.g. GPanel.
- * There are 3 modes.
-	 * PApplet.CORNER	 (x, y, w, h) 
- * PApplet.CORNERS (x0, y0, x1, y1)
- * PApplet.CENTER (cx, cy, w, h)

- * - * @param mode illegal values are ignored leaving the mode unchanged - */ - public static void setCtrlMode(GControlMode mode){ - if(mode != null) - control_mode = mode; - } - - /** - * Get the control creation mode @see ctrlMode(int mode) - * @return the current control mode - */ - public static GControlMode getCtrlMode(){ - return control_mode; - } - - /** - * G4P has a range of support messages eg
if you create a GUI component - * without an event handler or,
a slider where the visible size of the - * slider is less than the difference between min and max values.
- * - * This method allows the user to enable (default) or disable this option. If - * disable then it should be called before any GUI components are created.
- * - * If you are adding your own event handlers then I suggest that you disable - * messages. - * - * @param enable - */ - public static void messagesEnabled(boolean enable){ - showMessages = enable; - } - - /** - * Enables or disables cursor over component change.
- * - * Calls to this method are ignored if no G4P controls have been created. - * - * @param enable true to enable cursor change over components. - */ - public static void setMouseOverEnabled(boolean enable){ - cursorChangeEnabled = enable; - } - - /** - * Determines how the direction of the mouse wheel rotation is interpreted - * for sliders. This value applies to all sliders.
- * The default value is FORWARD - * @param dir FORWARD or REVERSE, illegal values are ignored - */ - public static void mouseWheelForSlider(int dir){ - if(dir == FORWARD || dir == REVERSE) - wheelForSlider = dir; - } - - /** - * Determines how the direction of the mouse wheel rotation is interpreted - * for sliders. This value applies to all sliders.
- * The default value is FORWARD - * @param dir FORWARD or REVERSE, illegal values are ignored - */ - public static void mouseWheelForScrollbar(int dir){ - if(dir == FORWARD || dir == REVERSE) - wheelForScrollbar = dir; - } - - /** - * @deprecated use setCursor(int) - */ - @Deprecated - public static void setCursorOff(int cursorOff){ - mouseOff = cursorOff; - } - - /** - * Set the cursor shape to be used when the mouse is not over a - * G4P control for the entire application including secondary - * windows. - * @param cursorOff the cursor shape. - */ - public static void setCursor(int cursorOff){ - mouseOff = cursorOff; - for(GWindow window : allWindows) - window.cursor(cursorOff); - if(sketchWindow != null) - sketchWindow.cursor(cursorOff); - } - - /** - * Get the cursor shape used when the mouse is not over a G4P - * control - * set for the - * - */ - public static int getCursor(){ - return mouseOff; - } - - /** - * @deprecated use getCursor() - */ - @Deprecated - public static int getCursorOff(){ - return mouseOff; - } - - /** - * Save the current style on a stack.
- * There should be a matching popStyle otherwise the program it will - * cause a memory leakage. - */ - static void pushStyle(){ - G4Pstyle s = new G4Pstyle(); - s.ctrlMode = control_mode; - s.showMessages = showMessages; - // Now save the style for later - styles.addLast(s); - } - - /** - * Remove and restore the current style from the stack.
- * There should be a matching pushStyle otherwise the program will crash. - */ - static void popStyle(){ - G4Pstyle s = styles.removeLast(); - control_mode = s.ctrlMode; - showMessages = s.showMessages; - } - - /** - * This class represents the current style used by G4P. - * It can be extended to add other attributes but these should be - * included in the pushStyle and popStyle. - * @author Peter - * - */ - static class G4Pstyle { - GControlMode ctrlMode; - boolean showMessages; - } - - /** - * Get a list of all open GWindow objects even if minimised or invisible.
- * If an ArrayList is provided then its contents are cleared before adding references - * to all open GWindow objects. If an ArrayList is not provided then a new - * ArrayList will be created.
- * This method never returns null, if there are no open windows the list will - * be of size zero. - * - * @param list an optional ArrayList to use. In null will create a new ArrayList. - * @return an ArrayList of references to all open GWindow objects. - */ - public static ArrayList getOpenWindowsAsList(ArrayList list){ - if(list == null) - list = new ArrayList(); - else - list.clear(); - for(GWindow window : allWindows) - list.add(window); - return list; - } - - /** - * Get an array of GWindow objects even if minimised or invisible.
- * This method never returns null, if there are no open windows the array - * will be of length zero. - * @return an array of references to all open GWindow objects. - */ - public static GWindow[] getOpenWindowsAsArray(){ - ArrayList list = getOpenWindowsAsList(null); - return list.toArray(new GWindow[list.size()]); - } - - /** - * Use this to check whether a GWindow window is still open (as far as G4P is concerned). - * @param window the window we are interested in - * @return true if G4P still thinks it is open - */ - public static boolean isWindowOpen(GWindow window){ - return (window != null && allWindows.contains(window)); - } - - /** - * This will open a version of the Java Swing color chooser dialog. The dialog's - * UI is dependent on the OS and JVM implementation running.
- * - * If you click on Cancel then it returns the last color previously selected. - * - * @return the ARGB colour as a 32 bit integer (as used in Processing). - */ - public static int selectColor(){ - Frame frame = getFrame(sketchWindow); - if(chooser == null){ - chooser = new JColorChooser(); - AbstractColorChooserPanel[] oldPanels = chooser.getChooserPanels(); - // Do not assume what panels are present - LinkedList panels = new LinkedList(); - for(AbstractColorChooserPanel p : oldPanels){ - String displayName = p.getDisplayName().toLowerCase(); - if(displayName.equals("swatches")) - panels.addLast(p); - else if(displayName.equals("rgb")) - panels.addFirst(p); - else if(displayName.startsWith("hs")) - panels.addFirst(p); - } - AbstractColorChooserPanel[] newPanels; - newPanels = panels.toArray(new AbstractColorChooserPanel[panels.size()]); - chooser.setChooserPanels(newPanels); - ColorPreviewPanel pp = new ColorPreviewPanel(lastColor); - chooser.getSelectionModel().addChangeListener(pp); - chooser.setPreviewPanel(pp); - } - // Set the preview color - ((ColorPreviewPanel)chooser.getPreviewPanel()).setPrevColor(lastColor); - // Use the last color selected to start it off - chooser.setColor(lastColor); - JDialog dialog = JColorChooser.createDialog(frame, - "Color picker", - true, - chooser, - new ActionListener() { - public void actionPerformed(ActionEvent e) { - lastColor = chooser.getColor(); - } - }, - null); - dialog.setVisible(true); - return lastColor.getRGB(); - } - - /** - * Select a folder from the local file system. - * - * @param prompt the frame text for the chooser - * @return the absolute path name for the selected folder, or null if action - * cancelled. - */ - public static String selectFolder(String prompt){ - String selectedFolder = null; - Frame frame = getFrame(sketchWindow); - //Frame frame = (sketchWindow == null) ? null : sketchWindow.frame; - if (PApplet.platform == MACOSX && PApplet.useNativeSelect != false) { - FileDialog fileDialog = - new FileDialog(frame, prompt, FileDialog.LOAD); - System.setProperty("apple.awt.fileDialogForDirectories", "true"); - fileDialog.setVisible(true); - System.setProperty("apple.awt.fileDialogForDirectories", "false"); - String filename = fileDialog.getFile(); - if (filename != null) { - try { - selectedFolder = (new File(fileDialog.getDirectory(), fileDialog.getFile())).getCanonicalPath(); - } catch (IOException e) { - selectedFolder = null; - } - } - } else { - JFileChooser fileChooser = new JFileChooser(); - fileChooser.setDialogTitle(prompt); - fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - int result = fileChooser.showOpenDialog(frame); - if (result == JFileChooser.APPROVE_OPTION) { - try { - selectedFolder = fileChooser.getSelectedFile().getCanonicalPath(); - } catch (IOException e) { - selectedFolder = null; - } - } - } - return selectedFolder; - } - - /** - * Select a file for input from the local file system.
- * - * - * @param prompt the frame text for the chooser - * @return the absolute path name for the selected folder, or null if action - * cancelled. - */ - public static String selectInput(String prompt){ - return selectInput(prompt, null, null); - } - - /** - * Select a file for input from the local file system.
- * - * This version allows the dialog window to filter the output based on file extensions. - * This is not available on all platforms, if not then it is ignored.
- * - * It is definitely available on Linux systems because it uses the standard Swing - * JFileFinder component. - * - * @param prompt the frame text for the chooser - * @param types a comma separated list of file extensions e.g. "png,gif,jpg,jpeg" - * @param typeDesc simple textual description of the file types e.g. "Image files" - * @return the absolute path name for the selected folder, or null if action - * cancelled. - */ - public static String selectInput(String prompt, String types, String typeDesc){ - return selectImpl(prompt, FileDialog.LOAD, types, typeDesc); - } - - /** - * Select a file for output from the local file system.
- * - * @param prompt the frame text for the chooser - * @return the absolute path name for the selected folder, or null if action is cancelled. - */ - public static String selectOutput(String prompt){ - return selectOutput(prompt, null, null); - } - - /** - * Select a file for output from the local file system.
- * - * This version allows the dialog window to filter the output based on file extensions. - * This is not available on all platforms, if not then it is ignored.
- * - * It is definitely available on Linux systems because it uses the standard swing - * JFileFinder component. - * - * @param prompt the frame text for the chooser - * @param types a comma separated list of file extensions e.g. "png,jpf,tiff" - * @param typeDesc simple textual description of the file types e.g. "Image files" - * @return the absolute path name for the selected folder, or null if action - * cancelled. - */ - public static String selectOutput(String prompt, String types, String typeDesc){ - return selectImpl(prompt, FileDialog.SAVE, types, typeDesc); - } - - /** - * The implementation of the select input and output methods. - * @param prompt - * @param mode - * @param types - * @param typeDesc - * @return the absolute path name for the selected folder, or null if action - * cancelled. - */ - private static String selectImpl(String prompt, int mode, String types, String typeDesc) { - // If no initial selection made then use last selection - // Assume that a file will not be selected - String selectedFile = null; - // Get the owner - Frame frame = getFrame(sketchWindow); - // Create a file filter - if (PApplet.useNativeSelect) { - FileDialog dialog = new FileDialog(frame, prompt, mode); - FilenameFilter filter = null; - if(types != null && types.length() > 0){ - filter = new FilenameChooserFilter(types); - dialog.setFilenameFilter(filter); - } - dialog.setVisible(true); - String directory = dialog.getDirectory(); - if(directory != null){ - selectedFile = dialog.getFile(); - if(selectedFile != null){ - try { - selectedFile = (new File(directory, selectedFile)).getCanonicalPath(); - } catch (IOException e) { - selectedFile = null; - } - } - } - } else { - JFileChooser chooser = new JFileChooser(); - chooser.setDialogTitle(prompt); - FileFilter filter = null; - if(types != null && types.length() > 0){ - filter = new FileChooserFilter(types, typeDesc); - chooser.setFileFilter(filter); - } - int result = JFileChooser.ERROR_OPTION; - if (mode == FileDialog.SAVE) { - result = chooser.showSaveDialog(frame); - } else if (mode == FileDialog.LOAD) { - result = chooser.showOpenDialog(frame); - } - if (result == JFileChooser.APPROVE_OPTION) { - try { - selectedFile = chooser.getSelectedFile().getCanonicalPath(); - } catch (IOException e) { - selectedFile = null; - } - } - } - return selectedFile; - } - - /* - Component parentComponent - The first argument to each showXxxDialog method is always the parent component, which must be a - Frame, a component inside a Frame, or null. If you specify a Frame or Dialog, then the Dialog - will appear over the center of the Frame and follow the focus behavior of that Frame. If you - specify a component inside a Frame, then the Dialog will appear over the center of that component - and will follow the focus behavior of that component's Frame. If you specify null, then the look - and feel will pick an appropriate position for the dialog generally the center of the screen and - the Dialog will not necessarily follow the focus behavior of any visible Frame or Dialog. - - The JOptionPane constructors do not include this argument. Instead, you specify the parent frame - when you create the JDialog that contains the JOptionPane, and you use the JDialog - setLocationRelativeTo method to set the dialog position. - Object message - This required argument specifies what the dialog should display in its main area. Generally, you - specify a string, which results in the dialog displaying a label with the specified text. You can - split the message over several lines by putting newline (\n) characters inside the message string. - For example: - - "Complete the sentence:\n \"Green eggs and...\"" - - String title - The title of the dialog. - int optionType - Specifies the set of buttons that appear at the bottom of the dialog. Choose from one of the - following standard sets: DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION, OK_CANCEL_OPTION. - int messageType - This argument determines the icon displayed in the dialog. Choose from one of the following - values: PLAIN_MESSAGE (no icon), ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE. - Icon icon - The icon to display in the dialog. - Object[] options - Generally used to specify the string displayed by each button at the bottom of the dialog. See - Customizing Button Text in a Standard Dialog for more information. Can also be used to specify - icons to be displayed by the buttons or non-button components to be added to the button row. - Object initialValue - Specifies the default value to be selected. - - You can either let the option pane display its default icon or specify the icon using the message - type or icon argument. By default, an option pane created with showMessageDialog displays the - information icon, one created with showConfirmDialog or showInputDialog displays the question - icon, and one created with a JOptionPane constructor displays no icon. To specify that the dialog - display a standard icon or no icon, specify the message type corresponding to the icon you desire. - To specify a custom icon, use the icon argument. The icon argument takes precedence over the - message type; as long as the icon argument has a non-null value, the dialog displays the - specified icon. - */ - - private static String PANE_TEXT_STYLE_MACOS = " @@TITLE@@

@@MESSAGE@@

"; - - private static String PANE_TEXT_STYLE_OTHER = " @@MESSAGE@@ "; - - /** - * Display a simple message dialog window.
- * - * The actual UI will depend on the platform your application is running on.
- * - * The message type should be one of the following
- * G4P.PLAIN, G4P.ERROR, G4P.INFO, G4P.WARNING, G4P.QUERY
- * - * @param owner the control responsible for this dialog. - * @param message the text to be displayed in the main area of the dialog - * @param title the text to appear in the dialog's title bar. - * @param messageType the message type - */ - public static void showMessage(PApplet owner, String message, String title, int messageType){ - Frame frame = getFrame(owner); - String m; - if(PApplet.platform == PApplet.MACOSX){ - m = PANE_TEXT_STYLE_MACOS.replaceAll("@@TITLE@@", title); - title = ""; - m = m.replaceAll("@@MESSAGE@@", message); - } - else { - m = PANE_TEXT_STYLE_OTHER.replaceAll("@@MESSAGE@@", message); - } - JOptionPane.showMessageDialog(frame, m, title, messageType); - } - - /** - * Display a simple message dialog window.
- * - * The actual UI will depend on the platform your application is running on.
- * - * The message type should be one of the following
- * G4P.PLAIN, G4P.ERROR, G4P.INFO, G4P.WARNING, G4P.QUERY
- * - * The option type should be one of the following
- * G4P.YES_NO, G4P.YES_NO_CANCEL, G4P.OK_CANCEL
- * - * This method returns a value to indicate which button was clicked. It will be - * one of the following
- * G4P.OK, G4P.YES, G4P.NO, G4P.CANCEL, G4P.CLOSED
- * - * Some comments on the returned value:
    - *
  • G4P.OK and G4P.YES have the same integer value so can be used interchangeably.
  • - *
  • G4P.CLOSED maybe returned if the dialog box is closed although on some - * systems G4P.NO or G4P.CANCEL may be returned instead.
  • - *
  • It is better to test for a positive response because they have the same value.
  • - *
  • If you must test for a negative response use !G4P.OK or !G4P.YES
- * - * @param owner the control responsible for this dialog. - * @param message the text to be displayed in the main area of the dialog - * @param title the text to appear in the dialog's title bar. - * @param messageType the message type - * @param optionType - * @return which button was clicked - */ - public static int selectOption(PApplet owner, String message, String title, int messageType, int optionType){ - Frame frame = getFrame(owner); - String m; - if(PApplet.platform == PApplet.MACOSX){ - m = PANE_TEXT_STYLE_MACOS.replaceAll("@@TITLE@@", title); - title = ""; - m = m.replaceAll("@@MESSAGE@@", message); - } - else { - m = PANE_TEXT_STYLE_OTHER.replaceAll("@@MESSAGE@@", message); - } - return JOptionPane.showOptionDialog(frame, m, title, optionType, messageType, null, null, null); - } - - /** - * Find the Frame associated with this object. - * - * @param owner the object that is responsible for this message - * @return the frame (if any) that owns this object else return null - */ - private static Frame getFrame(PApplet owner){ - Frame frame = null; - try { - frame = (Frame) ((processing.awt.PSurfaceAWT.SmoothCanvas) owner.getSurface().getNative()).getFrame(); - } - catch(Exception e){ - } - return frame; - } - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GAbstractControl.java b/Processing/libraries/G4P/src/g4p_controls/GAbstractControl.java deleted file mode 100644 index 93b004c..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GAbstractControl.java +++ /dev/null @@ -1,1183 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2008-12 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - - -import java.awt.Color; -import java.awt.Graphics2D; -import java.awt.RenderingHints; -import java.awt.geom.AffineTransform; -import java.awt.geom.NoninvertibleTransformException; -import java.lang.reflect.Method; -import java.util.Collections; -import java.util.Comparator; -import java.util.LinkedList; - -import processing.awt.PGraphicsJava2D; -import processing.core.PApplet; -import processing.core.PConstants; -import processing.core.PGraphics; -import processing.event.KeyEvent; -import processing.event.MouseEvent; - -/** - * Abstract base class for all GUI controls. - * - * @author Peter Lager - * - */ -public abstract class GAbstractControl implements PConstants, GConstants, GConstantsInternal { - - /* - * INTERNAL USE ONLY - * This holds a reference to the GComponent that currently has the - * focus. - * A component loses focus when another component takes focus with the - * takeFocus() method. The takeFocus method should use focusIsWith.loseFocus() - * before setting its value to the new component. - */ - static GAbstractControl focusIsWith = null; - - /* - * INTERNAL USE ONLY - * Use by the tab manager to move focus between controls - * - */ - static GAbstractControl controlToTakeFocus = null; - - /* - * INTERNAL USE ONLY - * Keeps track of the component the mouse is over so the mouse - * cursor can be changed if we wish. - */ - static GAbstractControl cursorIsOver; - - // Reference to the PApplet object that owns this control - protected PApplet winApp; - - /* Used to when components overlap */ - protected int z = Z_STICKY; - - // Set to true when mouse is dragging : set false on button released - protected boolean dragging = false; - - protected static float epsilon = 0.001f; - - /** Link to the parent panel (if null then it is on main window) */ - protected GAbstractControl parent = null; - - /* - * A list of child GComponents added to this component - * Created and used by GPanel and GDropList classes - */ - protected LinkedList children = null; - - protected int localColorScheme = G4P.globalColorScheme; - protected Color[] palette = null; - protected int alphaLevel = G4P.globalAlpha; - - /** Top left position of component in pixels (relative to parent or absolute if parent is null) - * (changed form int data type in V3*/ - protected float x, y; - /** Width and height of component in pixels for drawing background (changed form int data type in V3*/ - protected float width, height; - /** Half sizes reduces programming complexity later */ - protected float halfWidth, halfHeight; - /** The centre of the control */ - protected float cx, cy; - /** The angle to control is rotated (radians) */ - protected float rotAngle; - /** Introduced V3 to speed up AffineTransform operations */ - protected double[] temp = new double[2]; - - // New to V3 components have an image buffer which is only redrawn if - // it has been invalidated - protected PGraphicsJava2D buffer = null; - protected boolean bufferInvalid = true; - - /** Whether to show background or not */ - protected boolean opaque = false; - - // The cursor image when over a control - // This should be set in the controls constructor - protected int cursorOver = HAND; - - /* - * Position over control corrected for any transformation.
- * [0,0] is top left corner of the control. - * This is used to determine the mouse position over any - * particular control or part of a control. - */ - protected float ox, oy; - - /** Simple tag that can be used by the user */ - public String tag; - - /** Allows user to specify a number for this component */ - public int tagNo; - - /* Is the component visible or not */ - boolean visible = true; - - /* Is the component enabled to generate mouse and keyboard events */ - boolean enabled = true; - - /* - * Is the component available for mouse and keyboard events. - * This is only used internally to prevent user input being - * processed during animation. - * It will preserve enabled and visible flags - */ - boolean available = true; - - /* The object to handle the event */ - protected Object eventHandlerObject = null; - /* The method in eventHandlerObject to execute */ - protected Method eventHandlerMethod = null; - /* the name of the method to handle the event */ - protected String eventHandlerMethodName; - - protected int registeredMethods = 0; - - /* - * Specify the PImage that contains the image{s} to be used for the button's state.
- * This image may be a composite of 1 to 3 images tiled horizontally. - * @param img - * @param nbrImages in the range 1 - 3 - */ - // static PImage[] loadImages(PImage img, int nbrImages){ - // if(img == null || nbrImages <= 0 || nbrImages > 3) - // return null; - // PImage[] bimage = new PImage[3]; - // int iw = img.width / nbrImages; - // for(int i = 0; i < nbrImages; i++){ - // bimage[i] = new PImage(iw, img.height, ARGB); - // bimage[i].copy(img, - // i * iw, 0, iw, img.height, - // 0, 0, iw, img.height); - // } - // // If less than 3 images reuse last image in set - // for(int i = nbrImages; i < 3; i++) - // bimage[i] = bimage[nbrImages - 1]; - // return bimage; - // } - - // public static String getFocusName(){ - // if(focusIsWith == null) - // return "null"; - // else - // return focusIsWith.toString(); - // } - - /** - * Base constructor for ALL control ctors that do not have a visible UI but require - * access to a PApplet object.
- * As of V3.5 the only class using this constructor is GGroup - * - * @param theApplet - */ - public GAbstractControl(PApplet theApplet) { - G4P.registerSketch(theApplet);; - winApp = theApplet; - GCScheme.makeColorSchemes(winApp); - rotAngle = 0; - z = 0; - palette = GCScheme.getJavaColor(localColorScheme); - } - - /** - * Base constructor for ALL control ctors that have a visible UI but whose width and height - * are determined elsewhere e.g. the size of an image. It will set the - * position of the control based on controlMode.
- * - */ - public GAbstractControl(PApplet theApplet, float p0, float p1) { - this(theApplet); - switch(G4P.control_mode){ - case CORNER: // (x,y,w,h) - case CORNERS: // (x0,y0,x1,y1) - x = p0; y = p1; - break; - case CENTER: // (cx,cy,w,h) - cx = p0; cy = p1; - break; - } - } - - - /** - * Base constructor for ALL control ctors that have a visible UI. It will set the - * position and size of the control based on controlMode.
- * - */ - public GAbstractControl(PApplet theApplet, float p0, float p1, float p2, float p3) { - this(theApplet); - setPositionAndSize(p0, p1, p2, p3); - // Create the buffer (only created with this ctor) - buffer = (PGraphicsJava2D) winApp.createGraphics((int)width, (int)height, PApplet.JAVA2D); - buffer.rectMode(PApplet.CORNER); - buffer.beginDraw(); - buffer.endDraw(); - } - - // May not need this method needs to be caled in updateBuffer - protected void setTextRenderingHints(Graphics2D g2d){ - // Attempt to fix antialiasing - - // MIGHT NEED THESE - // If so they have to be done in update method - g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, - RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); - - - // buffer.g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, - // RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); - // buffer.g2.setRenderingHint( - // RenderingHints.KEY_TEXT_ANTIALIASING, - // RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB); - - } - - /** - * Calculate all the variables that determine the position and size of the - * control. This depends on
control_mode
- * - */ - private void setPositionAndSize(float n0, float n1, float n2, float n3){ - switch(G4P.control_mode){ - case CORNER: // (x,y,w,h) - x = n0; y = n1; width = n2; height = n3; - halfWidth = width/2; halfHeight = height/2; - cx = x + halfWidth; cy = y + halfHeight; - break; - case CORNERS: // (x0,y0,x1,y1) - x = n0; y = n1; width = n2 - n0; height = n3 - n1; - halfWidth = width/2; halfHeight = height/2; - cx = x + halfWidth; cy = y + halfHeight; - break; - case CENTER: // (cx,cy,w,h) - cx = n0; cy = n1; width = n2; height = n3; - halfWidth = width/2; halfHeight = height/2; - x = cx - halfWidth; y = cy - halfHeight; - break; - } - } - - /** - * Used internally to enforce minimum size constraints - * - * @param w the new width - * @param h the new height - */ - protected void resize(int w, int h){ - width = w; - height = h; - halfWidth = width/2; - halfHeight = height/2; - switch(G4P.control_mode){ - case CORNER: // (x,y,w,h) - case CORNERS: // (x0,y0,x1,y1) - cx = x + halfWidth; cy = y + halfHeight; - break; - case CENTER: // (cx,cy,w,h) - x = cx - halfWidth; y = cy - halfHeight; - break; - } - buffer = (PGraphicsJava2D) winApp.createGraphics(w, h, PApplet.JAVA2D); - buffer.rectMode(PApplet.CORNER); - } - - /** - * If the component responds to key or mouse input or has a visual representation - * this it can be part of a group controller. - * @param control the G4P control we are interested in - * @return true if it can be added to a group controller - */ - protected boolean isSuitableForGroupControl(GAbstractControl control){ - return (GROUP_CONTROL_METHOD & registeredMethods) != 0; - } - - - /* - * These are empty methods to enable polymorphism - */ - public void draw(){} - public void mouseEvent(MouseEvent event){ } - public void keyEvent(KeyEvent e) { } - public void pre(){ } - public void post(){ } - - /** - * This will remove all references to this control in the library.
- * The user is responsible for nullifying all references to this control - * in their sketch code.
- * Once this method is called the control cannot be reused but resources - * used by the control remain until all references to the control are - * set to null. - * - */ - public void dispose(){ - G4P.removeControl(this); - } - - /** - * This is for emergency use only!!!!
- * In this version of the library a visual controls is drawn to off-screen buffer - * and then drawn to the screen by copying the buffer. This means that the - * computationally expensive routines needed to draw the control (especially text - * controls) are only done when a change has been noted. This means that single - * changes need not trigger a full redraw to buffer.
- * It does mean that an error in the library code could result in the buffer not - * being updated after changes. If this happens then in draw() call this method - * on the affected control, and report it as an issue - * here
- * Thanks - */ - public void forceBufferUpdate(){ - bufferInvalid = true; - } - - protected HotSpot[] hotspots = null; - protected int currSpot = -1; - - /** - * Stop when we are over a hotspot.
- * Hotspots should be listed in order of importance. - * - * @param px - * @param py - * @return the index for the first hotspot containing px,py else return -1 - */ - protected int whichHotSpot(float px, float py){ - if(hotspots == null) return -1; - int hs = -1; - for(int i = 0; i < hotspots.length; i++){ - if(hotspots[i].contains(px, py)){ - hs = hotspots[i].id; - break; - } - } - return hs; - } - - protected int getCurrHotSpot(){ - return currSpot; - } - - /** - * Determines if a particular pixel position is over the panel. - * - * @return true if the position is over. - */ - public boolean isOver(float x, float y){ - calcTransformedOrigin(winApp.mouseX, winApp.mouseY); - currSpot = whichHotSpot(ox, oy); - return (currSpot >= 0); - } - - /** - * Change a specific colour within the scheme.
- * Most controls used a shared colour palette but calling this method - * will create a new palette specific for this control. - * - * @param colorNo the colour index value (0-15 inlc) - * @param color ARGB color value - */ - public void setLocalColor(int colorNo, int color){ - //If necessary make a duplicate of the current color scheme - if(localColorScheme >= 0){ - int[] colors = GCScheme.getPalette(localColorScheme); - palette = new Color[16]; - for(int i = 0; i < 16; i++) - palette[i] = new Color(colors[i], true); // keep alpha - localColorScheme = -1; - } - colorNo = Math.abs(colorNo) % 16; - palette[colorNo] = new Color(color, true); // keep alpha; - bufferInvalid = true; - } - - /** - * Set the local colour scheme for this control. Children are ignored. - * - * @param cs the colour scheme to use (0-15 incl.) - */ - public void setLocalColorScheme(int cs){ - setLocalColorScheme(cs, false); - } - - /** - * Set the local colour scheme for this control. - * If required include the children and their children. - * - * @param cs the colour scheme to use (0-15 incl.) - * @param includeChildren if do do the same for all descendants - */ - public void setLocalColorScheme(int cs, boolean includeChildren){ - cs = Math.abs(cs) % 16; // Force into valid range - if(localColorScheme != cs || palette == null){ - localColorScheme = cs; - palette = GCScheme.getJavaColor(localColorScheme); - bufferInvalid = true; - if(includeChildren && children != null){ - for(GAbstractControl c : children) - c.setLocalColorScheme(cs, true); - } - } - } - - /** - * Get the local color scheme ID number. If it returns a value <0 then - * it is using a control specific palette. - * - */ - public int getLocalColorScheme(){ - return localColorScheme; - } - - /** - * Set the transparency of the component and make it unavailable to - * mouse and keyboard events if below the threshold. Child controls - * are ignored? - * - * @param alpha value in the range 0 (transparent) to 255 (opaque) - */ - public void setAlpha(int alpha){ - alpha = Math.abs(alpha) % 256; - if(alphaLevel != alpha){ - alphaLevel = alpha; - available = (alphaLevel >= ALPHA_BLOCK); - bufferInvalid = true; - } - } - - /** - * Set the transparency of the component and make it unavailable to - * mouse and keyboard events if below the threshold. Child controls - * are ignored?
- * If required include the children and their children. - * - * @param alpha value in the range 0 (transparent) to 255 (opaque) - * @param includeChildren if do do the same for all descendants - */ - public void setAlpha(int alpha, boolean includeChildren){ - setAlpha(alpha); - if(includeChildren && children != null){ - for(GAbstractControl c : children) - c.setAlpha(alpha, true); - } - } - - /** - * Get the parent control. If null then this is a top-level component - */ - public GAbstractControl getParent() { - return parent; - } - - /** - * Get the PApplet that manages this component - */ - public PApplet getPApplet() { - return winApp; - } - - // Used by composite control i.e. ones that have scrollbars, buttons etc. but not - // GWindow and GPanel - protected PGraphics getBuffer(){ - return buffer; - } - - /** - * Support UTF8 encoding - * @param ascii UTF8 code - * @return true if the character can be displayed - */ - protected boolean isDisplayable(int ascii){ - return !(ascii < 32 || ascii == 127); - } - - /** - * This method should be used sparingly since it is heavy on resources. - * - * @return a PGraphics object showing current state of the control (ignoring rotation) - */ - public PGraphics getSnapshot(){ - if(buffer != null){ - updateBuffer(); - PGraphics snap = winApp.createGraphics(buffer.width, buffer.height, PApplet.JAVA2D); - snap.beginDraw(); - snap.image(buffer,0,0); - snap.endDraw(); - return snap; - } - return null; - } - - /** - * Save a snapshot of the control using class name and sketch runtime as the filename - * @return true if the snapshot was saved else return false - */ - public boolean saveSnapshot(){ - String filename = getClass().getSimpleName().toLowerCase() + "_" + System.currentTimeMillis() + ".png"; - return saveSnapshot(filename); - } - - /** - * Save a snapshot of the control using the specified filename - * @return true if the snapshot was saved else return false - */ - public boolean saveSnapshot(String filename){ - PGraphics snapshot = getSnapshot(); - if(snapshot != null){ - snapshot.save(filename); - return true; - } - return false; - } - - /* - * Empty method at the moment make abstract - * in final version - */ - protected void updateBuffer() {} - - - /** - * Attempt to create the default event handler for the component class. - * The default event handler is a method that returns void and has a single - * parameter of the same type as the component class generating the - * event and a method name specific for that class. - * - * @param handlerObj the object to handle the event - * @param methodName the method to execute in the object handler class - * @param param_classes the parameter classes. - * @param param_names that names of the parameters (used for error messages only) - */ - @SuppressWarnings("rawtypes") - protected void createEventHandler(Object handlerObj, String methodName, Class[] param_classes, String[] param_names){ - try{ - eventHandlerMethod = handlerObj.getClass().getMethod(methodName, param_classes ); - eventHandlerObject = handlerObj; - eventHandlerMethodName = methodName; - } catch (Exception e) { - GMessenger.message(MISSING, new Object[] {this, methodName, param_classes, param_names}); - eventHandlerObject = null; - } - } - - /** - * Attempt to create the default event handler for the component class. - * The default event handler is a method that returns void and has a single - * parameter of the same type as the component class generating the - * event and a method name specific for that class. - * - * @param obj the object to handle the event - * @param methodName the method to execute in the object handler class - */ - public void addEventHandler(Object obj, String methodName){ - try{ - eventHandlerObject = obj; - eventHandlerMethodName = methodName; - eventHandlerMethod = obj.getClass().getMethod(methodName, new Class[] {this.getClass(), GEvent.class } ); - } catch (Exception e) { - GMessenger.message(NONEXISTANT, new Object[] {this, methodName, new Class[] { this.getClass(), GEvent.class } } ); - eventHandlerObject = null; - eventHandlerMethodName = ""; - } - } - - /** - * Attempt to fire an event for this component. - * - * The method called must have a single parameter which is the object - * firing the event. - * If the method to be called is to have different parameters then it should - * be overridden in the child class - * The method - */ - protected void fireEvent(Object... objects){ - if(eventHandlerMethod != null){ - try { - eventHandlerMethod.invoke(eventHandlerObject, objects); - } catch (Exception e) { - GMessenger.message(EXCP_IN_HANDLER, - new Object[] {eventHandlerObject, eventHandlerMethodName, e } ); - } - } - } - - /** - * Set the rotation to apply when displaying this control. The center of - * rotation is determined by the control_mode attribute. - * - * @param angle clockwise angle in radians - */ - public void setRotation(float angle){ - setRotation(angle, G4P.control_mode); - } - - /** - * Set the rotation to apply when displaying this control. The center of - * rotation is determined by the mode parameter parameter. - * - * @param angle clockwise angle in radians - * @param mode PApplet.CORNER / CORNERS / CENTER - */ - public void setRotation(float angle, GControlMode mode){ - rotAngle = angle; - AffineTransform aff = new AffineTransform(); - aff.setToRotation(angle); - switch(mode){ - case CORNER: - case CORNERS: - // Rotate about top corner - temp[0] = halfWidth; - temp[1] = halfHeight; - aff.transform(temp, 0, temp, 0, 1); - cx = (float)temp[0] + x;// - halfWidth; - cy = (float)temp[1] + y;// - halfHeight; - break; - case CENTER: - default: - // Rotate about centre - temp[0] = -halfWidth; - temp[1] = -halfHeight; - aff.transform(temp, 0, temp, 0, 1); - x = cx + (float)temp[0]; - y = cy + (float)temp[1]; // should this be minus?? I don't think so - break; - } - } - - /** - * Move the control to the given position based on the mode.
- * - * The position is not constrained to the screen area.
- * - * The current control mode determines whether we move the - * corner or the center of the control to px,py
- * - * @param px the horizontal position to move to - * @param py the vertical position to move to - */ - public void moveTo(float px, float py){ - moveTo(px, py, G4P.control_mode); - } - - /** - * Move the control to the given position based on the mode.
- * - * Unlike when dragged the position is not constrained to the - * screen area.
- * - * The mode determines whether we move the corner or the center - * of the control to px,py
- * - * @param px the horizontal position to move to - * @param py the vertical position to move to - * @param mode the control mode - */ - public void moveTo(float px, float py, GControlMode mode){ - GAbstractControl p = parent; - if(p != null){ - px -= p.width/2.0f; - py -= p.height/2.0f; - } - switch(mode){ - case CORNER: - case CORNERS: - cx += (px - x); - cy += (py - y); - x = cx - width/2.0f; - y = cy - height/2.0f; - break; - case CENTER: - cx = px; - cy = py; - x = cx - width/2.0f; - y = cy - height/2.0f; - break; - } - } - - /** - * Get the left position of the control.
- * If the control is on a panel then the value returned is relative to the - * top-left corner of the panel otherwise it is relative to the sketch - * window display.
- * - */ - public float getX() { - if(parent != null) - return x + parent.width/2.0f; - else - return x; - } - - /** - * Get the top position of the control.
- * If the control is on a panel then the value returned is relative to the - * top-left corner of the panel otherwise it is relative to the sketch - * window display.
- * - */ - public float getY() { - if(parent != null) - return y + parent.height/2.0f; - else - return y; - } - - /** - * Get the centre x position of the control.
- * If the control is on a panel then the value returned is relative to the - * top-left corner of the panel otherwise it is relative to the sketch - * window display.
- */ - public float getCX() { - if(parent != null) - return x + (parent.width + width)/2.0f; - else - return cx; - } - - /** - * Get the centre y position of the control.
- * If the control is on a panel then the value returned is relative to the - * top-left corner of the panel otherwise it is relative to the sketch - * window display.
- * - */ - public float getCY() { - if(parent != null) - return x + (parent.width + width)/2.0f; - else - return cy; - } - - /** - * @return the width - */ - public float getWidth() { - return width; - } - - /** - * @return the height - */ - public float getHeight() { - return height; - } - - /** - * - * @param visible the visibility to set - */ - public void setVisible(boolean visible) { - // If we are making it invisible and it has focus give up the focus - if(!visible && focusIsWith == this) - loseFocus(null); - this.visible = visible; - // Only available if alpha level is high enough - if(visible) - available = (alphaLevel > ALPHA_BLOCK); - else - available = false; - // If this control has children than make them available if this control - // is visible and unavailable if invisible - if(children != null){ - for(GAbstractControl c : children) - c.setAvailable(this.visible); - } - } - - - /** - * @return the component's visibility - */ - public boolean isVisible() { - return visible; - } - - /** - * The availability flag is used by the library code to determine whether - * a control should be considered for drawing and mouse/key input.
- * It perits an internal control that does not affect the visible - * and enabled state of the control, which are set by the programmer. - * - * If a control and its children are made unavailable it will still be drawn - * but it not respond to user input. - * - * @param avail - */ - protected void setAvailable(boolean avail){ - available = avail; - if(children != null){ - for(GAbstractControl c : children) - c.setAvailable(avail); - } - } - - /** - * Is this control available? - */ - protected boolean isAvailable(){ - return available; - } - - /** - * Determines whether to show the back colour or not. - * Only applies to some components - * @param opaque - */ - public void setOpaque(boolean opaque){ - // Ensure that we dont't go from true >> false otherwise - // it will validate an invalid buffer - bufferInvalid |= (opaque != this.opaque); - this.opaque = opaque; - } - - /** - * Find out if the component is opaque - * @return true if the background is visible - */ - public boolean isOpaque(){ - return opaque; - } - - public boolean isDragging(){ - return dragging; - } - - /** - * Enable or disable the ability of the component to generate mouse events.
- * GTextField - it also controls key press events
- * GPanel - controls whether the panel can be moved/collapsed/expanded
- * @param enable true to enable else false - */ - public void setEnabled(boolean enable){ - enabled = enable; - if(children != null){ - for(GAbstractControl c : children) - c.setEnabled(enable); - } - } - - /** - * Is this component enabled - * @return true if the component is enabled - */ - public boolean isEnabled(){ - return enabled; - } - - /** - * Give the focus to this component but only after allowing the - * current component with focus to release it gracefully.
- * Always cancel the keyFocusIsWith irrespective of the component - * type. If the component needs to retain keyFocus then override this - * method in that class e.g. GCombo - */ - protected void takeFocus(){ - if(focusIsWith != null && focusIsWith != this) - focusIsWith.loseFocus(this); - focusIsWith = this; - } - - /** - * For most components there is nothing to do when they loose focus. - * Override this method in classes that need to do something when - * they loose focus eg TextField - */ - protected void loseFocus(GAbstractControl grabber){ - if(cursorIsOver == this) - cursorIsOver = null; - focusIsWith = grabber; - bufferInvalid = true; - } - - /** - * Determines whether this component is to have focus or not - * @param focus - */ - public void setFocus(boolean focus){ - if(focus) - takeFocus(); - else - loseFocus(null); - } - - /** - * Does this component have focus - * @return true if this component has focus else false - */ - public boolean hasFocus(){ - return (this == focusIsWith); - } - - /** - * Get the Z order value for the object with focus. - */ - protected static int focusObjectZ(){ - return (focusIsWith == null) ? -1 : focusIsWith.z; - } - - /** - * This will set the rotation of the control to angle overwriting - * any previous rotation set. Then it calculates the centre position - * so that the original top left corner of the control will be the - * position indicated by x,y with respect to the top left corner of - * parent.
- * - * The added control will have its position calculated relative to the - * centre of the parent control.
- * - * All overloaded methods call this one.
- * - * @param c the control to add. - * @param x the leftmost or centre position depending on controlMode - * @param y the topmost or centre position depending on controlMode - * @param angle the rotation angle (replaces any the angle specified in control) - */ - public void addControl(GAbstractControl c, float x, float y, float angle){ - // Ignore if children are not allowed. - if(children == null) return; - c.rotAngle = angle; - // In child control reset the control so it centred about the origin - AffineTransform aff = new AffineTransform(); - aff.setToRotation(angle); - /* - * The following code should result in the x,y and cx,cy coordinates of - * the added control (c) added being measured relative to the centre of - * this control. - */ - switch(G4P.control_mode){ - case CORNER: - case CORNERS: - // Rotate about top corner - c.x = x; c.y = y; - c.temp[0] = c.halfWidth; - c.temp[1] = c.halfHeight; - aff.transform(c.temp, 0, c.temp, 0, 1); - c.cx = (float)c.temp[0] + x - halfWidth; - c.cy = (float)c.temp[1] + y - halfHeight; - c.x = c.cx - c.halfWidth; - c.y = c.cy - c.halfHeight; - break; - case CENTER: - // Rotate about centre - c.cx = x; c.cy = y; - c.temp[0] = -c.halfWidth; - c.temp[1] = -c.halfHeight; - aff.transform(c.temp, 0, c.temp, 0, 1); - c.x = c.cx + (float)c.temp[0] - halfWidth; - c.y = c.cy - (float)c.temp[1] - halfHeight; - c.cx -= halfWidth; - c.cy -= halfHeight; - break; - } - c.rotAngle = angle; - // Add to parent - c.parent = this; - c.setZ(z); - // Parent will now be responsible for drawing - c.registeredMethods &= (ALL_METHOD - DRAW_METHOD); - if(children == null) - children = new LinkedList(); - children.addLast(c); - Collections.sort(children, new Z_Order()); - // Does the control being added have to do anything extra - c.addToParent(this); - } - - /** - * Add a control at the given position with zero rotation angle. - * - * @param c the control to add. - * @param x the leftmost or centre position depending on controlMode - * @param y the topmost or centre position depending on controlMode - */ - public void addControl(GAbstractControl c, float x, float y){ - // Ignore if children are not allowed. - if(children == null) return; - addControl(c, x, y, 0); - } - - /** - * Add a control at the position and rotation specified in the control. - * - * @param c the control to add - */ - public void addControl(GAbstractControl c){ - // Ignore if children are not allowed. - if(children == null) return; - switch(G4P.control_mode){ - case CORNER: - case CORNERS: - addControl(c, c.x, c.y, c.rotAngle); - break; - case CENTER: - addControl(c, c.cx, c.cy, c.rotAngle); - break; - } - } - - /** - * Add several control at the position and rotation specified in each control. - * - * @param controls comma separated list of controls - */ - public void addControls(GAbstractControl... controls){ - // Ignore if children are not allowed. - if(children == null) return; - for(GAbstractControl c : controls){ - switch(G4P.control_mode){ - case CORNER: - case CORNERS: - addControl(c, c.x, c.y, c.rotAngle); - break; - case CENTER: - addControl(c, c.cx, c.cy, c.rotAngle); - break; - } - } - } - - /** - * Changes that need to be made to child when added. - * Override where needed e.g. GPanel - * - * @param p the parent - */ - protected void addToParent(GAbstractControl p){ - } - - /** - * Get the shape type when the cursor is over a control - * @return shape type - */ - public int getCursorOver() { - return cursorOver; - } - - /** - * Set the shape type to use when the cursor is over a control - * @param cursorOver the shape type to use - */ - public void setCursorOver(int cursorOver) { - this.cursorOver = cursorOver; - } - - /** - * Get an affine transformation that is the compound of all - * transformations including parents - * @param aff - */ - protected AffineTransform getTransform(AffineTransform aff){ - if(parent != null) - aff = parent.getTransform(aff); - aff.translate(cx, cy); - aff.rotate(rotAngle); - return aff; - } - - /** - * This method takes a position px, py and calculates the equivalent - * position [ox,oy] as if no transformations have taken place and - * the origin is the top-left corner of the control. - * @param px - * @param py - */ - protected void calcTransformedOrigin(float px, float py){ - AffineTransform aff = new AffineTransform(); - aff = getTransform(aff); - temp[0] = px; temp[1] = py; - try { - aff.inverseTransform(temp, 0, temp, 0, 1); - ox = (float) temp[0] + halfWidth; - oy = (float) temp[1] + halfHeight; - } catch (NoninvertibleTransformException e) { - } - } - - - /** - * Recursive function to set the priority of a component. This - * is used to determine who gets focus when components overlap - * on the screen e.g. when a combobo expands it might cover a button.
- * It is used where components have childen e.g. GCombo and - * GPaneln - * It is used when a child component is added. - * @param component - * @param parentZ - */ - protected void setZ(int parentZ){ - z += parentZ; - if(children != null){ - for(GAbstractControl c : children){ - c.setZ(parentZ); - } - } - } - - /** - * If the control is permanently no longer required then call - * this method to remove it and free up resources.
- * The variable identifier used to create this control should - * be set to null.
- * For example if you want to dispose of a button called - *
btnDoThis
then to remove the button use the - * statements
-	 * btnDoThis.dispose(); 
- * btnDoThis = null;
- */ - public void markForDisposal(){ - G4P.removeControl(this); - } - - - public String toString(){ - if(tag == null) - return this.getClass().getSimpleName(); - else - return tag; - } - - /** - * Comparator used for controlling the order components are drawn - * @author Peter Lager - */ - public static class Z_Order implements Comparator { - - public int compare(GAbstractControl c1, GAbstractControl c2) { - if(c1.z != c2.z) - return new Integer(c1.z).compareTo( new Integer(c2.z)); - else - return new Integer((int) -c1.y).compareTo(new Integer((int) -c2.y)); - } - - } // end of comparator class - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GAlign.java b/Processing/libraries/G4P/src/g4p_controls/GAlign.java deleted file mode 100644 index 9a36ce7..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GAlign.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2008-12 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -/** - * This class provides an enumeration that is used to control the alignment - * of text and images. - * - * @author Peter Lager - * - */ -public enum GAlign { - - INVALID ( -1, "INVALID", "Invalid alignment" ), - - // Horizontal alignment constants - LEFT ( 0, "LEFT", "Align left" ), - CENTER ( 1, "CENTER", "Align centre horizontally" ), - RIGHT ( 2, "RIGHT", "Align right" ), - JUSTIFY ( 3, "JUSTIFY", "Justify text" ), - - // Vertical alignment constants - TOP ( 16, "TOP", "Align top" ), - MIDDLE ( 17, "MIDDLE", "Align middle vertically" ), - BOTTOM ( 18, "BOTTOM", "Align bottom" ); - - - /** - * Get an alignment based on its ID number. - * - * @param id the id number for this alignment. - * @return the alignment or INVALID if not found - */ - public static GAlign getFromID(int id){ - switch(id){ - case 0: - return LEFT; - case 1: - return CENTER; - case 2: - return RIGHT; - case 3: - return JUSTIFY; - case 16: - return TOP; - case 17: - return MIDDLE; - case 18: - return BOTTOM; - } - return INVALID; - } - - /** - * Get an alignment based on its alignment text. - * - * @param text the alignment text. - * @return the alignment or INVALID if not found - */ - public static GAlign getFromText(String text){ - text = text.toUpperCase(); - if(text.equals("LEFT")) - return LEFT; - if(text.equals("CENTER")) - return CENTER; - if(text.equals("RIGHT")) - return RIGHT; - if(text.equals("JUSTIFY")) - return JUSTIFY; - if(text.equals("TOP")) - return TOP; - if(text.equals("MIDDLE")) - return MIDDLE; - if(text.equals("BOTTOM")) - return BOTTOM; - return INVALID; - } - - private int alignID; - private String alignText; - private String description; - - /** - * A private constructor to prevent alignments being create outside this class. - * - * @param id - * @param text - * @param desc - */ - private GAlign(int id, String text, String desc ){ - alignID = id; - alignText = text; - description = desc; - } - - /** - * Get the id number associated with this alignment - * @return the ID associated with this alignment - */ - public int getID(){ - return alignID; - } - - /** - * Get the text ID associated with this alignment. - * - * @return alignment text e.g. "RIGHT" - */ - public String getTextID(){ - return alignText; - } - - /** - * Get the description of this alignment - * - * @return e.g. "Align top" - */ - public String getDesc(){ - return description; - } - - /** - * Is this a horizontal alignment constant? - */ - public boolean isHorzAlign(){ - return alignID >= 0 && alignID <= 8; - } - - /** - * Is this a vertical alignment constant? - */ - public boolean isVertAlign(){ - return alignID >= 16; - } - - /** - * Get the alignment text. - */ - public String toString(){ - return alignText; - } -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GButton.java b/Processing/libraries/G4P/src/g4p_controls/GButton.java deleted file mode 100644 index 148dfd5..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GButton.java +++ /dev/null @@ -1,301 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2008 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import g4p_controls.HotSpot.HSmask; -import g4p_controls.StyledString.TextLayoutInfo; - -import java.awt.Graphics2D; -import java.awt.font.TextLayout; -import java.util.LinkedList; - -import processing.core.PApplet; -import processing.core.PGraphics; -import processing.event.MouseEvent; - -/** - * This class is the Button component. - * - * The button face can have either text or an image or both just - * pick the right constructor. - * - * Three types of event can be generated :-
- * PRESSED RELEASED CLICKED
- * - * To simplify event handling the button only fires off CLICKED events - * if the mouse button is pressed and released over the button face - * (the default behaviour).
- * - * Using
button1.fireAllEvents(true);
enables the other 2 events - * for button button1. A PRESSED event is created if the mouse button - * is pressed down over the button face, the CLICKED event is then generated - * if the mouse button is released over the button face. Releasing the - * button off the button face creates a RELEASED event.
- * - * The image file can either be a single image which is used for - * all button states, or be a composite of 3 images (tiled horizontally) - * which are used for the different button states OFF, OVER and DOWN - * in which case the image width should be divisible by 3.
- * A number of setImages(...) methods exist to set button state images, these - * can be used once the button is created.
- * - * - * @author Peter Lager - * - */ -public class GButton extends GTextIconAlignBase { - - private static boolean roundCorners = true; - private static float CORNER_RADIUS = 6; - - public static void useRoundCorners(boolean useRoundCorners){ - roundCorners = useRoundCorners; - } - - // Mouse over status - protected int status = 0; - - // Only report CLICKED events - protected boolean reportAllButtonEvents = false; - - public GButton(PApplet theApplet, float p0, float p1, float p2, float p3) { - this(theApplet, p0, p1, p2, p3, ""); - } - - public GButton(PApplet theApplet, float p0, float p1, float p2, float p3, String text) { - super(theApplet, p0, p1, p2, p3); - PGraphics mask = winApp.createGraphics((int) width, (int) height, JAVA2D); - mask.beginDraw(); - mask.background(255); - mask.fill(0); - mask.stroke(0); - mask.strokeWeight(1); - if(roundCorners) - mask.rect(0, 0, width-2, height-2, CORNER_RADIUS); - else - mask.rect(0, 0, width-2, height-2); - mask.endDraw(); - - hotspots = new HotSpot[]{ - new HSmask(1, mask) // control surface - }; - - setText(text); - z = Z_SLIPPY; - // Now register control with applet - createEventHandler(G4P.sketchWindow, "handleButtonEvents", - new Class[]{ GButton.class, GEvent.class }, - new String[]{ "button", "event" } - ); - registeredMethods = DRAW_METHOD | MOUSE_METHOD; - cursorOver = HAND; - // Must register control - G4P.registerControl(this); - } - - /** - * If the parameter is true all 3 event types are generated, if false - * only CLICKED events are generated (default behaviour). - * @param all - */ - public void fireAllEvents(boolean all){ - reportAllButtonEvents = all; - } - - /** - * Enable or disable the ability of the component to generate mouse events.
- * If the control is to be disabled when it is clicked then this will force the - * mouse off button image is used. - * @param enable true to enable else false - */ - public void setEnabled(boolean enable){ - super.setEnabled(enable); - if(!enable) - status = OFF_CONTROL; - } - - /** - * - * When a mouse button is clicked on a GButton it generates the GEvent.CLICKED event. If - * you also want the button to generate GEvent.PRESSED and GEvent.RELEASED events - * then you need the following statement.
- *
btnName.fireAllEvents(true); 

- * - *
-	 * void handleButtonEvents(void handleButtonEvents(GButton button, GEvent event) {
-	 *	  if(button == btnName && event == GEvent.CLICKED){
-	 *        // code for button click event
-	 *    }
-	 * 

- * Where
btnName
is the GButton identifier (variable name)

- * - */ - public void mouseEvent(MouseEvent event){ - if(!visible || !enabled || !available) return; - - calcTransformedOrigin(winApp.mouseX, winApp.mouseY); - currSpot = whichHotSpot(ox, oy); - - if(currSpot >= 0 || focusIsWith == this) - cursorIsOver = this; - else if(cursorIsOver == this) - cursorIsOver = null; - - switch(event.getAction()){ - case MouseEvent.PRESS: - if(focusIsWith != this && currSpot >= 0 && z > focusObjectZ()){ - dragging = false; - status = PRESS_CONTROL; - takeFocus(); - if(reportAllButtonEvents) - fireEvent(this, GEvent.PRESSED); - bufferInvalid = true; - } - break; - case MouseEvent.CLICK: - // No need to test for isOver() since if the component has focus - // and the mouse has not moved since MOUSE_PRESSED otherwise we - // would not get the Java MouseEvent.MOUSE_CLICKED event - if(focusIsWith == this){ - status = OFF_CONTROL; - bufferInvalid = true; - loseFocus(null); - dragging = false; - fireEvent(this, GEvent.CLICKED); - } - break; - case MouseEvent.RELEASE: - // if the mouse has moved then release focus otherwise - // MOUSE_CLICKED will handle it - if(focusIsWith == this && dragging){ - if(reportAllButtonEvents) - fireEvent(this, GEvent.RELEASED); - dragging = false; - loseFocus(null); - status = OFF_CONTROL; - bufferInvalid = true; - } - break; - case MouseEvent.MOVE: - int currStatus = status; - // If dragged state will stay as PRESSED - if(currSpot >= 0) - status = OVER_CONTROL; - else - status = OFF_CONTROL; - if(currStatus != status) - bufferInvalid = true; - break; - case MouseEvent.DRAG: - dragging = (focusIsWith == this); - break; - } - } - - public void draw(){ - if(!visible) return; - - // Update buffer if invalid - updateBuffer(); - winApp.pushStyle(); - - winApp.pushMatrix(); - // Perform the rotation - winApp.translate(cx, cy); - winApp.rotate(rotAngle); - // Move matrix to line up with top-left corner - winApp.translate(-halfWidth, -halfHeight); - // Draw buffer - winApp.imageMode(PApplet.CORNER); - if(alphaLevel < 255) - winApp.tint(TINT_FOR_ALPHA, alphaLevel); - winApp.image(buffer, 0, 0); - winApp.popMatrix(); - winApp.popStyle(); - } - - protected void updateBuffer(){ - if(bufferInvalid) { - bufferInvalid = false; - buffer.beginDraw(); - // Set the font and read the latest test - Graphics2D g2d = (Graphics2D) buffer.g2; - g2d.setFont(localFont); - LinkedList lines = stext.getLines(g2d); - // Draw the button head - buffer.clear(); - buffer.stroke(palette[3].getRGB()); - buffer.strokeWeight(1); - switch(status){ - case OVER_CONTROL: - buffer.fill(palette[6].getRGB()); - break; - case PRESS_CONTROL: - buffer.fill(palette[14].getRGB()); - break; - default: - buffer.fill(palette[4].getRGB()); - } - if(roundCorners) - buffer.rect(0, 0, width-2, height-2, CORNER_RADIUS); - else - buffer.rect(0, 0, width-2, height-2); - - // Calculate text and icon placement - calcAlignment(); - // If there is an icon draw it - if(iconW != 0) - buffer.image(bicon[status], siX, siY); - float wrapWidth = stext.getWrapWidth(); - float sx = 0, tw = 0; - buffer.translate(stX, stY); - for(TextLayoutInfo lineInfo : lines){ - TextLayout layout = lineInfo.layout; - buffer.translate(0, layout.getAscent()); - //System.out.println(layout.toString()); - switch(textAlignH){ - case CENTER: - tw = layout.getVisibleAdvance(); - tw = (tw > wrapWidth) ? tw - wrapWidth : tw; - sx = (wrapWidth - tw)/2; - break; - case RIGHT: - tw = layout.getVisibleAdvance(); - tw = (tw > wrapWidth) ? tw - wrapWidth : tw; - sx = wrapWidth - tw; - break; - case LEFT: - case JUSTIFY: - default: - sx = 0; - } - // display text - g2d.setColor(palette[2]); - layout.draw(g2d, sx, 0); - buffer.translate(0, layout.getDescent() + layout.getLeading()); - } - buffer.endDraw(); - } - } -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GCScheme.java b/Processing/libraries/G4P/src/g4p_controls/GCScheme.java deleted file mode 100644 index e8f151b..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GCScheme.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import java.awt.Color; -import java.io.IOException; -import java.io.InputStream; - -import processing.core.PApplet; -import processing.core.PConstants; -import processing.core.PGraphics; -import processing.core.PImage; - -/** - * Defines a number of color schemes for the GUI components.
- * G4P supports 16 colour schemes and each scheme has a palette of 16 colours.
- * - * When G4P is used it loads an image file with all the colors used by the various colour schemes.
- * First it will search for a file containing a user defined scheme (user_gui_palette.png) and - * if it can't find it, will use the library default scheme (default_gui_palette.png). - * - * @author Peter Lager - * - */ -public class GCScheme implements GConstants, PConstants { - - private static Color[][] palettes = null; - - /** - * Set the color scheme to one of the preset schemes - * BLUE / GREEN / RED / PURPLE / YELLOW / CYAN / BROWN - * or if you have created your own schemes following the instructions - * at gui4processing.lagers.org.uk/colorscheme.html then you can enter - * the appropriate numeric value of the scheme. - * - * @param schemeNbr scheme number (0-15) - * @return the color scheme based on the scheme number - */ - public static int[] getPalette(int schemeNbr){ - schemeNbr = Math.abs(schemeNbr) % 16; - Color[] colScheme = palettes[schemeNbr]; - int[] colSchemeI = new int[16]; - for(int i = 0; i < 16; i++) - colSchemeI[i] = colScheme[i].getRGB(); - return colSchemeI; - } - - /** - * Change a colour scheme to use the colours passed in the third parameter.
- * Colour scheme numbers 0-7 inclusive are the default colour schemes and - * schemes 8-15 inclusive are undefined by G4P.
- * This method will override the previous scheme and will affect all controls - * using the scheme. - * - * @param schemeNbr the scheme number - * @param colors the colours to use in this palette. - */ - public static void changePalette(int schemeNbr, int[] colors){ - schemeNbr = Math.abs(schemeNbr) % 16; - for(int i = 0; i < Math.min(16, colors.length); i++) - palettes[schemeNbr][i] = new Color(colors[i], true); // keep alpha - G4P.invalidateBuffers(); - } - - /** - * Copies the colours from the source scheme to the destination scheme. - * - * @param srcSchemeNbr source scheme number (0-15) - * @param dstSchemeNbr destination scheme number (0-15) - */ - public static void copyPalette(int srcSchemeNbr, int dstSchemeNbr){ - srcSchemeNbr = Math.abs(srcSchemeNbr) % 16; - dstSchemeNbr = Math.abs(dstSchemeNbr) % 16; - if(srcSchemeNbr != dstSchemeNbr){ - int[] palette = getPalette(srcSchemeNbr); - changePalette(dstSchemeNbr, palette); - } - } - - /** - * Change a single colour within an existing scheme - * - * @param schemeNbr the scheme number - * @param colorNbr the palette index number for the colour - * @param color ARGB colour value - */ - public static void changePaletteColor(int schemeNbr, int colorNbr, int color){ - schemeNbr = Math.abs(schemeNbr) % 16; - colorNbr = Math.abs(colorNbr) % 16; - palettes[schemeNbr][colorNbr] = new Color(color, true); // keep alpha - G4P.invalidateBuffers(); - } - - /** - * Save the current colour schemes as an image in the sketch's data folder. The file will be - * called
"user_gui_palette.png"
- * - * @param app the PApplet object - */ - public static void savePalettes(PApplet app){ - savePalettes(app, "user_gui_palette.png"); - } - - /** - * Save the current colour schemes as an image in the sketch's data folder. - * - * @param app the PApplet object - * @param filename the name of the image file to use - */ - public static void savePalettes(PApplet app, String filename){ - PGraphics pg = app.createGraphics(256, 256, JAVA2D); - pg.beginDraw(); - pg.clear(); - pg.noStroke(); - for(int scheme = 0; scheme < 16; scheme++){ - for(int idx = 0; idx < 16; idx++){ - pg.fill(palettes[scheme][idx].getRGB()); - pg.rect(idx * 16, scheme * 16, 16,16); - } - } - pg.noFill(); - pg.strokeWeight(2); - pg.stroke(0); - for(int i = 0; i <= 16; i++){ - int m = i * 16; - pg.line(0, m, 256, m); - pg.line(m, 0, m, 256); - } - pg.endDraw(); - filename = app.dataPath("") + "/" + filename; - System.out.println(filename); - pg.save(filename); - } - - - /** - * Called every time we create a control. The palettes will be made when - * the first control is created. - * - * This method is called by - * @param app the PApplet using this scheme - */ - public static void makeColorSchemes(PApplet app) { - // If the palettes have not been created then create them - // otherwise do nothing - if(palettes != null) - return; - // Load the image - PImage image = null;; - InputStream is = app.createInput("user_gui_palette.png"); - if(is != null){ - try { - is.close(); - } catch (IOException e) { - e.printStackTrace(); - } - image = app.loadImage("user_gui_palette.png"); - GMessenger.message(USER_COL_SCHEME, null); - } - else { - // User image not provided - image = app.loadImage("default_gui_palette.png"); - // Added to 3.4 to hopefully fix problem with OpenProcessing - if(image == null) - image = new PImage((new javax.swing.ImageIcon(new GCScheme().getClass().getResource("/data/default_gui_palette.png"))).getImage()); - } - // Now make the palette - palettes = new Color[16][16]; - for(int p = 0; p < 16; p++) - for(int c = 0; c < 16; c++){ - int col = image.get(c * 16 + 8, p * 16 + 8); - palettes[p][c] = new Color((col >> 16) & 0xff, (col >> 8) & 0xff, col & 0xff); - } - } - - /* - * The following methods are ONLY called by GUI Builder do not change their names. - */ - - /** - * DO NOT CALL THIS METHOD
- * - * This method is only to be used by GUI Builder. - */ - public static Color[] getJavaColor(int schemeNo){ - schemeNo = Math.abs(schemeNo) % 16; - return palettes[schemeNo]; - } - - - /** - * DO NOT CALL THIS METHOD
- * - * This method is only to be used by GUI Builder. - */ - public static void makeColorSchemes() { - // If the palettes have not been created then create them - // otherwise do nothing - if(palettes != null) - return; - // Load the image - PImage image = new PImage((new javax.swing.ImageIcon(new GCScheme().getClass().getResource("/data/default_gui_palette.png"))).getImage()); - // Now make the palette - palettes = new Color[16][16]; - for(int p = 0; p < 16; p++) - for(int c = 0; c < 16; c++){ - int col = image.get(c * 16 + 8, p * 16 + 8); - palettes[p][c] = new Color((col >> 16) & 0xff, (col >> 8) & 0xff, col & 0xff); - } - } - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GCheckbox.java b/Processing/libraries/G4P/src/g4p_controls/GCheckbox.java deleted file mode 100644 index 45c5f1c..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GCheckbox.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2008 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import processing.core.PApplet; - -/** - * A two-state toggle control.
- * - * GCheckbox objects (also known as tick boxes) are two-state toggle switches that are - * used independently of other tick boxes. - * - * @author Peter Lager - * - */ -public class GCheckbox extends GToggleControl { - - /** - * Create an option button without text. - * - * @param theApplet that will display the control - * @param p0 - * @param p1 - * @param p2 - * @param p3 - */ - public GCheckbox(PApplet theApplet, float p0, float p1, float p2, float p3) { - this(theApplet, p0, p1, p2, p3, ""); - } - - /** - * Create an option button with text. - * - * @param theApplet that will display the control - * @param p0 - * @param p1 - * @param p2 - * @param p3 - * @param text text to be displayed - */ - public GCheckbox(PApplet theApplet, float p0, float p1, float p2, float p3, String text) { - super(theApplet, p0, p1, p2, p3); - opaque = false; - setText(text); - setIcon("tick.png", 2, GAlign.LEFT, null); - setTextAlign(GAlign.LEFT, null); - z = Z_SLIPPY; - // Now register control with applet - createEventHandler(G4P.sketchWindow, "handleToggleControlEvents", - new Class[]{ GToggleControl.class, GEvent.class }, - new String[]{ "checkbox", "event" } - ); - registeredMethods = DRAW_METHOD | MOUSE_METHOD; - cursorOver = HAND; - G4P.registerControl(this); - } - - /** - * This enforces independent action because this control cannot be added - * to a toggle group - */ - @Override - protected void setToggleGroup(GToggleGroup tg) {} - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GClip.java b/Processing/libraries/G4P/src/g4p_controls/GClip.java deleted file mode 100644 index f5174d9..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GClip.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2008 Peter Lager - - The actual code to create the clipbaord, copy and paste were - taken taken from a similar GUI library Interfascia ALPHA 002 -- - http://superstable.net/interfascia/ produced by Brenden Berg - The main change is to provide static copy and paste methods to - separate the clipboard logic from the component logic and provide - global access. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import java.awt.Toolkit; -import java.awt.datatransfer.Clipboard; -import java.awt.datatransfer.ClipboardOwner; -import java.awt.datatransfer.DataFlavor; -import java.awt.datatransfer.StringSelection; -import java.awt.datatransfer.Transferable; - -/* - * I wanted to implement copying and pasting to the clipboard using static - * methods to simplify the sharing of a single clipboard over all classes. - * The need to implement the ClipboardOwner interface requires an object so - * this class creates an object the first time an attempt to copy or paste - * is used. - * - * All methods are private except copy() and paste() - lostOwnership() - * has to be public because of the Clipboard owner interface. - * - * @author Peter Lager - * - */ - -/** - * Clipboard functionaliy for plain text
- * - * This provides clipboard functionality for text and is currently only used by the - * GTextField and GTextArea classes. - * - * @author Peter Lager - * - */ -public class GClip implements ClipboardOwner { - - /** - * Static reference to enforce singleton pattern - */ - private static GClip gclip = null; - - /** - * Class attribute to reference the programs clipboard - */ - private Clipboard clipboard = null; - - - /** - * Copy a string to the clipboard - * @param chars - */ - public static boolean copy(String chars){ - if(gclip == null) - gclip = new GClip(); - return gclip.copyString(chars); - } - - /** - * Get a string from the clipboard - * @return the string on the clipboard - */ - public static String paste(){ - if(gclip == null) - gclip = new GClip(); - return gclip.pasteString(); - } - - /** - * Ctor is private so clipboard is only created when a copy or paste is - * attempted and one does not exist already. - */ - private GClip(){ - if(clipboard == null){ - makeClipboardObject(); - } - } - - /** - * If security permits use the system clipboard otherwise create - * our own application clipboard. - */ - private void makeClipboardObject(){ - SecurityManager security = System.getSecurityManager(); - if (security != null) { - try { - security.checkSystemClipboardAccess(); - clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); - } catch (SecurityException e) { - clipboard = new Clipboard("Application Clipboard"); - } - } else { - try { - clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); - } catch (Exception e) { - // THIS IS DUMB - true but is there another way - I think not - } - } - } - - /** - * Copy a string to the clipboard. If the Clipboard has not been created - * then create it. - * @return true for a successful copy to clipboard - */ - private boolean copyString(String chars){ - if(clipboard == null) - makeClipboardObject(); - if(clipboard != null){ - StringSelection fieldContent = new StringSelection (chars); - clipboard.setContents (fieldContent, this); - return true; - } - return false; - } - - /** - * Gets a string from the clipboard. If there is no Clipboard - * then create it. - * @return if possible the string on the clipboard else an empty string - */ - private String pasteString(){ - // If there is no clipboard then there is nothing to paste - if(clipboard == null){ - makeClipboardObject(); - return ""; - } - // We have a clipboard so get the string if we can - Transferable clipboardContent = clipboard.getContents(this); - - if ((clipboardContent != null) && - (clipboardContent.isDataFlavorSupported(DataFlavor.stringFlavor))) { - try { - String tempString; - tempString = (String) clipboardContent.getTransferData(DataFlavor.stringFlavor); - return tempString; - } - catch (Exception e) { - e.printStackTrace (); - } - } - return ""; - } - - /** - * Reqd by ClipboardOwner interface - */ - public void lostOwnership(Clipboard clipboard, Transferable contents) { - } - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GConstants.java b/Processing/libraries/G4P/src/g4p_controls/GConstants.java deleted file mode 100644 index 5953582..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GConstants.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - Part of the GUI for Processing library - http://www.lagers.org.uk/g4p/index.html - http://gui4processing.googlecode.com/svn/trunk/ - - Copyright (c) 2008-09 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import java.awt.font.TextAttribute; - -import javax.swing.JOptionPane; - -/** - * - * These constants can all be available to the Processor. - * - * @author Peter Lager - * - */ -public interface GConstants { - - int RED_SCHEME = 0; - int GREEN_SCHEME = 1; - int YELLOW_SCHEME = 2; - int PURPLE_SCHEME = 3; - int ORANGE_SCHEME = 4; - int CYAN_SCHEME = 5; - int BLUE_SCHEME = 6; - int GOLD_SCHEME = 7; - int SCHEME_8 = 8; - int SCHEME_9 = 9; - int SCHEME_10 = 10; - int SCHEME_11 = 11; - int SCHEME_12 = 12; - int SCHEME_13 = 13; - int SCHEME_14 = 14; - int SCHEME_15 = 15; - - // Keyboard values not covered by Processing - char HOME = java.awt.event.KeyEvent.VK_HOME; - char END = java.awt.event.KeyEvent.VK_END; - - - // Configuration constants - // GRoundControl - int CTRL_ANGULAR = 0x00000501; - int CTRL_HORIZONTAL = 0x00000502; - int CTRL_VERTICAL = 0x00000503; - - // GWindow - int EXIT_APP = 0x00000f01; - int CLOSE_WINDOW = 0x00000f02; - int KEEP_OPEN = 0x00000f03; - - // ### GUI build constants ### - int USER_COL_SCHEME = 0x00010102; - - // The min alpha level for a control to respond to mouse and keyboard - int ALPHA_BLOCK = 128; - // The min alpha before a pixel is considered for a hot spot - int ALPHA_PICK = 48; - - // ### Scroll bar policy constants ### - /** Do not create or display any scrollbars for the text control. */ - int SCROLLBARS_NONE = 0x0000; - /** Create and display vertical scrollbar only. */ - int SCROLLBARS_VERTICAL_ONLY = 0x0001; - /** Create and display horizontal scrollbar only. */ - int SCROLLBARS_HORIZONTAL_ONLY = 0x0002; - /** Create and display both vertical and horizontal scrollbars. */ - int SCROLLBARS_BOTH = 0x0003; - /** whether to hide when not required */ - int SCROLLBARS_AUTOHIDE = 0x1000; - - // Slider / numeric display types - int INTEGER = 0; - int DECIMAL = 1; - int EXPONENT = 2; - - // Text orientation for sliders - int ORIENT_LEFT = -1; - int ORIENT_TRACK = 0; - int ORIENT_RIGHT = 1; - - // Mouse wheel direction constants. FORWARD is default - // Do not change these values as they are used directly - int FORWARD = 1; // Default value - int REVERSE = -1; - - // Stick mode - int X4 = 1; - int X8 = 2; - - // Modal dialog messages - // Message types - int PLAIN = JOptionPane.PLAIN_MESSAGE; - int ERROR = JOptionPane.ERROR_MESSAGE; - int INFO = JOptionPane.INFORMATION_MESSAGE; - int WARNING = JOptionPane.WARNING_MESSAGE; - int QUERY = JOptionPane.QUESTION_MESSAGE; - - // Option types - int YES_NO = JOptionPane.YES_NO_OPTION; - int YES_NO_CANCEL = JOptionPane.YES_NO_CANCEL_OPTION; - int OK_CANCEL = JOptionPane.OK_CANCEL_OPTION; - - // Replies to option types - int OK = JOptionPane.OK_OPTION; - int YES = JOptionPane.YES_OPTION; // Has same int value as OK - int NO = JOptionPane.NO_OPTION; - int CANCEL = JOptionPane.CANCEL_OPTION; - int CLOSED = JOptionPane.CLOSED_OPTION; - - // Attribute:- fontface Value Type:- String font family name e.g. "Times New Roman" - TextAttribute FAMILY = TextAttribute.FAMILY; - - // Attribute:- font weight Value Type:- Float in range (0.5 to 2.75) - TextAttribute WEIGHT = TextAttribute.WEIGHT; - // Predefined constants for font weight - Float WEIGHT_EXTRA_LIGHT = new Float(0.5f); - Float WEIGHT_LIGHT = new Float(0.75f); - Float WEIGHT_DEMILIGHT = new Float(0.875f); - Float WEIGHT_REGULAR = new Float(1.0f); - Float WEIGHT_SEMIBOLD = new Float(1.25f); - Float WEIGHT_MEDIUM = new Float(1.5f); - Float WEIGHT_DEMIBOLD = new Float(1.75f); - Float WEIGHT_BOLD = new Float(2.0f); - Float WEIGHT_HEAVY = new Float(2.25f); - Float WEIGHT_EXTRABOLD = new Float(2.5f); - Float WEIGHT_ULTRABOLD = new Float(2.75f); - - // Attribute:- font width Value Type:- Float in range (0.75 to 1.5) - TextAttribute WIDTH = TextAttribute.WIDTH; - // Predefined constants for font width - Float WIDTH_CONDENSED = new Float(0.75f); - Float WIDTH_SEMI_CONDENSED = new Float(0.875f); - Float WIDTH_REGULAR = new Float(1.0f); - Float WIDTH_SEMI_EXTENDED = new Float(1.25f); - Float WIDTH_EXTENDED = new Float(1.5f); - - // Attribute:- font posture Value Type:- Float in range (0.0 to 0.20) - TextAttribute POSTURE = TextAttribute.POSTURE; - // Predefined constants for font posture (plain or italic) - Float POSTURE_REGULAR = new Float(0.0f); - Float POSTURE_OBLIQUE = new Float(0.20f); - - // Attribute:- font size Value Type:- Float - TextAttribute SIZE = TextAttribute.SIZE; - - // Attribute:- font superscript Value Type:- Integer (1 : super or -1 subscript) - TextAttribute SUPERSCRIPT = TextAttribute.SUPERSCRIPT; - // Predefined constants for font super/subscript - Integer SUPERSCRIPT_SUPER = new Integer(1); - Integer SUPERSCRIPT_SUB = new Integer(-1); - Integer SUPERSCRIPT_OFF = new Integer(0); - - // Attribute:- font foreground snd bsckground colour Value Type:- Color - TextAttribute FOREGROUND = TextAttribute.FOREGROUND; - TextAttribute BACKGROUND = TextAttribute.BACKGROUND; - - // Attribute:- font strike through Value:- Boolean - TextAttribute STRIKETHROUGH = TextAttribute.STRIKETHROUGH; - // Predefined constants for font strike through on/off - Boolean STRIKETHROUGH_ON = new Boolean(true); - Boolean STRIKETHROUGH_OFF = new Boolean(false); - - // TextAttribute JUSTIFICATION = TextAttribute.JUSTIFICATION; - // Float JUSTIFICATION_FULL = new Float(1.0f); - // Float JUSTIFICATION_NONE = new Float(0.0f); - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GConstantsInternal.java b/Processing/libraries/G4P/src/g4p_controls/GConstantsInternal.java deleted file mode 100644 index 6e2fb91..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GConstantsInternal.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - Part of the GUI for Processing library - http://www.lagers.org.uk/g4p/index.html - http://gui4processing.googlecode.com/svn/trunk/ - - Copyright (c) 2008-12 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import java.awt.BasicStroke; - -/** - * Constants that are used internally by the library. - * - * @author Peter Lager - * - */ -interface GConstantsInternal { - - // Constants for GCustomSlider styles - String SLIDER_STYLES = "|grey_blue|blue18px|green_red20px|purple18px|red_yellow18px|"; - String DEFAULT_SLIDER_STYLE = "grey_blue"; - - // Constants for the control methods - int DRAW_METHOD = 0x00000001; - int MOUSE_METHOD = 0x00000002; - int PRE_METHOD = 0x00000004; - int KEY_METHOD = 0x00000008; - int POST_METHOD = 0x00000010; - int ALL_METHOD = 0x0000001f; - int GROUP_CONTROL_METHOD = DRAW_METHOD | MOUSE_METHOD | KEY_METHOD; - - // Event method handler errors - int MISSING = 0xff000001; // Can't find standard handler - int NONEXISTANT = 0xff000002; - int INVALID_TYPE = 0xff000003; - int INVALID_PAPPLET = 0xff000004; - int EXCP_IN_HANDLER = 0xff000005; // Exception in event handler - - // Button/slider status values - int OFF_CONTROL = 0; - int OVER_CONTROL = 1; - int PRESS_CONTROL = 2; - int DRAG_CONTROL = 3; - - // The tint color used when controls are drawn with transparency - int TINT_FOR_ALPHA = 255; - - // Constants for merging attribute runs - int I_NONE = 0; - int I_TL = 1; - int I_TR = 2; - int I_CL = 4; - int I_CR = 8; - int I_INSIDE = 16; - int I_COVERED = 32; - int I_MODES = 63; - - // Merger action - int MERGE_RUNS = 256; - int CLIP_RUN = 512; - int COMBI_MODES = 768; - - // merger decision grid - int[][] grid = new int[][] { - { I_NONE, I_TL, I_CL, I_COVERED, I_COVERED }, - { I_NONE, I_NONE, I_INSIDE, I_INSIDE, I_COVERED }, - { I_NONE, I_NONE, I_INSIDE, I_INSIDE, I_CR }, - { I_NONE, I_NONE, I_NONE, I_NONE, I_TR }, - { I_NONE, I_NONE, I_NONE, I_NONE, I_NONE } - }; - - // Basic strokes needed when using the Graphics2D object for drawing on the buffer - BasicStroke pen_1_0 = new BasicStroke(1, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND); - BasicStroke pen_2_0 = new BasicStroke(2, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND); - BasicStroke pen_3_0 = new BasicStroke(3, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND); - BasicStroke pen_4_0 = new BasicStroke(4, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND); - - // Padding for text controls - int TPAD2 = 2; - int TPAD6 = 6; - - int TPAD4 = 4; - int TPAD8 = 8; - - // ### Scroll bar type constants ### - int SCROLLBAR_VERTICAL = GConstants.SCROLLBARS_VERTICAL_ONLY; // 1 - int SCROLLBAR_HORIZONTAL = GConstants.SCROLLBARS_HORIZONTAL_ONLY; // 2 - - float HORZ_SCROLL_RATE = 4; - float VERT_SCROLL_RATE = 8; - - float WHEEL_DELTA = 0.01f; - float WHEEL_STICK_FACTOR = 0.51f; - - char EOL = '\n'; - - // Z order used to control transfer of focus between controls - int Z_STICKY = 0; // Components that don't release focus automatically i.e. GTextField - int Z_SLIPPY = 24; // Components that automatically releases focus when appropriate e.g. GButton - int Z_SLIPPY_EXPANDS = 48; // Components that expand e.g. GDropList - int Z_PANEL = 1024; // Increment to be used if on a GPanel - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GControlMode.java b/Processing/libraries/G4P/src/g4p_controls/GControlMode.java deleted file mode 100644 index be17253..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GControlMode.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ -package g4p_controls; - -import processing.core.PApplet; -import processing.core.PConstants; - -public enum GControlMode implements PConstants{ - - CORNER ( "X Y W H coordinates", "CORNER", PApplet.CORNER ), - CORNERS ( "X0 Y0 X1 Y1 coordinates", "CORNERS", PApplet.CORNERS ), - CENTER ( "X Y W H coordinates", "CENTER", PApplet.CENTER ); - - - public final String description; - public final String ps_name; - public final int mode; - - private GControlMode(String desc, String name, int ctrl_mode ){ - description = desc; - ps_name = name; - mode = ctrl_mode; - } - - public String toString(){ - return description; - } -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GCustomSlider.java b/Processing/libraries/G4P/src/g4p_controls/GCustomSlider.java deleted file mode 100644 index ced449d..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GCustomSlider.java +++ /dev/null @@ -1,376 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import g4p_controls.HotSpot.HSalpha; -import g4p_controls.HotSpot.HSrect; - -import java.awt.Graphics2D; -import java.io.File; - -import processing.core.PApplet; -import processing.core.PGraphics; -import processing.core.PImage; - -/** - * Slider that can be customised with user provided graphics.
- * - * This class replaces the GWSlider provided in pre v3 editions of this library. - *

- * The main difference to the GSlider class is the ability to skin the slider with user provided graphics. - * The library provides a number of skins ready for use. You specify the skin to use when the slider is created - * and if the library is unable to load the skin it will print a warning and load the default skin instead.

- *

Library skins available

- *
    - *
  • grey_blue (default skin)
  • - *
  • green_red20px
  • - *
  • red_yellow18px
  • - *
  • blue18px
  • - *
  • purple18px
  • - *
- * A skin requires 5 image files for different parts of the slider which must be stored in their own - * folder (the folder name is also used as the skin name) and this folder should be place inside the - * sketch's data folder.

- *

The image files have specific names. - *

    - *
  • Left end cap of the slider(end_left.???)
  • - *
  • Right end cap of the slider(end_right.???)
  • - *
  • An extendible centre segment(centre.???)
  • - *
  • Draggable thumb (handle.??? and handle_mouseover.???)
  • - *
- * Where ??? is the image type file extension. The image type can be any that Processing can handle, the - * most common types will be png, jpg or gif but tga is also permitted

- * - *

There are very few restrictions about the images you use but when designing the images you should consider - * the following facts:

- *
    - *
  • the slider will be created to fit the control size (specified in the constructor)
  • - *
  • the horizontal space allocated for the end-caps will be the same for each end (uses the width or the larger end cap image)
  • - *
  • the track width will be the height of the centre image
  • - *
  • the centre image will be tiled along the track length
  • - *
  • the track will be placed in the horizontal and vertical centre of the control.
  • - *
  • the end cap images will be placed in the vertical centre of the control and butted against the track.
  • - *
- * - * - * @author Peter Lager - * - */ -public class GCustomSlider extends GLinearTrackControl { - - protected PImage leftEnd; - protected PImage thumb; - protected PImage thumb_mouseover; - protected PImage rightEnd; - protected PImage centre; - - /** - * Create a custom slider using the default skin. - * - * @param theApplet - * @param p0 - * @param p1 - * @param p2 - * @param p3 - */ - public GCustomSlider(PApplet theApplet, float p0, float p1, float p2, float p3) { - this(theApplet, p0, p1, p2, p3, null); - } - - /** - * Create a custom slider using the skin specified. - * - * @param theApplet - * @param p0 - * @param p1 - * @param p2 - * @param p3 - * @param skin the name of the skin (this is also the name of the folder holding the images) - */ - public GCustomSlider(PApplet theApplet, float p0, float p1, float p2, float p3, String skin) { - super(theApplet, p0, p1, p2, p3); - skin = (skin == null) ? "grey_blue" : skin.trim(); - setStyle(skin); - - // Customise buffer for this control - buffer.imageMode(PApplet.CENTER); - - hotspots = new HotSpot[]{ - new HSalpha(THUMB_SPOT, width/2 + (parametricPos - 0.5f) * trackLength, height/2, thumb, PApplet.CENTER), // thumb - new HSrect(TRACK_SPOT, (width-trackLength)/2, (height-trackWidth)/2, trackLength, trackWidth), // track - }; - opaque = false; - z = Z_SLIPPY; - - epsilon = 0.98f / trackLength; - ssStartLimit = new StyledString("0.00"); - ssEndLimit = new StyledString("1.00"); - ssValue = new StyledString("0.50"); - - // Now register control with applet - createEventHandler(G4P.sketchWindow, "handleSliderEvents", - new Class[]{ GValueControl.class, GEvent.class }, - new String[]{ "slider", "event" } - ); - registeredMethods = PRE_METHOD | DRAW_METHOD | MOUSE_METHOD; - cursorOver = HAND; - G4P.registerControl(this); - } - - /** - * Change the skin used for the slider. - * @param skin the name of the folder holding the graphics for this slider - */ - public void setStyle(String skin){ - loadSkin(skin); - float maxEndLength = Math.max(leftEnd.width, rightEnd.width); - maxEndLength = Math.max(maxEndLength, 10); // make sure we have enough to show limits value - trackLength = Math.round(width - 2 * maxEndLength - TINSET); - trackDisplayLength = trackLength + 2 * Math.min(leftEnd.width, rightEnd.width); - trackWidth = centre.height; - trackOffset = calcTrackOffset(); - extendCentreImage(); - bufferInvalid = true; - } - - /** - * Calculates the amount of offset for the labels - */ - protected float calcTrackOffset(){ - float adjustedTrackOffset = (showTicks) ? trackWidth: trackWidth/2; - adjustedTrackOffset = Math.max(adjustedTrackOffset, thumb.height/2) + 2; - if(adjustedTrackOffset != trackOffset){ - bufferInvalid = true; - } - return adjustedTrackOffset; - } - - - protected void updateDueToValueChanging(){ - hotspots[0].x = (width/2 + (parametricPos - 0.5f) * trackLength); - } - - protected void updateBuffer(){ - if(bufferInvalid) { - bufferInvalid = false; - buffer.beginDraw(); - Graphics2D g2d = buffer.g2; - g2d.setFont(localFont); - - // Back ground colour - buffer.background(opaque ? palette[6].getRGB() : palette[2].getRGB() & 0xFFFFFF); - // Draw track, thumb, ticks etc. - buffer.pushMatrix(); - buffer.translate(width/2, height/2); - // draw ticks - if(showTicks){ - float delta = 1.0f / (nbrTicks - 1); - for(int i = 0; i < nbrTicks; i++){ - float tickx = Math.round((i * delta - 0.5f) * trackLength); - buffer.strokeWeight(2); - buffer.stroke(255); - buffer.line(tickx+1, -trackWidth, tickx+1, trackWidth); - buffer.strokeWeight(1.0f); - buffer.stroke(0); - buffer.line(tickx, -trackWidth, tickx, trackWidth); - } - } - buffer.image(centre,0,0); - buffer.image(leftEnd, -(trackLength + leftEnd.width)/2, 0); - buffer.image(rightEnd, (trackLength + rightEnd.width)/2, 0); - switch(status){ - case OFF_CONTROL: - buffer.image(thumb,(parametricPos - 0.5f) * trackLength, 0); - break; - case OVER_CONTROL: - case PRESS_CONTROL: - case DRAG_CONTROL: - buffer.image(thumb_mouseover,(parametricPos - 0.5f) * trackLength, 0); - break; - } - // Display slider values - g2d.setColor(palette[2]); - if(labels != null){ - drawLabels(g2d); - } - else { - - if(showLimits) - drawLimits(g2d); - if(showValue) - drawValue(g2d); - } - buffer.popMatrix(); - buffer.endDraw(); - } - } - - private void extendCentreImage(){ - int tl = (int)trackLength; - PGraphics pg = winApp.createGraphics(tl, centre.height, JAVA2D); - int rem = tl % centre.width; - int n = tl / centre.width; - n = (rem == 0) ? n : n + 1; - int px = (tl - centre.width * n)/2; - pg.beginDraw(); - pg.background(winApp.color(255,0)); - pg.imageMode(CORNER); - - while(px < tl){ - pg.image(centre, px, 0); - px += centre.width; - } - - pg.endDraw(); - centre = pg; - } - - /** - * Load a skin - * @param style - */ - private void loadSkin(String style){ - // Remember the skin we want to use - String style_used = style; - boolean found = false; - // First check for user defined skin - // See if we are running in a browser or running locally - if(winApp.sketchPath("").length() == 0) - found = loadSkin_AppletInBrowser(style); // browser - else - found = loadStyle_FromSketch(style); // local - // If not found load it from the library - if(!found) - style_used = loadStyle_FromG4P(style); - // See if we have had to use a different skin. If true then - // the original skin could not be found so say so - if(!style.equalsIgnoreCase(style_used)) - System.out.println("Unable to load the skin " + style + " using default '" + DEFAULT_SLIDER_STYLE + "' style instead"); - } - - /** - * If no user defined skin has been specified then load a style from the G4P library. - * If the style does not exist it will use the default style. - * @param style - */ - private String loadStyle_FromG4P(String style) { - boolean found = (SLIDER_STYLES.indexOf("|"+style+"|") >= 0); - // If not found use the default grey_blue - if(!found) - style = DEFAULT_SLIDER_STYLE; - - // All the library styles use png graphics - leftEnd = winApp.loadImage(style + "/end_left.png"); - rightEnd = winApp.loadImage(style + "/end_right.png"); - thumb = winApp.loadImage(style +"/handle.png"); - thumb_mouseover = winApp.loadImage(style +"/handle_mouseover.png"); - // will be stretched before use - centre = winApp.loadImage(style + "/centre.png"); - - return style; - } - - /** - * Load a skin when run as an application or run locally. - * - * @param styleFolder - * @param style - * @return true if the style loaded successfully - */ - private boolean loadStyle_FromSketch(String style) { - // First attempt to locate the style inside the sketch or sketch data folders - File styleFolder = new File(winApp.dataPath(style)); - if(!styleFolder.exists()) - styleFolder = new File(winApp.sketchPath(style)); - // If the style is in the sketch then attempt to load the style - // and if successful we are done - if(!styleFolder.exists()) - return false; - - int fcount = 0; - String[] names = new String[] { "centre.", "end_left.", "end_right.", "handle.", "handle_mouseover." }; - PImage[] images = new PImage[names.length]; - File[] fileList = styleFolder.listFiles(); - for(int i = 0; i < names.length; i++){ - for(File f : fileList){ - String filename = f.getName(); - if(filename.startsWith(names[i])){ - images[i] = winApp.loadImage(style + "/" + filename); - fcount ++; - } - } - } - if(fcount != names.length) - return false; - - centre = images[0]; - leftEnd = images[1]; - rightEnd = images[2]; - thumb = images[3]; - thumb_mouseover = images[4]; - return true; - } - - /** - * Load a skin when run as an applet inside a browser. - * - * Note: sketchPath() is null when inside a browswer. - * - * @param style - * @return true if the style loaded successfully - */ - private boolean loadSkin_AppletInBrowser(String style){ - leftEnd = winApp.loadImage(style + "/end_left.png"); - if(leftEnd == null) - leftEnd = winApp.loadImage(style + "/end_left.jpg"); - rightEnd = winApp.loadImage(style + "/end_right.png"); - if(rightEnd == null) - rightEnd = winApp.loadImage(style + "/end_right.jpg"); - thumb = winApp.loadImage(style +"/handle.png"); - if(thumb == null) - thumb = winApp.loadImage(style +"/handle.jpg"); - thumb_mouseover = winApp.loadImage(style +"/handle_mouseover.png"); - if(thumb_mouseover == null) - thumb_mouseover = winApp.loadImage(style +"/handle_mouseover.jpg"); - // will be stretched before use - centre = winApp.loadImage(style + "/centre.png"); - if(centre == null) - centre = winApp.loadImage(style + "/centre.jpg"); - - boolean found = !(leftEnd == null || rightEnd == null || thumb == null || thumb_mouseover == null || centre == null); - - // See if we have problems with the skin files - if(!found){ - System.out.println("Unable to load the skin " + style + " check the "); - System.out.println("skin name used and ensure all the image files are present."); - System.out.println("Reverting to default 'grey_blue' style"); - loadSkin("grey_blue"); - } - return found; - } - - - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GDropList.java b/Processing/libraries/G4P/src/g4p_controls/GDropList.java deleted file mode 100644 index e2da9c2..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GDropList.java +++ /dev/null @@ -1,521 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import g4p_controls.HotSpot.HSrect; - -import java.awt.Graphics2D; -import java.awt.font.TextLayout; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -import processing.core.PApplet; -import processing.core.PGraphics; -import processing.event.MouseEvent; - -/** - * A drop down list component.
- * - * This replaces the GCombo control in pre V3 editions of this library.
- * - * The number of items in the list is not restricted but the user can define - * the maximum number of items to be displayed in the drop list. If there are - * too many items to display a vertical scroll bar is provide to scroll through - * all the items. - * - * The vertical size of an individual item is calculated from the overall height - * specified when creating the control.
- * - * @author Peter Lager - * - */ -public class GDropList extends GTextBase { - - static protected int LIST_SURFACE = 1; - static protected int CLOSED_SURFACE = 2; - - protected static final int FORE_COLOR = 2; - protected static final int BACK_COLOR = 5; - protected static final int ITEM_FORE_COLOR = 3; - protected static final int ITEM_BACK_COLOR = 6; - protected static final int OVER_ITEM_FORE_COLOR = 15; - - - private GScrollbar vsb; - private GButton showList; - - protected LinkedList itemlist = new LinkedList(); - protected StyledString[] sitems; - protected StyledString selText; - - protected int selItem = 0; - protected int startItem = 0; - protected int lastOverItem = -1; - protected int currOverItem = lastOverItem; - - - protected int dropListMaxSize = 4; - protected int dropListActualSize = 4; - - protected float itemHeight, buttonWidth; - - protected boolean expanded = false; // make false in release version - - /** - * Create a drop down list component with a list size of 4. - * - * After creating the control use setItems to initialise the list.
- * - * @param theApplet the applet that will display this component. - * @param p0 - * @param p1 - * @param p2 - * @param p3 - */ - public GDropList(PApplet theApplet, float p0, float p1, float p2, float p3) { - this(theApplet, p0, p1, p2, p3, 4); - } - - /** - * Create a drop down list component with a specified list size. - * - * After creating the control use setItems to initialise the list.
- * - * @param theApplet - * @param p0 - * @param p1 - * @param p2 - * @param p3 - * @param dropListMaxSize the maximum number of element to appear in the drop down list - */ - public GDropList(PApplet theApplet, float p0, float p1, float p2, float p3, int dropListMaxSize) { - super(theApplet, p0, p1, p2, p3); - children = new LinkedList(); - this.dropListMaxSize = Math.max(dropListMaxSize, 3); - itemHeight = height / (dropListMaxSize + 1); // make allowance for selected text at top - - G4P.pushStyle(); - G4P.showMessages = false; - - vsb = new GScrollbar(theApplet, 0, 0, height - itemHeight-2, 10); - vsb.addEventHandler(this, "vsbEventHandler"); - vsb.setAutoHide(true); - vsb.setVisible(false); - - buttonWidth = 10; - showList = new GButton(theApplet, 0, 0, buttonWidth, itemHeight, ":"); - showList.addEventHandler(this, "buttonShowListHandler"); - - // Do this before we add the button and scrollbar - z = Z_SLIPPY_EXPANDS; - - // Add the button and scrollbar - G4P.control_mode = GControlMode.CORNER; - addControl(vsb, width, itemHeight + 1, PI/2); - addControl(showList, width - buttonWidth, 0, 0); - - G4P.popStyle(); - - hotspots = new HotSpot[]{ - new HSrect(LIST_SURFACE, 0, itemHeight+1, width - 11, height - itemHeight - 1), // text list area - new HSrect(CLOSED_SURFACE, 0, 0, width - buttonWidth, itemHeight) // selected text display area - }; - - createEventHandler(G4P.sketchWindow, "handleDropListEvents", - new Class[]{ GDropList.class, GEvent.class }, - new String[]{ "list", "event" } - ); - registeredMethods = DRAW_METHOD | MOUSE_METHOD; - cursorOver = HAND; - G4P.registerControl(this); - } - - /** - * Use this to set or change the list of items to appear in the list. If - * you enter an invalid selection index then it is forced into - * the valid range.
- * Null and empty values in the list will be ignored.
- * If the list is null then or empty then then no changes are made.
- * @param array - * @param selected - */ - public void setItems(String[] array, int selected){ - if(array == null) - return; - // Get rid of null or empty strings - ArrayList strings = new ArrayList(); - for(String s : array) - strings.add(s); - if(cleanupList(strings)) - setItemsImpl(selected); - } - - public void setItems(List list, int selected){ - if(list == null) - return; - if(cleanupList(list)) - setItemsImpl(selected); - } - - private boolean cleanupList(List list){ - // Get rid of null or empty strings - Iterator iter = list.iterator(); - while(iter.hasNext()){ - String s = iter.next(); - if(s == null || s.length() == 0) - iter.remove(); - } - if(list.size() > 0){ - // We have at least one item for the droplist - itemlist.clear(); - itemlist.addAll(list); - return true; - } - return false; - } - - private void setItemsImpl(int selected){ - sitems = new StyledString[itemlist.size()]; - // Create styled strings for display - for(int i = 0; i < sitems.length; i++) - sitems[i] = new StyledString(itemlist.get(i)); - // Force selected value into valid range - selItem = PApplet.constrain(selected, 0, sitems.length - 1); - startItem = (selItem >= dropListMaxSize) ? selItem - dropListMaxSize + 1 : 0; - // Make selected item bold - sitems[selItem].addAttribute(WEIGHT, WEIGHT_BOLD); - // Create separate styled string for display area - selText = new StyledString(sitems[selItem].getPlainText()); - dropListActualSize = Math.min(sitems.length, dropListMaxSize); - if((sitems.length > dropListActualSize)){ - float filler = ((float)dropListMaxSize)/sitems.length; - float value = ((float)startItem)/sitems.length; - vsb.setValue(value, filler); - vsb.setVisible(false); // make it false - } - bufferInvalid = true; - } - - /** - * Remove an item from the list.
- * If idx is not a valid position in the list then the list is unchanged. - * If idx points to the selected item or an item below it then the - * selected index value is reduced by 1 but the selected text remains the - * same.
- * If idx points to an item above the selected item then the selected - * item is unchanged.
- * No event is fired even if the selected index changes.
- * - * @param idx index of the item to remove - * @return true if item is successfully removed else false - */ - public boolean removeItem(int idx){ - if(itemlist.size() <= 1 || idx < 0 || idx >= itemlist.size() ) - return false; - int sel = (idx > selItem) ? selItem : selItem - 1; - itemlist.remove(idx); - setItemsImpl(sel); - return true; - } - - /** - * Insert an item at the specified position in the list.
- * If idx is <0 then the list is unchanged.
- * If idx is >= the number of items in the list, it is added to the end.
- * If idx points to the selected item or an item below it then the - * selected index value is incremented by 1 but the selected text remains - * the same.
- * If idx points to an item above the selected item then the selected - * item is unchanged.
- * No event is fired even if the selected index changes.
- * - * @param idx index of the item to remove - * @param name text of the item to insert (null values ignored) - * @return true if item is successfully inserted else false - */ - - public boolean insertItem(int idx, String name){ - if(idx < 0 || name == null || name.length() > 0) - return false; - if(idx >= itemlist.size()){ - itemlist.addLast(name); - } - else { - itemlist.add(idx, name); - } - int sel = (idx <= selItem) ? selItem + 1: selItem; - setItemsImpl(sel); - return true; - } - - /** - * Add an item to the end of the list.
- * No event is fired.
- * - * @param name text of the item to add (null values ignored) - * @return true if add is successfully added else false - */ - public boolean addItem(String name){ - if(name == null) - return false; - itemlist.addLast(name); - return true; - } - - /** - * Set the currently selected item from the droplist by index position.
- * Invalid values are ignored. - * - * @param selected - */ - public void setSelected(int selected){ - if(selected >=0 && selected < sitems.length){ - selItem = selected; - startItem = (selItem >= dropListMaxSize) ? selItem - dropListMaxSize + 1 : 0; - for(StyledString s : sitems) - s.clearAttributes(); - sitems[selItem].addAttribute(WEIGHT, WEIGHT_BOLD); - selText = new StyledString(sitems[selItem].getPlainText()); - bufferInvalid = true; - } - } - - /** - * Get the index position of the selected item - */ - public int getSelectedIndex(){ - return selItem; - } - - /** - * Get the text for the selected item - */ - public String getSelectedText(){ - return sitems[selItem].getPlainText(); - } - - /** - * Sets the local colour scheme for this control - */ - public void setLocalColorScheme(int cs){ - super.setLocalColorScheme(cs); - if(showList != null) - showList.setLocalColorScheme(localColorScheme); - if(vsb != null) - vsb.setLocalColorScheme(localColorScheme); - } - - /** - * Determines if a particular pixel position is over this control taking - * into account whether it is collapsed or not. - */ - public boolean isOver(float x, float y){ - calcTransformedOrigin(winApp.mouseX, winApp.mouseY); - currSpot = whichHotSpot(ox, oy); - return (!expanded)? currSpot == CLOSED_SURFACE : currSpot == CLOSED_SURFACE | currSpot == LIST_SURFACE; - } - - public void mouseEvent(MouseEvent event){ - if(!visible || !enabled || !available) return; - - calcTransformedOrigin(winApp.mouseX, winApp.mouseY); - currSpot = whichHotSpot(ox, oy); - - if(currSpot >= 0 || focusIsWith == this) - cursorIsOver = this; - else if(cursorIsOver == this) - cursorIsOver = null; - - switch(event.getAction()){ - case MouseEvent.CLICK: - // No need to test for isOver() since if the component has focus - // and the mouse has not moved since MOUSE_PRESSED otherwise we - // would not get the Java MouseEvent.MOUSE_CLICKED event - if(focusIsWith == this ){ - loseFocus(null); - vsb.setVisible(false); - expanded = false; - bufferInvalid = true; - // Make sure that we have selected a valid item and that - // it is not the same as before; - if(currOverItem >= 0 && currOverItem != selItem){ - setSelected(currOverItem); - fireEvent(this, GEvent.SELECTED); - } - currOverItem = lastOverItem = -1; - } - break; - case MouseEvent.MOVE: - if(focusIsWith == this){ - if(currSpot == LIST_SURFACE) - currOverItem = startItem + (int)(oy / itemHeight)-1; - //currOverItem = startItem + Math.round(oy / itemHeight) - 1; - else - currOverItem = -1; - // Only invalidate the buffer if the over item has changed - if(currOverItem != lastOverItem){ - lastOverItem = currOverItem; - bufferInvalid = true; - } - } - break; - } - } - - public void draw(){ - if(!visible) return; - updateBuffer(); - - winApp.pushStyle(); - winApp.pushMatrix(); - - winApp.translate(cx, cy); - winApp.rotate(rotAngle); - - winApp.pushMatrix(); - // Move matrix to line up with top-left corner - winApp.translate(-halfWidth, -halfHeight); - // Draw buffer - winApp.imageMode(PApplet.CORNER); - if(alphaLevel < 255) - winApp.tint(TINT_FOR_ALPHA, alphaLevel); - winApp.image(buffer, 0, 0); - - winApp.popMatrix(); - - if(children != null){ - for(GAbstractControl c : children) - c.draw(); - } - winApp.popMatrix(); - winApp.popStyle(); - } - - public PGraphics getSnapshot(){ - updateBuffer(); - PGraphics snap = winApp.createGraphics(buffer.width, buffer.height, PApplet.JAVA2D); - snap.beginDraw(); - snap.image(buffer,0,0); - snap.pushMatrix(); - // showList - snap.image(showList.getBuffer(), width - showList.getWidth() - 1, 1); - snap.translate(width, itemHeight + 1); - snap.rotate(PApplet.PI/2); - snap.image(vsb.getBuffer(), 0, 0); - snap.popMatrix(); - snap.endDraw(); - return snap; - } - - protected void updateBuffer(){ - if(bufferInvalid) { - bufferInvalid = false; - buffer.beginDraw(); - Graphics2D g2d = buffer.g2; - g2d.setFont(localFont); - - buffer.clear(); - buffer.noStroke(); - buffer.fill(palette[BACK_COLOR].getRGB()); - buffer.rect(0, 0, width, itemHeight); - - if(expanded){ - buffer.fill(palette[ITEM_BACK_COLOR].getRGB()); - buffer.rect(0,itemHeight, width, itemHeight * dropListActualSize); - } - - float px = TPAD2, py; - TextLayout line; - // Get selected text for display - line = selText.getLines(g2d).getFirst().layout; - py = (itemHeight + line.getAscent() - line.getDescent())/2; - - g2d.setColor(palette[FORE_COLOR]); - line.draw(g2d, px, py); - - if(expanded){ - // g2d.setColor(palette[ITEM_FORE_COLOR]); // REDUNDANT CODE ???? - for(int i = 0; i < dropListActualSize; i++){ - py += itemHeight; - if(currOverItem == startItem + i) - g2d.setColor(palette[OVER_ITEM_FORE_COLOR]); - else - g2d.setColor(palette[ITEM_FORE_COLOR]); - - line = sitems[startItem + i].getLines(g2d).getFirst().layout; - line.draw(g2d, px, py); - } - } - buffer.endDraw(); - } - } - - /** - * For most components there is nothing to do when they loose focus. - * Override this method in classes that need to do something when - * they loose focus eg TextField - */ - protected void loseFocus(GAbstractControl grabber){ - if(grabber != vsb){ - expanded = false; - vsb.setVisible(false); - bufferInvalid = true; - } - if(cursorIsOver == this) - cursorIsOver = null; - focusIsWith = grabber; - } - - - /** - * This method should not be called by the user. It - * is for internal library use only. - */ - public void vsbEventHandler(GScrollbar scrollbar, GEvent event){ - int newStartItem = Math.round(vsb.getValue() * sitems.length); - startItem = newStartItem; - bufferInvalid = true; - } - - /** - * This method should not be called by the user. It - * is for internal library use only. - */ - public void buttonShowListHandler(GButton button, GEvent event){ - if(expanded){ - loseFocus(null); - vsb.setVisible(false); - expanded = false; - } - else { - takeFocus(); - vsb.setVisible(sitems.length > dropListActualSize); - expanded = true; - } - bufferInvalid = true; - } - -} \ No newline at end of file diff --git a/Processing/libraries/G4P/src/g4p_controls/GEditableTextControl.java b/Processing/libraries/G4P/src/g4p_controls/GEditableTextControl.java deleted file mode 100644 index 2b1c399..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GEditableTextControl.java +++ /dev/null @@ -1,723 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2013 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import g4p_controls.StyledString.TextLayoutHitInfo; -import g4p_controls.StyledString.TextLayoutInfo; - -import java.awt.Font; -import java.awt.font.TextAttribute; -import java.awt.font.TextHitInfo; -import java.awt.geom.GeneralPath; -import java.util.LinkedList; - -import processing.core.PApplet; -import processing.event.KeyEvent; - -/** - * - * This class is the basis for the GTextField and GTextArea classes. - * - * @author Peter Lager - * - */ -public abstract class GEditableTextControl extends GTextBase implements Focusable { - - GTabManager tabManager = null; - - protected StyledString promptText = null; - // The width to break a line - protected int wrapWidth = Integer.MAX_VALUE; - - // The typing area - protected float tx,ty,th,tw; - // Offset to display area - protected float ptx, pty; - // Caret position - protected float caretX, caretY; - - protected boolean keepCursorInView = false; - - protected GeneralPath gpTextDisplayArea; - - // Used for identifying selection and cursor position - protected TextLayoutHitInfo startTLHI = new TextLayoutHitInfo(); - protected TextLayoutHitInfo endTLHI = new TextLayoutHitInfo(); - - // The scrollbars available - protected final int scrollbarPolicy; - protected boolean autoHide = false; - protected GScrollbar hsb, vsb; - - protected GTimer caretFlasher; - protected boolean showCaret = false; - - // Stuff to manage text selections - protected int endChar = -1, startChar = -1, pos = endChar, nbr = 0, adjust = 0; - protected boolean textChanged = false, selectionChanged = false; - - /* Is the component enabled to generate mouse and keyboard events */ - boolean textEditEnabled = true; - - public GEditableTextControl(PApplet theApplet, float p0, float p1, float p2, float p3, int scrollbars) { - super(theApplet, p0, p1, p2, p3); - scrollbarPolicy = scrollbars; - autoHide = ((scrollbars & SCROLLBARS_AUTOHIDE) == SCROLLBARS_AUTOHIDE); - caretFlasher = new GTimer(theApplet, this, "flashCaret", 400); - caretFlasher.start(); - opaque = true; - cursorOver = TEXT; - } - - public void setTabManager(GTabManager tm){ - tabManager = tm; - } - - /** - * Give up focus but if the text is only made from spaces - * then set it to null text.
- * Fire focus events for the GTextField and GTextArea controls - */ - protected void loseFocus(GAbstractControl grabber){ - // If this control has focus then Fire a lost focus event - if(focusIsWith == this) - fireEvent(this, GEvent.LOST_FOCUS); - // Process mouse-over cursor - if(cursorIsOver == this) - cursorIsOver = null; - focusIsWith = grabber; - // If only blank text clear it out allowing default text (if any) to be displayed -// if(stext.length() > 0){ -// int tl = stext.getPlainText().trim().length(); -// if(tl == 0) -// stext.setText("", wrapWidth); -// } - keepCursorInView = true; - bufferInvalid = true; - } - - /** - * Give the focus to this component but only after allowing the - * current component with focus to release it gracefully.
- * Always cancel the keyFocusIsWith irrespective of the component - * type. - * Fire focus events for the GTextField and GTextArea controls - */ - protected void takeFocus(){ - // If focus is not yet with this control fire a gets focus event - if(focusIsWith != this){ - // If the focus is with another control then tell - // that control to lose focus - if(focusIsWith != null) - focusIsWith.loseFocus(this); - fireEvent(this, GEvent.GETS_FOCUS); - } - focusIsWith = this; - } - - /** - * Determines whether this component is to have focus or not.
- */ - public void setFocus(boolean focus){ - if(!focus){ - loseFocus(null); - return; - } - // Make sure we have some text - if(focusIsWith != this){ - dragging = false; - if(stext == null || stext.length() == 0) - stext.setText(" ", wrapWidth); - LinkedList lines = stext.getLines(buffer.g2); - startTLHI = new TextLayoutHitInfo(lines.getFirst(), null); - startTLHI.thi = startTLHI.tli.layout.getNextLeftHit(1); - - endTLHI = new TextLayoutHitInfo(lines.getLast(), null); - int lastChar = endTLHI.tli.layout.getCharacterCount(); - endTLHI.thi = startTLHI.tli.layout.getNextRightHit(lastChar-1); - - calculateCaretPos(endTLHI); - bufferInvalid = true; - } - keepCursorInView = true; - takeFocus(); - } - - /** - * Set the prompt text for this control. When the text control is empty - * the prompt text (italic) is displayed instead. - * . - * @param ptext prompt text - */ - public void setPromptText(String ptext){ - if(ptext == null || ptext.length() == 0) - promptText = null; - else { - promptText = new StyledString(ptext, wrapWidth); - promptText.addAttribute(G4P.POSTURE, G4P.POSTURE_OBLIQUE); - } - bufferInvalid = true; - } - - /** - * @return the wrapWidth - */ - public int getWrapWidth() { - return wrapWidth; - } - - /** - * @param wrapWidth the wrapWidth to set - */ - public void setWrapWidth(int wrapWidth) { - this.wrapWidth = wrapWidth; - } - - /** - * Get the prompt text used in this control. - * @return the prompt text without styling - */ - public String getPromptText(){ - return promptText.getPlainText(); - } - - /** - * Get the text in the control - * @return the text without styling - */ - public String getText(){ - return stext.getPlainText(); - } - - /** - * Get the styled text in the control - * @return the text with styling - */ - public StyledString getStyledText(){ - return stext; - } - - /** - * Adds the text attribute to a range of characters on a particular line. If charEnd - * is past the EOL then the attribute will be applied to the end-of-line. - * - * @param attr the text attribute to add - * @param value value of the text attribute - * @param charStart the position of the first character to apply the attribute - * @param charEnd the position after the last character to apply the attribute - */ - public void addStyle(TextAttribute attr, Object value, int charStart, int charEnd){ - if(stext != null){ - stext.addAttribute(attr, value, charStart, charEnd); - bufferInvalid = true; - } - } - - /** - * Adds the text attribute to a range of characters on a particular line. If charEnd - * is past the EOL then the attribute will be applied to the end-of-line. - * - * @param attr the text attribute to add - * @param value value of the text attribute - */ - public void addStyle(TextAttribute attr, Object value){ - if(stext != null){ - stext.addAttribute(attr, value); - bufferInvalid = true; - } - } - - /** - * Clears all text attribute from a range of characters starting at position - * charStart and ending with the character preceding charEnd. - * - * - * @param charStart the position of the first character to apply the attribute - * @param charEnd the position after the last character to apply the attribute - */ - public void clearStyles(int charStart, int charEnd){ - if(stext != null) { - stext.clearAttributes(charStart, charEnd); - bufferInvalid = true; - } - } - - /** - * Clear all styles from the entire text. - */ - public void clearStyles(){ - if(stext != null){ - stext.clearAttributes(); - bufferInvalid = true; - } - } - - /** - * Set the font for this control. - * @param font - */ - public void setFont(Font font) { - if(font != null && font != localFont && buffer != null){ - localFont = font; - ptx = pty = 0; - setScrollbarValues(ptx, pty); - bufferInvalid = true; - } - } - - // SELECTED / HIGHLIGHTED TEXT - - /** - * Get the text that has been selected (highlighted) by the user.
- * @return the selected text without styling - */ - public String getSelectedText(){ - if(!hasSelection()) - return ""; - TextLayoutHitInfo startSelTLHI; - TextLayoutHitInfo endSelTLHI; - if(endTLHI.compareTo(startTLHI) == -1){ - startSelTLHI = endTLHI; - endSelTLHI = startTLHI; - } - else { - startSelTLHI = startTLHI; - endSelTLHI = endTLHI; - } - int ss = startSelTLHI.tli.startCharIndex + startSelTLHI.thi.getInsertionIndex(); - int ee = endSelTLHI.tli.startCharIndex + endSelTLHI.thi.getInsertionIndex(); - String s = stext.getPlainText().substring(ss, ee); - return s; - } - - /** - * If some text has been selected then set the style. If there is no selection then - * the text is unchanged. - * - * - * @param style - */ - public void setSelectedTextStyle(TextAttribute style, Object value){ - if(!hasSelection()) - return; - TextLayoutHitInfo startSelTLHI; - TextLayoutHitInfo endSelTLHI; - if(endTLHI.compareTo(startTLHI) == -1){ - startSelTLHI = endTLHI; - endSelTLHI = startTLHI; - } - else { - startSelTLHI = startTLHI; - endSelTLHI = endTLHI; - } - int ss = startSelTLHI.tli.startCharIndex + startSelTLHI.thi.getInsertionIndex(); - int ee = endSelTLHI.tli.startCharIndex + endSelTLHI.thi.getInsertionIndex(); - stext.addAttribute(style, value, ss, ee); - - // We have modified the text style so the end of the selection may have - // moved, so it needs to be recalculated. The start will be unaffected. - stext.getLines(buffer.g2); - endSelTLHI.tli = stext.getTLIforCharNo(ee); - int cn = ee - endSelTLHI.tli.startCharIndex; - if(cn == 0) // start of line - endSelTLHI.thi = endSelTLHI.tli.layout.getNextLeftHit(1); - else - endSelTLHI.thi = endSelTLHI.tli.layout.getNextRightHit(cn-1); - bufferInvalid = true; - } - - /** - * Clear any styles applied to the selected text. - */ - public void clearSelectionStyle(){ - if(!hasSelection()) - return; - TextLayoutHitInfo startSelTLHI; - TextLayoutHitInfo endSelTLHI; - if(endTLHI.compareTo(startTLHI) == -1){ - startSelTLHI = endTLHI; - endSelTLHI = startTLHI; - } - else { - startSelTLHI = startTLHI; - endSelTLHI = endTLHI; - } - int ss = startSelTLHI.tli.startCharIndex + startSelTLHI.thi.getInsertionIndex(); - int ee = endSelTLHI.tli.startCharIndex + endSelTLHI.thi.getInsertionIndex(); - stext.clearAttributes(ss, ee); - - // We have modified the text style so the end of the selection may have - // moved, so it needs to be recalculated. The start will be unaffected. - stext.getLines(buffer.g2); - endSelTLHI.tli = stext.getTLIforCharNo(ee); - int cn = ee - endSelTLHI.tli.startCharIndex; - if(cn == 0) // start of line - endSelTLHI.thi = endSelTLHI.tli.layout.getNextLeftHit(1); - else - endSelTLHI.thi = endSelTLHI.tli.layout.getNextRightHit(cn-1); - bufferInvalid = true; - } - - - /** - * Used internally to set the scrollbar values as the text changes. - * - * @param sx - * @param sy - */ - void setScrollbarValues(float sx, float sy){ - if(vsb != null){ - float sTextHeight = stext.getTextAreaHeight(); - if(sTextHeight < th) - vsb.setValue(0.0f, 1.0f); - else - vsb.setValue(sy/sTextHeight, th/sTextHeight); - } - // If needed update the horizontal scrollbar - if(hsb != null){ - float sTextWidth = stext.getMaxLineLength(); - if(stext.getMaxLineLength() < tw) - hsb.setValue(0,1); - else - hsb.setValue(sx/sTextWidth, tw/sTextWidth); - } - } - - /** - * Move caret to home position - * @param currPos the current position of the caret - * @return true if caret moved else false - */ - protected boolean moveCaretStartOfLine(TextLayoutHitInfo currPos){ - if(currPos.thi.getCharIndex() == 0) - return false; // already at start of line - currPos.thi = currPos.tli.layout.getNextLeftHit(1); - return true; - } - - /** - * Move caret to the end of the line that has the current caret position - * @param currPos the current position of the caret - * @return true if caret moved else false - */ - protected boolean moveCaretEndOfLine(TextLayoutHitInfo currPos){ - if(currPos.thi.getCharIndex() == currPos.tli.nbrChars - 1) - return false; // already at end of line - currPos.thi = currPos.tli.layout.getNextRightHit(currPos.tli.nbrChars - 1); - return true; - } - - /** - * Move caret left by one character. - * @param currPos the current position of the caret - * @return true if caret moved else false - */ - protected boolean moveCaretLeft(TextLayoutHitInfo currPos){ - TextHitInfo nthi = currPos.tli.layout.getNextLeftHit(currPos.thi); - if(nthi == null){ - return false; - } - else { - // Move the caret to the left of current position - currPos.thi = nthi; - } - return true; - } - - /** - * Move caret right by one character. - * @param currPos the current position of the caret - * @return true if caret moved else false - */ - protected boolean moveCaretRight(TextLayoutHitInfo currPos){ - TextHitInfo nthi = currPos.tli.layout.getNextRightHit(currPos.thi); - if(nthi == null){ - return false; - } - else { - currPos.thi = nthi; - } - return true; - } - - public void setJustify(boolean justify){ - stext.setJustify(justify); - bufferInvalid = true; - } - - /** - * Sets the local colour scheme for this control - */ - public void setLocalColorScheme(int cs){ - super.setLocalColorScheme(cs); - if(hsb != null) - hsb.setLocalColorScheme(localColorScheme); - if(vsb != null) - vsb.setLocalColorScheme(localColorScheme); - } - - /** - * Find out if some text is selected (highlighted) - * @return true if some text is selected else false - */ - public boolean hasSelection(){ - return (startTLHI.tli != null && endTLHI.tli != null && startTLHI.compareTo(endTLHI) != 0); - } - - /** - * Calculate the caret (text insertion point) - * - * @param tlhi - */ - protected void calculateCaretPos(TextLayoutHitInfo tlhi){ - float temp[] = tlhi.tli.layout.getCaretInfo(tlhi.thi); - caretX = temp[0]; - caretY = tlhi.tli.yPosInPara; - } - - /** - * Determines whether the text can be edited using the keyboard or mouse. It - * still allows the text to be modified by the sketch code.
- * If text editing is being disabled and the control has focus then it is forced - * to give up that focus.
- * This might be useful if you want to use a GTextArea control to display large - * amounts of text that needs scrolling (so cannot use a GLabel) but must not - * change e.g. a user instruction guide. - * - * @param enableTextEdit false to disable keyboard input - */ - public void setTextEditEnabled(boolean enableTextEdit){ - // If we are disabling this then make sure it does not have focus - if(enableTextEdit == false && focusIsWith == this){ - loseFocus(null); - } - enabled = enableTextEdit; - textEditEnabled = enableTextEdit; - } - - /** - * Is this control keyboard enabled - */ - public boolean isTextEditEnabled(){ - return textEditEnabled; - } - - public void keyEvent(KeyEvent e) { - if(!visible || !enabled || !textEditEnabled || !available) return; - if(focusIsWith == this && endTLHI != null){ - char keyChar = e.getKey(); - int keyCode = e.getKeyCode(); - int keyID = e.getAction(); - boolean shiftDown = e.isShiftDown(); - boolean ctrlDown = e.isControlDown(); - - textChanged = false; - keepCursorInView = true; - - int startPos = pos, startNbr = nbr; - - // Get selection details - endChar = endTLHI.tli.startCharIndex + endTLHI.thi.getInsertionIndex(); - startChar = (startTLHI != null) ? startTLHI.tli.startCharIndex + startTLHI.thi.getInsertionIndex() : endChar; - pos = endChar; - nbr = 0; - adjust = 0; - if(endChar != startChar){ // Have we some text selected? - if(startChar < endChar){ // Forward selection - pos = startChar; nbr = endChar - pos; - } - else if(startChar > endChar){ // Backward selection - pos = endChar; nbr = startChar - pos; - } - } - if(startPos >= 0){ - if(startPos != pos || startNbr != nbr) - fireEvent(this, GEvent.SELECTION_CHANGED); - } - // Select either keyPressedProcess or keyTypeProcess. These two methods are overridden in child classes - if(keyID == KeyEvent.PRESS) { - keyPressedProcess(keyCode, keyChar, shiftDown, ctrlDown); - setScrollbarValues(ptx, pty); - } - else if(keyID == KeyEvent.TYPE ){ // && e.getKey() != KeyEvent.CHAR_UNDEFINED && !ctrlDown){ - keyTypedProcess(keyCode, keyChar, shiftDown, ctrlDown); - setScrollbarValues(ptx, pty); - } - if(textChanged){ - changeText(); - fireEvent(this, GEvent.CHANGED); - } - } - } - - // Enable polymorphism. - protected void keyPressedProcess(int keyCode, char keyChar, boolean shiftDown, boolean ctrlDown) { } - - protected void keyTypedProcess(int keyCode, char keyChar, boolean shiftDown, boolean ctrlDown){ } - - - // Only executed if text has changed - protected boolean changeText(){ - TextLayoutInfo tli; - TextHitInfo thi = null, thiRight = null; - - pos += adjust; - // Force layouts to be updated - stext.getLines(buffer.g2); - - // Try to get text layout info for the current position - tli = stext.getTLIforCharNo(pos); - if(tli == null){ - // If unable to get a layout for pos then reset everything - endTLHI = null; - startTLHI = null; - ptx = pty = 0; - caretX = caretY = 0; - return false; - } - // We have a text layout so we can do something - // First find the position in line - int posInLine = pos - tli.startCharIndex; - - // Get some hit info so we can see what is happening - try{ - thiRight = tli.layout.getNextRightHit(posInLine); - } - catch(Exception excp){ - thiRight = null; - } - - if(posInLine <= 0){ // At start of line - thi = tli.layout.getNextLeftHit(thiRight); - } - else if(posInLine >= tli.nbrChars){ // End of line - thi = tli.layout.getNextRightHit(tli.nbrChars - 1); - } - else { // Character in line; - thi = tli.layout.getNextLeftHit(thiRight); - } - - endTLHI.setInfo(tli, thi); - // Cursor at end of paragraph graphic - calculateCaretPos(endTLHI); - - bufferInvalid = true; - return true; - } - - /** - * Do not call this directly. A timer calls this method as and when required. - */ - public void flashCaret(GTimer timer){ - showCaret = !showCaret; - } - - /** - * Do not call this method directly, G4P uses it to handle input from - * the horizontal scrollbar. - */ - public void hsbEventHandler(GScrollbar scrollbar, GEvent event){ - keepCursorInView = false; - ptx = hsb.getValue() * (stext.getMaxLineLength() + 4); - bufferInvalid = true; - } - - /** - * Do not call this method directly, G4P uses it to handle input from - * the vertical scrollbar. - */ - public void vsbEventHandler(GScrollbar scrollbar, GEvent event){ - keepCursorInView = false; - pty = vsb.getValue() * (stext.getTextAreaHeight() + 1.5f * stext.getMaxLineHeight()); - bufferInvalid = true; - } - - /** - * Permanently dispose of this control. - */ - public void markForDisposal(){ - if(tabManager != null) - tabManager.removeControl(this); - super.markForDisposal(); - } - - /** - * Save the styled text used by this control to file.
- * It will also save the start and end position of any text selection. - * - * @param fname the name of the file to use - * @return true if saved successfully else false - */ - public boolean saveText(String fname){ - if(stext == null) - return false; - if(hasSelection()){ - stext.startIdx = startTLHI.tli.startCharIndex + startTLHI.thi.getInsertionIndex(); - stext.endIdx = endTLHI.tli.startCharIndex + endTLHI.thi.getInsertionIndex(); - } - else { - stext.startIdx = stext.endIdx = -1; - } - StyledString.save(winApp, stext, fname); - return true; - } - - /** - * Load the styled string to be used by this control.
- * It will also restore any text selection saved with the text. - * - * @param fname the name of the file to use - * @return true if loaded successfully else false - */ - public boolean loadText(String fname){ - StyledString ss = StyledString.load(winApp, fname); - if(ss == null) - return false; - setStyledText(ss); - // Now restore any text selection - if(stext.startIdx >=0){ // we have a selection - // Selection starts at ... - startTLHI = new TextLayoutHitInfo(); - startTLHI.tli = stext.getTLIforCharNo(stext.startIdx); - int pInLayout = stext.startIdx - startTLHI.tli.startCharIndex; - if(pInLayout == 0) - startTLHI.thi = startTLHI.tli.layout.getNextLeftHit(1); - else - startTLHI.thi = startTLHI.tli.layout.getNextRightHit(pInLayout - 1); - // Selection ends at ... - endTLHI = new TextLayoutHitInfo(); - endTLHI.tli = stext.getTLIforCharNo(stext.endIdx); - pInLayout = stext.endIdx - endTLHI.tli.startCharIndex; - - if(pInLayout == 0) - endTLHI.thi = endTLHI.tli.layout.getNextLeftHit(1); - else - endTLHI.thi = endTLHI.tli.layout.getNextRightHit(pInLayout - 1); - calculateCaretPos(endTLHI); - } - bufferInvalid = true; - return true; - } - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GEvent.java b/Processing/libraries/G4P/src/g4p_controls/GEvent.java deleted file mode 100644 index d3ad3d3..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GEvent.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -/** - * Enumeration of events that can be fired by G4P.
- * - * GTextField and GTextArea events
- * CHANGED Text has changed
- * SELECTION_CHANGED Text selection has changed
- * ENTERED Enter/return key typed
- * LOST_FOCUS TextField/Area lost focus
- * GETS_FOCUS TextField/Area got focus
- * - * GPanel events
- * COLLAPSED Control was collapsed
- * EXPANDED Control was expanded
- * DRAGGED Control is being dragged
- * - * Button control events (PRESSED and RELEASED are not fired by default) - * CLICKED Mouse button was clicked
- * PRESSED Mouse button was pressed
- * RELEASED Mouse button was released
- * - * Slider control events events
- * VALUE_CHANGING Value is changing
- * VALUE_STEADY Value has reached a steady state
- * DRAGGING The mouse is being dragged over a component
- * - * GCheckbox & GOption events
- * SELECTED ( "Option selected
- * DESELECTED ( "Option de-selected
- * - * @author Peter Lager - * - */ -public enum GEvent { - // GTextField and GTextArea events - CHANGED ( "CHANGED", "Text has changed" ), - SELECTION_CHANGED ( "SELECTION_CHANGED", "Text selection has changed" ), - ENTERED ( "ENTERED", "Enter/return key typed" ), - LOST_FOCUS ( "LOST_FOCUS", "TextField/Area lost focus" ), - GETS_FOCUS ( "GETS_FOCUS", "TextField/Area got focus" ), - - - // GPanel events - COLLAPSED ( "COLLAPSED", "Control was collapsed" ), - EXPANDED ( "EXPANDED", "Control was expanded" ), - DRAGGED ( "DRAGGED", "Control is being dragged" ), - - // Button control events (PRESSED and RELEASED are not fired by default) - CLICKED ( "CLICKED", "Mouse button was clicked" ), - PRESSED ( "PRESSED", "Mouse button was pressed" ), - RELEASED ( "RELEASED", "Mouse button was released" ), - - // Slider control events events - VALUE_CHANGING ( "VALUE_CHANGING", "Value is changing" ), - VALUE_STEADY ( "VALUE_STEADY", "Value has reached a steady state" ), - DRAGGING ( "DRAGGING", "The mouse is being dragged over a component"), - - /// GCheckbox & GOption events - SELECTED ( "SELECTED", "Option selected" ), - DESELECTED ( "DESELECTED", "Option de-selected" ); - - - private String type; - private String description; - - private GEvent(String type, String desc ){ - this.type = type; - description = desc; - } - - /** - * Get a textual description of this event - */ - public String getDesc(){ - return description; - } - - /** - * Get the error identifier. - */ - public String getType(){ - return type; - } - - public String toString(){ - return type; - } -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GGroup.java b/Processing/libraries/G4P/src/g4p_controls/GGroup.java deleted file mode 100644 index 6755291..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GGroup.java +++ /dev/null @@ -1,417 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2014 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -import processing.core.PApplet; - -/** - * This class allows you to group GUI controls so that they can be treated as a single - * entity for common GUI actions.
- * Once grouped a single statement change the enabled status, visibility status, colour - * scheme and transparency for all the controls in the group. It is possible to - * specify a delay before the action is executed, and in the case of transparency, specify - * the amount of time the fade occurs.
- * This is particularly useful if your sketch has a number of 'modes' and each mode has its - * own set of G4P controls. Simply create a GGroup object for each mode then as the mode - * changes it is easy to display the controls for the current mode and hide the others.
- * A GGroup is associated with a window (or GWindow) and can only be used with controls - * displayed on that window. - * - * @author Peter Lager - * - */ -public final class GGroup extends GAbstractControl { - // The possible group action types - private static final int INVALID_ACTION = 0; - private static final int ALPHA_TO = 1; - private static final int ENABLE = 2; - private static final int VISIBLE = 3; - private static final int COLOR_SCHEME = 4; - - // Actions still to be processed. - private List actions = new LinkedList(); - - private int cTime, lTime, eTime; - - private int currentAlpha = 255; - private int targetAlpha = 255; - private float alpha = 255; - private float speed = 255; - - /** - * Create a control group for the indicated PApplet. Only controls - * created with this PApplet can be added to this group.
- * - * All controls added will be initialised as fully opaque.
- * - * @param theApplet the associated PApplet - */ - public GGroup(PApplet theApplet) { - this(theApplet, 255); - } - - /** - * Create a control group for the indicated PApplet. Only controls - * created with this PApplet can be added to this group.
- * - * All controls added will be initialised as fully opaque.
- * - * @param theApplet the associated PApplet - * @param startAlpha the starting alpha level (must 0-255 incl) - */ - public GGroup(PApplet theApplet, int startAlpha) { - super(theApplet); - startAlpha &= 0xFF; - currentAlpha = targetAlpha = startAlpha; - children = new LinkedList(); - registeredMethods = PRE_METHOD; - cTime = lTime = eTime = 0; - G4P.registerControl(this); - } - - /** - * Create a control group for the indicated GWindow. Only controls - * displayed in this GWindow can be added to this group.
- * - * All controls added will be initialised as fully opaque.
- * - * @param theWindow the associated GWindow - */ - public GGroup(GWindow theWindow) { - this(theWindow, 255); - } - - /** - * Fade to invisible. (alpha = 0) - * - * @param delay time before starting fade (milli-seconds) - * @param duration time to fade over (milli-seconds) - */ - public void fadeOut(int delay, int duration){ - actions.add(new Action(ALPHA_TO, delay, new Object[] { 0, duration })); - } - - /** - * Fade to fully opaque. (alpha = 255) - * - * @param delay time before starting fade (milli-seconds) - * @param duration time to fade over (milli-seconds) - */ - public void fadeIn(int delay, int duration){ - actions.add(new Action(ALPHA_TO, delay, new Object[] { 255, duration })); - } - - /** - * Fade to an alpha value - * - * @param delay time before starting fade (milli-seconds) - * @param duration time to fade over (milli-seconds) - * @param alpha the target alpha value - */ - public void fadeTo(int delay, int duration, int alpha){ - alpha &= 0xFF; - actions.add(new Action(ALPHA_TO, delay, new Object[] { alpha, duration })); - } - - /** - * Enable / disable the controls. - * @param delay delay time before action is performed (milli-seconds) - */ - public void setEnabled(int delay, boolean enable){ - actions.add(new Action(ENABLE, delay, new Object[] { enable })); - } - - public boolean isFading(){ - return currentAlpha != targetAlpha; - } - - public int timeLeftFading(){ - if(currentAlpha == targetAlpha) - return 0; - // calculate approximate time left - return Math.round((targetAlpha - currentAlpha)/speed); - } - - /** - * Enable / disable the controls immediately. - */ - public void setEnabled(boolean enable){ - setEnabled(0, enable); - } - - /** - * Make the control visible or invisible.
- * If you simply want to change the controls' visibility status then - * use this in preference to fadeIn/fadeOut - * @param delay delay time before action is performed (milli-seconds) - */ - public void setVisible(int delay, boolean visible){ - actions.add(new Action(VISIBLE, delay, new Object[] { visible })); - } - - /** - * Make the control visible or invisible with immediate effect.
- * If you simply want to change the controls' visibility status then - * use this in preference to fadeIn/fadeOut - */ - public void setVisible(boolean visible){ - setEnabled(0, visible); - } - - /** - * Set the color scheme used by these controls with immediate effect.
- * @see GConstants for colour constants (e.g. BLUE_SCHEME) to use. - * - * @param colScheme the colour scheme (0-15) to be used. - */ - public void setLocalColorScheme(int colScheme){ - setLocalColorScheme(0, colScheme); - } - - /** - * Set the color scheme used by these controls after a delay.
- * @see GConstants for colour constants (e.g. BLUE_SCHEME) to use. - * - * @param delay time before colour change (milli-seconds) - * @param colScheme the colour scheme (0-15) to be used. - */ - public void setLocalColorScheme(int delay, int colScheme){ - colScheme &= 0xf; // constrain to 0-15 - actions.add(new Action(COLOR_SCHEME, delay, new Object[] { colScheme })); - } - - public void pre(){ - if(lTime == 0){ // First call to method - cTime = lTime = (int) System.currentTimeMillis(); - return; - } - // Get elapsed time in millis - lTime = cTime; - cTime = (int) System.currentTimeMillis(); - eTime = cTime - lTime; - - if(currentAlpha != targetAlpha) - peformFading(); - if(!actions.isEmpty()) - processActions(); - } - - /** - * Executed - */ - private void peformFading(){ - // Calculate the next alpha and constrain to 0-255 incl. - float nextAlpha = alpha + eTime * speed; - nextAlpha = (nextAlpha < 0) ? 0 : nextAlpha; - nextAlpha = (nextAlpha >255) ? 255 : nextAlpha; - // See if alpha and nextAlpha stradles target - if((alpha - targetAlpha)*(nextAlpha - targetAlpha) <= 0) - currentAlpha = targetAlpha; - else - currentAlpha = (int)nextAlpha; - alphaImpl(currentAlpha); - alpha = nextAlpha; - } - - /* - * Loop through all the actions waiting to be processed reducing the time - * before they need to be implemented. If the action is ready remove it - * from the list and implement it. - */ - private void processActions(){ - Iterator iter = actions.iterator(); - while(iter.hasNext()){ - Action a = iter.next(); - a.delay -= eTime; - if(a.delay <= 0){ - iter.remove(); - switch(a.type){ - case VISIBLE: - visibleImpl(a.bool); - break; - case ENABLE: - enableImpl(a.bool); - break; - case COLOR_SCHEME: - colorImpl(a.target); - break; - case ALPHA_TO: - if(a.duration <= 0) - alphaImpl(a.target); - else { - speed = ((float)(a.target - currentAlpha))/(float) a.duration; - alpha = currentAlpha; - targetAlpha = a.target; - } - break; - } - } - } - } - - private void alphaImpl(int alpha){ - for(GAbstractControl control : children) - control.setAlpha(alpha, true); - } - - private void colorImpl(int col){ - col &= 0xff; // make 0 -15 - for(GAbstractControl control : children) - control.setLocalColorScheme(col, true); - } - - private void enableImpl(boolean enable){ - for(GAbstractControl control : children) - control.setEnabled(enable); - } - - private void visibleImpl(boolean visible){ - for(GAbstractControl control : children) - control.setVisible(visible); - } - - - /** - * Add one or more G4P controls to this group.
- * If a control is not a valid type for group control, or if the control and group are for different - * windows then the control is not added and a warning message is displayed. - * - * @param controls comma separated list of G4P controls to add to this group - */ - public void addControls(GAbstractControl... controls){ - if(controls != null) - for(GAbstractControl control : controls) - addControl(control); - } - - /** - * A single G4P control to add to this group.
- * If a control is not a valid type for group control, or if the control and group are for different - * windows then the control is not added and a warning message is displayed. - * - * @param control a G4P control to add to this group - */ - public void addControl(GAbstractControl control){ - if(control != null){ - if(!control.isSuitableForGroupControl(control)){ - GMessenger.message(INVALID_TYPE, new Object[] { this, control } ); - return; - } - if(this.winApp != control.winApp){ - GMessenger.message(INVALID_PAPPLET, new Object[] { this, control } ); - return; - } - control.setAlpha(currentAlpha, true); - children.add(control); - } - } - - /** - * Remove one or more G4P controls from this group.
- * - * @param controls comma separated list of G4P controls to remove from this group - */ - public void removeControls(GAbstractControl... controls){ - if(controls != null) - for(GAbstractControl control : controls) - removeControl(control); - } - - /** - * Remove a single G4P control from this group.
- * - * @param control a G4P control to remove from this group - */ - public void removeControl(GAbstractControl control){ - if(control != null) - children.remove(control); - } - - - private class Action { - int type; - long delay = 0; - // Extras - int duration = 0; - boolean bool = false; - int target = 0; - - /** - * Create an action - * - * @param type - * @param delay - * @param extra - */ - public Action(int type, long delay, Object... extra) { - super(); - this.type = type; - this.delay = delay; - switch(type){ - case VISIBLE: - case ENABLE: - bool = (Boolean)extra[0]; - break; - case COLOR_SCHEME: - target = (Integer)extra[0]; - break; - case ALPHA_TO: - target = (Integer)extra[0]; - duration = (Integer)extra[1]; - break; - default: - this.type = INVALID_ACTION; - } - } - - public String toString(){ - StringBuilder sb = new StringBuilder(); - switch(type){ - case VISIBLE: - sb.append("VISIBLE "); - break; - case ENABLE: - sb.append("ENABLE "); - break; - case COLOR_SCHEME: - sb.append("COLOR_SCHEME "); - break; - case ALPHA_TO: - sb.append("ALPHA_TO over "); - sb.append(duration + " millis "); - break; - default: - sb.append("INVALID "); - break; - } - return sb.toString(); - } - } - - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GImageButton.java b/Processing/libraries/G4P/src/g4p_controls/GImageButton.java deleted file mode 100644 index 39e975a..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GImageButton.java +++ /dev/null @@ -1,387 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import g4p_controls.HotSpot.HSalpha; -import g4p_controls.HotSpot.HSmask; -import processing.core.PApplet; -import processing.core.PImage; -import processing.event.MouseEvent; - -/** - * Buttons create from this class use a number of images to represent it's - * state. This means that buttons can have an irregular and/or discontinuous - * shape.
- *

Determining the control size

- * If when creating the button you specify a particular width and height then - * any images that are not the same size will be scaled to fit without regard - * to the original size or aspect ratio.
- * - * If when creating the button you do not specify the width and height then it - * will use the width and height of the 'off-button' image and assume that all the - * other images are the same size.
- * - *

The images

- * The image button needs 1 to 3 image files to represent the button states
- * OFF mouse is not over button
- * OVER mouse is over the button
- * DOWN the mouse is over the button and a mouse button is being pressed.
- * - * If you only provide one image then this will be used for all states, if you - * provide two then the second image is used for both OVER and DOWN states.

- * - * If you don't provide a mask file then the button 'hotspot' is represented by any - * non-transparent pixels in the OFF image. If you do provide a mask file then the - * hotspot is defined by any black pixels in the mask image.

- * - * - * Three types of event can be generated :-
- * GEvent.PRESSED GEvent.RELEASED GEvent.CLICKED
- * - * To simplify event handling the button only fires off CLICKED events - * when the mouse button is pressed and released over the button face - * (the default behaviour).
- * - * Using
button1.fireAllEvents(true);
enables the other 2 events - * for button button1. A PRESSED event is created if the mouse button - * is pressed down over the button face, the CLICKED event is then generated - * if the mouse button is released over the button face. Releasing the - * button off the button face creates a RELEASED event.
- * - * - * @author Peter Lager - * - */ -public class GImageButton extends GAbstractControl { - - private static PImage[] errImage = null; - - protected PImage[] bimage = null; - protected PImage mask = null; - - protected int status; - protected boolean reportAllButtonEvents = false; - - - /** - * The control size will be set to the size of the image file used for the button OFF state.
- * There is no alpha mask file.. - * - * @param theApplet - * @param p0 - * @param p1 - * @param fnames an array of up to 3 image filenames to represent the off/over/down state of the button. - */ - public GImageButton(PApplet theApplet, float p0, float p1, String[] fnames) { - this(theApplet, p0, p1, fnames, null); - } - - /** - * The control size will be set to the size of the image file used for the button OFF state.
- * - * @param theApplet - * @param p0 - * @param p1 - * @param fnames an array of up to 3 image filenames to represent the off/over/down state of the button. - * @param fnameMask the alpha mask filename or null if no mask - */ - public GImageButton(PApplet theApplet, float p0, float p1, String[] fnames, String fnameMask) { - super(theApplet, p0, p1); - if(errImage == null) - errImage = ImageManager.loadImage(winApp, new String[] { "err0.png", "err1.png", "err2.png" }); - - //======================================================================== - // First of all load images - // Make sure we have an array of filenames - if(fnames == null || fnames.length == 0) - fnames = new String[] { "err0.png", "err1.png", "err2.png" }; - bimage = ImageManager.loadImage(winApp, fnames); - // There should be 3 images if not use as many as possible, - // duplicating the last one if neccessary - if(bimage.length != 3){ - PImage[] temp = new PImage[3]; - for(int i = 0; i < 3; i++) - temp[i] = bimage[Math.min(i, bimage.length - 1)]; - bimage = temp; - } - // Get mask image if available - if(fnameMask != null) - mask = winApp.loadImage(fnameMask); - //======================================================================== - - - //======================================================================== - // Now decide whether to resize either the images or the button - if(width > 0 && height > 0){ // Resize images - for(int i = 0; i < bimage.length; i++){ - if(bimage[i].width != width || bimage[i].height != height) - bimage[i].resize((int)width, (int)height); - } - if(mask != null && (mask.width != width || mask.height != height)) - mask.resize((int)width, (int)height); - } - else { // resize button - resize(bimage[0].width, bimage[0].height); - } - //======================================================================== - - //======================================================================== - // Setup the hotspaots - if(mask != null){ // if we have a mask use it for the hot spot - hotspots = new HotSpot[]{ - new HSmask(1, mask) - }; - } - else { // no mask then use alpha channel of the OFF image - hotspots = new HotSpot[]{ - new HSalpha(1, 0, 0, bimage[0], PApplet.CORNER) - }; - } - //======================================================================== - - z = Z_SLIPPY; - // Now register control with applet - createEventHandler(G4P.sketchWindow, "handleButtonEvents", - new Class[]{ GImageButton.class, GEvent.class }, - new String[]{ "button", "event" } - ); - registeredMethods = DRAW_METHOD | MOUSE_METHOD; - cursorOver = HAND; - G4P.registerControl(this); - } - - - /** - * Create an image button of the size specified by the parameters.
- * The images will be resized to fit and there is no alpha mask file. - * - * @param theApplet - * @param p0 - * @param p1 - * @param p2 - * @param p3 - * @param fnames an array of up to 3 image filenames to represent the off/over/down state of the button. - */ - public GImageButton(PApplet theApplet, float p0, float p1, float p2, float p3, String[] fnames) { - this(theApplet, p0, p1, p2, p3, fnames, null); - } - - /** - * Create an image button of the size specified by the parameters.
- * The images will be resized to fit. - * - * @param theApplet - * @param p0 - * @param p1 - * @param p2 - * @param p3 - * @param fnames an array of up to 3 image filenames to represent the off/over/down state of the button. - * @param fnameMask the alpha mask filename or null if no mask - */ - public GImageButton(PApplet theApplet, float p0, float p1, float p2, float p3, String[] fnames, String fnameMask) { - super(theApplet, p0, p1, p2, p3); - if(errImage == null) - errImage = ImageManager.loadImage(winApp, new String[] { "err0.png", "err1.png", "err2.png" }); - - //======================================================================== - // First of all load images - // Make sure we have an array of filenames - if(fnames == null || fnames.length == 0) - fnames = new String[] { "err0.png", "err1.png", "err2.png" }; - bimage = ImageManager.loadImage(winApp, fnames); - // There should be 3 images if not use as many as possible, - // duplicating the last one if neccessary - if(bimage.length != 3){ - PImage[] temp = new PImage[3]; - for(int i = 0; i < 3; i++) - temp[i] = bimage[Math.min(i, bimage.length - 1)]; - bimage = temp; - } - // Get mask image if available - if(fnameMask != null) - mask = winApp.loadImage(fnameMask); - //======================================================================== - - - //======================================================================== - // Now decide whether to resize either the images or the button - if(width > 0 && height > 0){ // Resize images - for(int i = 0; i < bimage.length; i++){ - if(bimage[i].width != width || bimage[i].height != height) - bimage[i].resize((int)width, (int)height); - } - if(mask != null && (mask.width != width || mask.height != height)) - mask.resize((int)width, (int)height); - } - else { // resize button - resize(bimage[0].width, bimage[0].height); - } - //======================================================================== - - //======================================================================== - // Setup the hotspaots - if(mask != null){ // if we have a mask use it for the hot spot - hotspots = new HotSpot[]{ - new HSmask(1, mask) - }; - } - else { // no mask then use alpha channel of the OFF image - hotspots = new HotSpot[]{ - new HSalpha(1, 0, 0, bimage[0], PApplet.CORNER) - }; - } - //======================================================================== - - z = Z_SLIPPY; - // Now register control with applet - createEventHandler(G4P.sketchWindow, "handleButtonEvents", - new Class[]{ GImageButton.class, GEvent.class }, - new String[]{ "button", "event" } - ); - registeredMethods = DRAW_METHOD | MOUSE_METHOD; - cursorOver = HAND; - G4P.registerControl(this); - } - - - public void draw(){ - if(!visible) return; - - // Update buffer if invalid - //updateBuffer(); - winApp.pushStyle(); - - winApp.pushMatrix(); - // Perform the rotation - winApp.translate(cx, cy); - winApp.rotate(rotAngle); - // Move matrix to line up with top-left corner - winApp.translate(-halfWidth, -halfHeight); - // Draw buffer - winApp.imageMode(PApplet.CORNER); - if(alphaLevel < 255) - winApp.tint(TINT_FOR_ALPHA, alphaLevel); - winApp.image(bimage[status], 0, 0); - winApp.popMatrix(); - winApp.popStyle(); - } - - /** - * - * When a mouse button is clicked on a GImageButton it generates the GEvent.CLICKED event. If - * you also want the button to generate GEvent.PRESSED and GEvent.RELEASED events - * then you need the following statement.
- *
btnName.fireAllEvents(true); 

- * - *
-	 * void handleButtonEvents(void handleButtonEvents(GImageButton button, GEvent event) {
-	 *	  if(button == btnName && event == GEvent.CLICKED){
-	 *        // code for button click event
-	 *    }
-	 * 

- * Where
btnName
is the GImageButton identifier (variable name)

- * - */ - public void mouseEvent(MouseEvent event){ - if(!visible || !enabled || !available) return; - - calcTransformedOrigin(winApp.mouseX, winApp.mouseY); - currSpot = whichHotSpot(ox, oy); - if(currSpot >= 0 || focusIsWith == this) - cursorIsOver = this; - else if(cursorIsOver == this) - cursorIsOver = null; - - switch(event.getAction()){ - case MouseEvent.PRESS: - if(focusIsWith != this && currSpot >= 0 && z > focusObjectZ()){ - dragging = false; - status = PRESS_CONTROL; - takeFocus(); - if(reportAllButtonEvents) - fireEvent(this, GEvent.PRESSED); - } - break; - case MouseEvent.CLICK: - // No need to test for isOver() since if the component has focus - // and the mouse has not moved since MOUSE_PRESSED otherwise we - // would not get the Java MouseEvent.MOUSE_CLICKED event - if(focusIsWith == this){ - status = OFF_CONTROL; - loseFocus(null); - dragging = false; - fireEvent(this, GEvent.CLICKED); - } - break; - case MouseEvent.RELEASE: - // if the mouse has moved then release focus otherwise - // MOUSE_CLICKED will handle it - if(focusIsWith == this && dragging){ - if(currSpot >= 0) - fireEvent(this, GEvent.CLICKED); - else { - if(reportAllButtonEvents){ - fireEvent(this, GEvent.RELEASED); - } - } - dragging = false; - loseFocus(null); - status = OFF_CONTROL; - } - break; - case MouseEvent.MOVE: - // If dragged state will stay as PRESSED - if(currSpot >= 0) - status = OVER_CONTROL; - else - status = OFF_CONTROL; - break; - case MouseEvent.DRAG: - dragging = (focusIsWith == this); - break; - } - } - - /** - * If the parameter is true all 3 event types are generated, if false - * only CLICKED events are generated (default behaviour). - * @param all - */ - public void fireAllEvents(boolean all){ - reportAllButtonEvents = all; - } - - /** - * Enable or disable the ability of the component to generate mouse events.
- * If the control is to be disabled when it is clicked then this will force the - * mouse off button image is used. - * @param enable true to enable else false - */ - public void setEnabled(boolean enable){ - super.setEnabled(enable); - if(!enable) - status = OFF_CONTROL; - } - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GImageToggleButton.java b/Processing/libraries/G4P/src/g4p_controls/GImageToggleButton.java deleted file mode 100644 index 764eb62..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GImageToggleButton.java +++ /dev/null @@ -1,360 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import g4p_controls.HotSpot.HSalpha; -import processing.core.PApplet; -import processing.core.PImage; -import processing.event.MouseEvent; - -/** - * Buttons created from this class have 2 or more toggle states. If the number of states - * is N then the button's value will be in the range 0 to N-1. Most toggle buttons will - * have just two states and these have values 0 and 1.
- * Clicking on the button advances the state by one, restarting at zero after the last - * state.
- * Each state must have its own 'picture' and the user must supply these as a tiled image - * where the pictures are tiled in 1D or 2D arrangement without 'empty space' around the - * tiles.
- * If for any reason the library is unable to use the specified graphics then it will - * provide a default two state toggle switch.
- * It is also possible to provide an over-button image set for when the mouse moves - * over the button - this is optional.
- * The button control will always be resized to suit the state picture size (tile size).
- * The mouse is considered to be over the button it its position is over an opaque pixel - * in the state picture. Since transparent pixels are not included then the button shape - * can be different for each state.
- * - * - * - * Three types of event can be generated :-
- * GEvent.PRESSED GEvent.RELEASED GEvent.CLICKED
- * - * To simplify event handling the button only fires off CLICKED events - * when the mouse button is pressed and released over the button face - * (the default behaviour).
- * - * Using
button1.fireAllEvents(true);
enables the other 2 events - * for button button1. A PRESSED event is created if the mouse button - * is pressed down over the button face, the CLICKED event is then generated - * if the mouse button is released over the button face. Releasing the - * button off the button face creates a RELEASED event. This is included for - * completeness since it is unlikely you will need to detect these events - * for this type of control.
- * - * - * @author Peter Lager - * - */ -public class GImageToggleButton extends GAbstractControl { - - private static PImage toggle = null; - private static final String TOGGLE = "toggle.png"; - - protected int nbrStates = 2; - protected int stateValue = 0; - - protected PImage[] offImage; - protected PImage[] overImage; - - protected int status; - protected boolean reportAllButtonEvents = false; - - - /** - * Create the library default image-toggle-button at the stated position.
- * - * @param theApplet - * @param p0 horizontal position of the control - * @param p1 vertical position of the control - */ - public GImageToggleButton(PApplet theApplet, float p0, float p1){ - this(theApplet, p0, p1, null, null, 1, 1); - } - - /** - * Create an image-toggle-button.
- * Single row of tiles. - * - * @param theApplet - * @param p0 horizontal position of the control - * @param p1 vertical position of the control - * @param offPicture the filename of bitmap containing toggle state pictures - * @param nbrCols number of tiles horizontally - */ - public GImageToggleButton(PApplet theApplet, float p0, float p1, String offPicture, int nbrCols){ - this(theApplet, p0, p1, offPicture, null, nbrCols, 1); - } - - /** - * Create an image-toggle-button.
- * - * @param theApplet - * @param p0 horizontal position of the control - * @param p1 vertical position of the control - * @param offPicture the filename of bitmap containing toggle state pictures - * @param nbrCols number of tiles horizontally - * @param nbrRows number of tiles vertically - */ - public GImageToggleButton(PApplet theApplet, float p0, float p1, String offPicture, int nbrCols, int nbrRows){ - this(theApplet, p0, p1, offPicture, null, nbrCols, nbrRows); - } - - /** - * Create an image-toggle-button.
- * Single row of tiles. - * - * @param theApplet - * @param p0 horizontal position of the control - * @param p1 vertical position of the control - * @param offPicture the filename of bitmap containing toggle state pictures - * @param overPicture the filename of bitmap containing mouse-over button toggle state pictures - * @param nbrCols number of tiles horizontally - */ - public GImageToggleButton(PApplet theApplet, float p0, float p1, String offPicture, String overPicture, int nbrCols){ - this(theApplet, p0, p1, offPicture, overPicture, nbrCols, 1); - } - - /** - * Create an image-toggle-button.
- * - * @param theApplet - * @param p0 horizontal position of the control - * @param p1 vertical position of the control - * @param offPicture the filename of bitmap containing toggle state pictures - * @param overPicture the filename of bitmap containing mouse-over button toggle state pictures - * @param nbrCols number of tiles horizontally - * @param nbrRows number of tiles vertically - */ - public GImageToggleButton(PApplet theApplet, float p0, float p1, String offPicture, String overPicture, int nbrCols, int nbrRows){ - super(theApplet, p0, p1); - // Attempt to get off-control image data - PImage temp = null; - if(nbrCols < 1 || nbrRows < 1 || offPicture == null || null == (temp = ImageManager.loadImage(winApp, offPicture))){ - // Invalid data use default - nbrStates = 2; - if(toggle == null) - toggle = ImageManager.loadImage(winApp, TOGGLE); - offImage = ImageManager.makeTiles1D(winApp, toggle, 2, 1); - } - else { - // Off-control image data valid - nbrStates = nbrCols * nbrRows; - offImage = ImageManager.makeTiles1D(winApp, temp, nbrCols, nbrRows); - // Now check for over-control image data - if(overPicture != null && null != (temp = ImageManager.loadImage(winApp, overPicture))){ - overImage = ImageManager.makeTiles1D(winApp, temp, nbrCols, nbrRows); - } - } - // The control will always be resized to match the image size - resize(offImage[0].width, offImage[0].height); - - //======================================================================== - // Setup the hotspots - hotspots = new HotSpot[]{ - new HSalpha(1, 0, 0, offImage[stateValue], PApplet.CORNER) - }; - - //======================================================================== - - z = Z_SLIPPY; - // Now register control with applet - createEventHandler(G4P.sketchWindow, "handleToggleButtonEvents", - new Class[]{ GImageToggleButton.class, GEvent.class }, - new String[]{ "button", "event" } - ); - registeredMethods = DRAW_METHOD | MOUSE_METHOD; - cursorOver = HAND; - G4P.registerControl(this); - } - - public void draw(){ - if(!visible) return; - - winApp.pushStyle(); - winApp.pushMatrix(); - // Perform the rotation - winApp.translate(cx, cy); - winApp.rotate(rotAngle); - // Move matrix to line up with top-left corner - winApp.translate(-halfWidth, -halfHeight); - // Draw buffer - winApp.imageMode(PApplet.CORNER); - if(alphaLevel < 255) - winApp.tint(TINT_FOR_ALPHA, alphaLevel); - if(status == OVER_CONTROL && overImage != null) - winApp.image(overImage[stateValue], 0, 0); - else - winApp.image(offImage[stateValue], 0, 0); - - winApp.popMatrix(); - winApp.popStyle(); - } - - - /** - * - * When a mouse button is clicked on a GImageToggleButton it generates the GEvent.CLICKED event. If - * you also want the button to generate GEvent.PRESSED and GEvent.RELEASED events - * then you need the following statement.
- *
btnName.fireAllEvents(true); 

- *
-	 * void handleButtonEvents(void handleToggleButtonEvents(GImageToggleButton button, GEvent event) {
-	 *	  if(button == btnName && event == GEvent.CLICKED){
-	 *        int buttonState = btnName.stateValue();
-	 *    }
-	 * 

- * Where
btnName
is the GImageToggleButton identifier (variable name)

- * - */ - public void mouseEvent(MouseEvent event){ - if(!visible || !enabled || !available) return; - - calcTransformedOrigin(winApp.mouseX, winApp.mouseY); - currSpot = whichHotSpot(ox, oy); - if(currSpot >= 0 || focusIsWith == this) - cursorIsOver = this; - else if(cursorIsOver == this) - cursorIsOver = null; - - switch(event.getAction()){ - case MouseEvent.PRESS: - if(focusIsWith != this && currSpot >= 0 && z > focusObjectZ()){ - dragging = false; - status = PRESS_CONTROL; - takeFocus(); - if(reportAllButtonEvents) - fireEvent(this, GEvent.PRESSED); - } - break; - case MouseEvent.CLICK: - // No need to test for isOver() since if the component has focus - // and the mouse has not moved since MOUSE_PRESSED otherwise we - // would not get the Java MouseEvent.MOUSE_CLICKED event - if(focusIsWith == this){ - status = OFF_CONTROL; - loseFocus(null); - dragging = false; - nextState(); - fireEvent(this, GEvent.CLICKED); - } - break; - case MouseEvent.RELEASE: - // if the mouse has moved then release focus otherwise - // MOUSE_CLICKED will handle it - if(focusIsWith == this && dragging){ - if(currSpot >= 0){ - nextState(); - fireEvent(this, GEvent.CLICKED); - } - else { - if(reportAllButtonEvents){ - fireEvent(this, GEvent.RELEASED); - } - } - dragging = false; - loseFocus(null); - status = OFF_CONTROL; - } - break; - case MouseEvent.MOVE: - // If dragged state will stay as PRESSED - if(currSpot >= 0) - status = OVER_CONTROL; - else - status = OFF_CONTROL; - break; - case MouseEvent.DRAG: - dragging = (focusIsWith == this); - break; - } - } - - /** - * Advance to the next state and adjust the hotspot to use the current image - */ - private void nextState(){ - stateValue++; - stateValue %= nbrStates; - hotspots[0].adjust(0,0,offImage[stateValue]); - } - - /** - * Get the current state value of the button. - * @deprecated use getState() - */ - @Deprecated - public int stateValue(){ - return stateValue; - } - - /** - * Get the current state value of the button. - */ - public int getState(){ - return stateValue; - } - - /** - * Change the current toggle state.
- * If the parameter is not a valid toggle state value then it - * is ignored and the button's state value is unchanged. - * @deprecated use setState(int) - * @param newState - */ - @Deprecated - public void stateValue(int newState){ - if(newState >= 0 && newState < nbrStates && newState != stateValue){ - stateValue = newState; - hotspots[0].adjust(0,0,offImage[stateValue]); - bufferInvalid = true; - } - } - - /** - * Change the current toggle state.
- * If the parameter is not a valid toggle state value then it - * is ignored and the button's state value is unchanged. - * @param newState - */ - public void setState(int newState){ - if(newState >= 0 && newState < nbrStates && newState != stateValue){ - stateValue = newState; - hotspots[0].adjust(0,0,offImage[stateValue]); - bufferInvalid = true; - } - } - - /** - * If the parameter is true all 3 event types are generated, if false - * only CLICKED events are generated (default behaviour).
- * For this toggle control I can't see the need for anything but - * CLICKED events - * @param all - */ - public void fireAllEvents(boolean all){ - reportAllButtonEvents = all; - } - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GKnob.java b/Processing/libraries/G4P/src/g4p_controls/GKnob.java deleted file mode 100644 index f4329f2..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GKnob.java +++ /dev/null @@ -1,571 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import g4p_controls.HotSpot.HSarc; -import g4p_controls.HotSpot.HScircle; -import processing.core.PApplet; -import processing.event.MouseEvent; - - -/** - * The provides an extremely configurable GUI knob controller. GKnob - * inherits from GValueControl so you should read the documentation - * for that class as it also applies to GKnob.

- * - * Configurable options
- * Knob size but it must be circular
- * Start and end of rotation arc.
- * Bezel width with tick marks
- * User defined value limits (i.e. the range of values returned
- *
- * Range of values associated with rotating the knob
- * Rotation is controlled by mouse movement - 3 modes available
- * (a) angular - drag round knob center
- * (b) horizontal - drag left or right
- * (c) vertical - drag up or down
- * User can specify mouse sensitivity for modes (b) and (c) - * Use can specify easing to give smoother rotation - * - * Note: Angles are measured clockwise starting in the positive x direction i.e. - *
- *         270
- *          |
- *    180 --+-- 0
- *          |
- *          90
- * 
- * - * @author Peter Lager - * - */ -public class GKnob extends GValueControl { - - - protected float startAng = 110, endAng = 70; - - protected int mode = CTRL_HORIZONTAL; - - protected boolean showTrack = true; - - protected float bezelRadius, bezelWidth, gripRadius; - protected boolean overIncludesBezel = true; - protected float sensitivity = 1.0f; - - protected boolean drawArcOnly = false; - protected boolean mouseOverArcOnly = false; - - protected float startMouseX, startMouseY; - protected float lastMouseAngle, mouseAngle; - - // corresponds to target and current values - // parametricTarget - protected float angleTarget, lastAngleTarget; - - /** - * Will create the a circular knob control that fits the rectangle define by - * the values passed as parameters.
- * The knob has two zones the outer bezel and the inner gripper. The radius of - * the outer bezel is calculated from
- *
bezel radius = min(width, height)/2 - 2

- * The radius of the inner griper radius is calculated from the bezel radius - * and the last parameter.
- *
grip radius = bezel radiius * gripAmount 

- * The gripAmount should be in te range 0.0 to 1.0 inclusive. The actual value - * will be constrained to that range.
- * - * @param theApplet - * @param p0 - * @param p1 - * @param p2 - * @param p3 - * @param gripAmount must be >=0.0 and <=1.0 - */ - public GKnob(PApplet theApplet, float p0, float p1, float p2, float p3, float gripAmount) { - super(theApplet, p0, p1, p2, p3); - bezelRadius = Math.min(width, height) / 2 - 2; - setGripAmount(gripAmount); - setTurnRange(startAng, endAng); - // valuePos and valueTarget will start at 0.5; - lastAngleTarget = angleTarget = scaleValueToAngle(parametricTarget); - hotspots = new HotSpot[]{ - new HScircle(1, width/2, height/2, gripRadius) - }; - z = Z_SLIPPY; - - epsilon = 0.98f / (endAng - startAng); - showTicks = true; - - // Now register control with applet - createEventHandler(G4P.sketchWindow, "handleKnobEvents", - new Class[]{ GValueControl.class, GEvent.class }, - new String[]{ "knob", "event" } - ); - registeredMethods = PRE_METHOD | DRAW_METHOD | MOUSE_METHOD ; - cursorOver = HAND; - G4P.registerControl(this); - } - - /** - * The radius of the inner griper radius is calculated from the bezel radius - * and the parameter gripAmount using
- *
grip radius = bezel radiius * gripAmount 

- * The gripAmount should be in te range 0.0 to 1.0 inclusive. The actual value - * will be constrained to that range.
- * - * @param gripAmount must be >=0.0 and <=1.0 - */ - public void setGripAmount(float gripAmount){ - gripAmount = PApplet.constrain(gripAmount, 0.0f, 1.0f); - gripRadius = bezelRadius * gripAmount; - if(gripRadius < 2.0f) gripRadius = 0.0f; - bezelWidth = bezelRadius - gripRadius; - bufferInvalid = true; - } - - protected void calculateHotSpot(){ - float overRad = (this.overIncludesBezel) ? bezelRadius : gripRadius; - if(mouseOverArcOnly) - hotspots[0] = new HSarc(1, width/2 , height/2, overRad, startAng, endAng); // over grip - else - hotspots[0] = new HScircle(1, width/2, height/2, overRad); - } - - /** - * For a particular normalised value calculate the angle (degrees) - * - * @param v - * @return the needle angle for the given value - */ - protected float scaleValueToAngle(float v){ - float a = startAng + v * (endAng - startAng); - return a; - } - - /** - * Calculates the knob angle based on the normalised value. - * - * @param a - */ - protected float calcAngletoValue(float a){ - if(a < startAng) - a += 360; - float v = (a - startAng) / (endAng - startAng); - return v; - } - - /** - * Set the value for the slider.
- * The user must ensure that the value is valid for the slider range. - * @param v - */ - public void setValue(float v){ - super.setValue(v); - angleTarget = scaleValueToAngle(parametricTarget); - } - - /** - * Whether or not to show the circular progress bar. - * @param showTrack true for visible - */ - public void setShowTrack(boolean showTrack){ - if(this.showTrack != showTrack){ - this.showTrack = showTrack; - bufferInvalid = true; - } - } - - /** - * Are we showing the the value track bar. - */ - public boolean isShowTrack(){ - return showTrack; - } - - /** - * Whether to include the bezel when deciding when the mouse is over. - * @param overBezel true if bezel inclded. - */ - public void setIncludeOverBezel(boolean overBezel){ - overIncludesBezel = overBezel; - calculateHotSpot(); - } - - /** - * Is the bezel included when considering when the mouse is over. - * @return true if included. - */ - public boolean isIncludeOverBezel(){ - return overIncludesBezel; - } - - /** - * Decides when the knob will respond to the mouse buttons. If set to true - * it will only respond when ver the arc made by the start and end angles. If - * false it will be the full circle. - * @param arcOnly - */ - public void setOverArcOnly(boolean arcOnly){ - mouseOverArcOnly = arcOnly; - calculateHotSpot(); - } - - /** - * Does the mouse only respond when over the arc? - * @return true = yes - */ - public boolean isOverArcOnly(){ - return mouseOverArcOnly; - } - - /** - * Convenience method to set both the show and the mouse over arc only properties - * for this knob - * @param over_arc_only mouse over arc only? - * @param draw_arc_only draw arc only? - * @param overfullsize include bezel in mouse over calculations? - */ - public void setArcPolicy(boolean over_arc_only, boolean draw_arc_only, boolean overfullsize){ - this.mouseOverArcOnly = over_arc_only; - setShowArcOnly(draw_arc_only); - overIncludesBezel = overfullsize; - calculateHotSpot(); - } - - /** - * This will decide whether the knob is draw as a full circle or as an arc. - * - * @param arcOnly true for arc only - */ - public void setShowArcOnly(boolean arcOnly){ - if(drawArcOnly != arcOnly){ - drawArcOnly = arcOnly; - bufferInvalid = true; - } - } - - /** - * Are we showing arc only? - * @return true = yes - */ - public boolean isShowArcOnly(){ - return drawArcOnly; - } - - public void mouseEvent(MouseEvent event){ - if(!visible || !enabled || !available) return; - - calcTransformedOrigin(winApp.mouseX, winApp.mouseY); - currSpot = whichHotSpot(ox, oy); - // Normalise ox and oy to the centre of the knob - ox -= width/2; - oy -= height/2; - - // currSpot == 1 for text display area - if(currSpot >= 0 || focusIsWith == this) - cursorIsOver = this; - else if(cursorIsOver == this) - cursorIsOver = null; - - switch(event.getAction()){ - case MouseEvent.PRESS: - if(focusIsWith != this && currSpot > -1 && z > focusObjectZ()){ - startMouseX = ox; - startMouseY = oy; - lastMouseAngle = mouseAngle = getAngleFromUser(ox, oy); - offset = scaleValueToAngle(parametricTarget) - mouseAngle; - takeFocus(); - } - break; - case MouseEvent.WHEEL: - if(currSpot > -1 && z >= focusObjectZ()){ - System.out.print(tag + " " + parametricTarget + " " + event.getCount() + " " + wheelDelta + " >>> "); - parametricTarget = calcParametricTarget(parametricTarget + event.getCount() * wheelDelta * G4P.wheelForSlider); - System.out.println(parametricTarget); - } - break; - case MouseEvent.RELEASE: - if(focusIsWith == this){ - loseFocus(null); - } - // Correct for sticky ticks if needed - if(stickToTicks) - parametricTarget = findNearestTickValueTo(parametricTarget); - dragging = false; - break; - case MouseEvent.DRAG: - if(focusIsWith == this){ - mouseAngle = getAngleFromUser(ox, oy); - if(mouseAngle != lastMouseAngle){ - float deltaMangle = mouseAngle - lastMouseAngle; - // correct when we go over zero degree position - if(deltaMangle < -180) - deltaMangle += 360; - else if(deltaMangle > 180) - deltaMangle -= 360; - // Calculate and adjust new needle angle so it is in the range aLow >>> aHigh - angleTarget = constrainToTurnRange(angleTarget + deltaMangle); - parametricTarget = calcAngletoValue(angleTarget); - // Update offset for use with angular mouse control - offset += (angleTarget - lastAngleTarget - deltaMangle); - // Remember target needle and mouse angles - lastAngleTarget = angleTarget; - lastMouseAngle = mouseAngle; - } - } - break; - } - } - - - public void draw(){ - if(!visible) return; - // Update buffer if invalid - updateBuffer(); - winApp.pushStyle(); - - winApp.pushMatrix(); - // Perform the rotation - winApp.translate(cx, cy); - winApp.rotate(rotAngle); - winApp.pushMatrix(); - // Move matrix to line up with top-left corner - winApp.translate(-halfWidth, -halfHeight); - // Draw buffer - winApp.imageMode(PApplet.CORNER); - if(alphaLevel < 255) - winApp.tint(TINT_FOR_ALPHA, alphaLevel); - winApp.image(buffer, 0, 0); - winApp.popMatrix(); - // Value labels - if(children != null){ - for(GAbstractControl c : children) - c.draw(); - } - winApp.popMatrix(); - - winApp.popStyle(); - } - - protected void updateBuffer(){ - double a, sina, cosa; - float tickLength; - if(bufferInvalid) { - bufferInvalid = false; - buffer.beginDraw(); - buffer.ellipseMode(PApplet.CENTER); - // Background colour - if(opaque == true) - buffer.background(palette[6].getRGB()); - else - buffer.background(buffer.color(255,0)); - buffer.translate(width/2, height/2); - buffer.noStroke(); - float anglePos = scaleValueToAngle(parametricPos); - if(bezelWidth > 0){ - // Draw bezel - buffer.noStroke(); - buffer.fill(palette[5].getRGB()); - if(drawArcOnly) - buffer.arc(0,0,2*bezelRadius, 2*bezelRadius, PApplet.radians(startAng), PApplet.radians(endAng)); - else - buffer.ellipse(0,0,2*bezelRadius, 2*bezelRadius); - // Draw ticks? - if(showTicks){ - buffer.noFill(); - buffer.strokeWeight(1.6f); - buffer.stroke(palette[3].getRGB()); - float deltaA = (endAng - startAng)/(nbrTicks - 1); - for(int t = 0; t < nbrTicks; t++){ - tickLength = gripRadius + ((t == 0 || t == nbrTicks - 1) ? bezelWidth : bezelWidth * 0.8f); - a = Math.toRadians(startAng + t * deltaA); - sina = Math.sin(a); - cosa = Math.cos(a); - buffer.line((float)(gripRadius * cosa), (float)(gripRadius * sina), (float)(tickLength * cosa), (float)(tickLength * sina)); - } - } - // Draw track? - if(showTrack){ - buffer.noStroke(); - buffer.fill(palette[14].getRGB()); - buffer.arc(0,0, 2*(gripRadius + bezelWidth * 0.5f), 2*(gripRadius + bezelWidth * 0.5f), PApplet.radians(startAng), PApplet.radians(anglePos)); - } - } - - // draw grip (inner) part of knob - buffer.strokeWeight(1.6f); - buffer.stroke(palette[2].getRGB()); // was 14 - buffer.fill(palette[2].getRGB()); - if(drawArcOnly) - buffer.arc(0,0,2*gripRadius, 2*gripRadius, PApplet.radians(startAng), PApplet.radians(endAng)); - else - buffer.ellipse(0,0,2*gripRadius, 2*gripRadius); - - // Draw needle - buffer.noFill(); - buffer.stroke(palette[14].getRGB()); - buffer.strokeWeight(3); - a = Math.toRadians(anglePos); - sina = Math.sin(a); - cosa = Math.cos(a); - buffer.line(0, 0, (float)(gripRadius * cosa), (float)(gripRadius * sina)); - buffer.endDraw(); - } - } - - - /** - * Get the current mouse controller mode possible values are
- * GKnob.CTRL_ANGULAR or GKnob.CTRL_HORIZONTAL) orGKnob.CTRL_VERTICAL - * @return the mode - */ - public int getTurnMode() { - return mode; - } - - /** - * Set the mouse control mode to use, acceptable values are
- * GKnob.CTRL_ANGULAR or GKnob.CTRL_HORIZONTAL) orGKnob.CTRL_VERTICAL any - * other value will be ignored. - * @param mode the mode to set - */ - public void setTurnMode(int mode) { - switch(mode){ - case CTRL_ANGULAR: - case CTRL_HORIZONTAL: - case CTRL_VERTICAL: - this.mode = mode; - } - } - - /** - * This gets the sensitivity to be used in modes CTRL_HORIZONTAL and CTRL_VERTICAL - * @return the sensitivity - */ - public float getSensitivity() { - return sensitivity; - } - - /** - * This gets the sensitivity to be used in modes CTRL_HORIZONTAL and CTRL_VERTICAL
- * A value of 1 is 1 degree per pixel and a value of 2 is 2 degrees per pixel.
- * @param sensitivity the sensitivity to set - */ - public void setSensitivity(float sensitivity) { - this.sensitivity = (sensitivity < 0.1f) ? 0.1f : sensitivity; - } - - /** - * Calculates the 'angle' from the current mouse position based on the type - * of 'controller' set. - * @param px the distance from the knob centre in the x direction - * @param py the distance from the knob centre in the y direction - * @return the unconstrained angle - */ - protected float getAngleFromUser(float px, float py){ - float degs = 0; - switch(mode){ - case CTRL_ANGULAR: - degs = calcRealAngleFromXY(ox, oy); - break; - case CTRL_HORIZONTAL: - degs = sensitivity * (px - startMouseX); - break; - case CTRL_VERTICAL: - degs = sensitivity * (py - startMouseY); - break; - } - return degs; - } - - /** - * Set the limits for the range of valid rotation angles for the knob. - * - * @param start the range start angle in degrees - * @param end the range end angle in degrees - */ - public void setTurnRange(float start, float end){ - start = constrain360(start); - end = constrain360(end); - startAng = start; - endAng = (startAng >= end) ? end + 360 : end; - setValue(getValueF()); -// anglePos = angleTarget; - bufferInvalid = true; - } - - /** - * Determines whether an angle is within the knob - * rotation range. - * @param a the angle in degrees - * @return true is angle is within rotation range else false - */ - protected boolean isInTurnRange(float a){ - a = constrain360(a); - if(a < startAng) - a += 360; - return (a >= startAng && a <= endAng); - } - - /** - * Accept an angle and constrain it to the knob angle range. - * - * @param a - * @return the constrained angle - */ - protected float constrainToTurnRange(float a){ - if(a < startAng) - a = startAng; - else if(a > endAng) - a = endAng; - return a; - } - - /** - * Accept an angle and constrain it to the range 0-360 - * @param a - * @return the constrained angle - */ - protected float constrain360(float a){ - while(a < 0) - a += 360; - while(a > 360) - a -= 360; - return a; - } - - /** - * Calculate the angle to the knob centre making sure it is in - * the range 0-360 - * @param px - * @param py - * @return the angle from the knob centre to the specified point. - */ - protected float calcRealAngleFromXY(float px, float py){ - float a = (float) Math.toDegrees(Math.atan2(py, px)); - if(a < 0) - a += 360; - return a; - } -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GLabel.java b/Processing/libraries/G4P/src/g4p_controls/GLabel.java deleted file mode 100644 index 263de59..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GLabel.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import g4p_controls.StyledString.TextLayoutInfo; - -import java.awt.Graphics2D; -import java.awt.font.TextLayout; -import java.util.LinkedList; - -import processing.core.PApplet; - -/** - * The label component. - * - * This control can display text with/without an icon. - * - * @author Peter Lager - * - */ -public class GLabel extends GTextIconAlignBase { - - public GLabel(PApplet theApplet, float p0, float p1, float p2, float p3) { - this(theApplet, p0, p1, p2, p3, " "); - } - - /** - * Create a label control. - * - * use setIcon to add an icon - * - * @param theApplet - * @param p0 - * @param p1 - * @param p2 - * @param p3 - * @param text - */ - public GLabel(PApplet theApplet, float p0, float p1, float p2, float p3, String text) { - super(theApplet, p0, p1, p2, p3); - setText(text); - opaque = false; - // Now register control with applet - registeredMethods = DRAW_METHOD; - // Must register control - G4P.registerControl(this); - } - - public void draw(){ - if(!visible) return; - - // Update buffer if invalid - updateBuffer(); - winApp.pushStyle(); - - winApp.pushMatrix(); - // Perform the rotation - winApp.translate(cx, cy); - winApp.rotate(rotAngle); - // Move matrix to line up with top-left corner - winApp.translate(-halfWidth, -halfHeight); - // Draw buffer - winApp.imageMode(PApplet.CORNER); - if(alphaLevel < 255) - winApp.tint(TINT_FOR_ALPHA, alphaLevel); - winApp.image(buffer, 0, 0); - winApp.popMatrix(); - - winApp.popStyle(); - } - - protected void updateBuffer(){ - if(bufferInvalid) { - bufferInvalid = false; - buffer.beginDraw(); - Graphics2D g2d = buffer.g2; - g2d.setFont(localFont); - - // Get the latest lines of text - LinkedList lines = stext.getLines(g2d); - // Back ground colour - buffer.background(opaque ? palette[6].getRGB() : palette[2].getRGB() & 0xFFFFFF); - // Calculate text and icon placement - calcAlignment(); - // If there is an icon draw it - if(iconW != 0) - buffer.image(bicon[0], siX, siY); - float wrapWidth = stext.getWrapWidth(); - float sx = 0, tw = 0; - buffer.translate(stX, stY); - for(TextLayoutInfo lineInfo : lines){ - TextLayout layout = lineInfo.layout; - buffer.translate(0, layout.getAscent()); - switch(textAlignH){ - case CENTER: - tw = layout.getVisibleAdvance(); - tw = (tw > wrapWidth) ? tw - wrapWidth : tw; - sx = (wrapWidth - tw)/2; - break; - case RIGHT: - tw = layout.getVisibleAdvance(); - tw = (tw > wrapWidth) ? tw - wrapWidth : tw; - sx = wrapWidth - tw; - break; - case LEFT: - case JUSTIFY: - default: - sx = 0; - } - // display text - g2d.setColor(palette[2]); - lineInfo.layout.draw(g2d, sx, 0); - buffer.translate(0, layout.getDescent() + layout.getLeading()); - } - buffer.endDraw(); - } - } - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GLinearTrackControl.java b/Processing/libraries/G4P/src/g4p_controls/GLinearTrackControl.java deleted file mode 100644 index 1c41dc5..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GLinearTrackControl.java +++ /dev/null @@ -1,431 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import java.awt.Font; -import java.awt.Graphics2D; -import java.awt.font.TextLayout; - -import processing.core.PApplet; -import processing.event.MouseEvent; - -/** - * Base class for linear sliders. - * - * This class provides the ability to control the orientation - * the text should be displayed. It also enables the use of labels - * for each tick mark. - * - * @author Peter Lager - * - */ -public abstract class GLinearTrackControl extends GValueControl { - - static protected float TINSET = 2; - - static protected int THUMB_SPOT = 1; - static protected int TRACK_SPOT = 2; - - protected float trackWidth, trackLength, trackDisplayLength; - protected float trackOffset; - - protected int textOrientation = ORIENT_TRACK; - - protected int downHotSpot = -1; - // Mouse over status - protected int status = OFF_CONTROL; - - // For labels - protected StyledString[] labels; - protected boolean labelsInvalid = true; - - // Introduced 4.0.2 - protected Font localFont = G4P.numericLabelFont; - - public GLinearTrackControl(PApplet theApplet, float p0, float p1, float p2, float p3) { - super(theApplet, p0, p1, p2, p3); - } - - /** - * Set the text orientation for the display of the limits and value if appropriate.
- * Acceptable values are G4P.ORIENT_LEFT, G4P.ORIENT_RIGHT or G4P.ORIENT_TRACK
- * If an invalid value is passed the ORIENT_TRACK is used. - * - * @param orient the orientation of the number labels - */ - public void setTextOrientation(int orient){ - switch(orient){ - case ORIENT_LEFT: - case ORIENT_RIGHT: - case ORIENT_TRACK: - textOrientation = orient; - break; - default: - textOrientation = ORIENT_TRACK; - } - bufferInvalid = true; - } - - /** - * This method is used to set the text to appear alongside the tick marks.
- * The array passed must have a minimum of 2 elements and each label (element) - * must have at least 1 character. If these two conditions are not met then - * the call to this method will be ignored and no changes are made. - * - * @param tickLabels an array of strings for the labels - */ - public void setTickLabels(String[] tickLabels){ - if(tickLabels == null || tickLabels.length < 2) - return; - for(String s : tickLabels) - if(s == null || s.length() == 0) - return; - labels = new StyledString[tickLabels.length]; - for(int i = 0; i < tickLabels.length; i++) - labels[i] = new StyledString(tickLabels[i]); - setStickToTicks(true); - setNbrTicks(labels.length); - startLimit = 0; - endLimit = nbrTicks - 1; - valueType = INTEGER; - showLimits = false; - showValue = false; - bufferInvalid = true; - } - - /** - * Set whether the tick marks are to be displayed or not. Then - * recalculate the track offset for the value and limit text. - * @param showTicks the showTicks to set - */ - public void setShowTicks(boolean showTicks) { - super.setShowTicks(showTicks); - float newTrackOffset = calcTrackOffset(); - if(newTrackOffset != trackOffset){ - trackOffset = newTrackOffset; - bufferInvalid = true; - } - bufferInvalid = true; - } - - /** - * Calculates the amount of offset for the labels - */ - protected float calcTrackOffset(){ - return (showTicks) ? trackWidth + 2 : trackWidth/2 + 2; - } - - /** - * The offset is the distance the value/labels are drawn from the - * centre of the track.
- * You may wish to tweak this value for visual effect. - * @param offset - */ - public void setTrackOffset(float offset){ - trackOffset = offset; - } - - /** - * Get the visual offset for the value/label text. - */ - public float getTrackOffset(){ - return trackOffset; - } - - /** - * If we are using labels then this will get the label text - * associated with the current value.
- * If labels have not been set then return null - */ - public String getValueS(){ - // Use the valueTarget rather than the valuePos since intermediate values - // have no meaning in this case. - int idx = Math.round(startLimit + (endLimit - startLimit) * parametricTarget); - return (labels == null) ? getNumericDisplayString(getValueF()) : labels[idx].getPlainText(); - } - - public void mouseEvent(MouseEvent event){ - if(!visible || !enabled || !available) return; - - calcTransformedOrigin(winApp.mouseX, winApp.mouseY); - currSpot = whichHotSpot(ox, oy); - // Normalise ox and oy to the centre of the slider - ox -= width/2; - ox /= trackLength; - - if(currSpot >= 0 || focusIsWith == this) - cursorIsOver = this; - else if(cursorIsOver == this) - cursorIsOver = null; - - switch(event.getAction()){ - case MouseEvent.PRESS: - if(focusIsWith != this && currSpot > -1 && z >= focusObjectZ()){ - downHotSpot = currSpot; - status = (downHotSpot == THUMB_SPOT) ? PRESS_CONTROL : OFF_CONTROL; - offset = ox + 0.5f - parametricPos; // normalised - takeFocus(); - bufferInvalid = true; - } - break; - case MouseEvent.CLICK: - if(focusIsWith == this ){ - parametricTarget = ox + 0.5f; - parametricTarget = calcParametricTarget(parametricTarget); - dragging = false; - status = OFF_CONTROL; - loseFocus(null); - bufferInvalid = true; - } - break; - case MouseEvent.WHEEL: - if(currSpot > -1 && z >= focusObjectZ()){ - System.out.print(tag + " " + parametricTarget + " " + event.getCount() + " " + wheelDelta + " >>> "); - parametricTarget = calcParametricTarget(parametricTarget + event.getCount() * wheelDelta * G4P.wheelForSlider); - System.out.println(parametricTarget); - } - break; - case MouseEvent.RELEASE: - if(focusIsWith == this && dragging){ - if(downHotSpot == THUMB_SPOT){ - parametricTarget = (ox - offset) + 0.5f; - if(parametricTarget < 0 || parametricTarget > 1) - offset = 0; - parametricTarget = calcParametricTarget(parametricTarget); -// if(parametricTarget < 0){ -// parametricTarget = 0; -// offset = 0; -// } -// else if(parametricTarget > 1){ -// parametricTarget = 1; -// offset = 0; -// } -// if(stickToTicks) -// parametricTarget = findNearestTickValueTo(parametricTarget); - } - status = OFF_CONTROL; - bufferInvalid = true; - loseFocus(null); - } - dragging = false; - break; - case MouseEvent.DRAG: - if(focusIsWith == this){ - status = DRAG_CONTROL; - dragging = true; - if(downHotSpot == THUMB_SPOT){ - parametricTarget = (ox - offset) + 0.5f; - if(parametricTarget < 0){ - parametricTarget = 0; - offset = 0; - } - else if(parametricTarget > 1){ - parametricTarget = 1; - offset = 0; - } - bufferInvalid = true; - } - } - break; - case MouseEvent.MOVE: - int currStatus = status; - // If dragged state will stay as PRESSED - if(currSpot == THUMB_SPOT) - status = OVER_CONTROL; - else - status = OFF_CONTROL; - if(currStatus != status) - bufferInvalid = true; - break; - } - } - - - - public void draw(){ - if(!visible) return; - // Update buffer if invalid - updateBuffer(); - winApp.pushStyle(); - - winApp.pushMatrix(); - // Perform the rotation - winApp.translate(cx, cy); - winApp.rotate(rotAngle); - winApp.pushMatrix(); - // Move matrix to line up with top-left corner - winApp.translate(-halfWidth, -halfHeight); - // Draw buffer - winApp.imageMode(PApplet.CORNER); - if(alphaLevel < 255) - winApp.tint(TINT_FOR_ALPHA, alphaLevel); - winApp.image(buffer, 0, 0); - winApp.popMatrix(); - winApp.popMatrix(); - - winApp.popStyle(); - } - - protected void drawValue(Graphics2D g2d){ - float px, py; - TextLayout line; - ssValue.setText(getNumericDisplayString(getValueF())); - line = ssValue.getLines(g2d).getFirst().layout; - float advance = line.getVisibleAdvance(); - switch(textOrientation){ - case ORIENT_LEFT: - px = (parametricPos - 0.5f) * trackLength + line.getDescent(); - py = -trackOffset; - buffer.pushMatrix(); - buffer.translate(px, py); - buffer.rotate(-PI/2); - line.draw(g2d, 0, 0 ); - buffer.popMatrix(); - break; - case ORIENT_RIGHT: - px = (parametricPos - 0.5f) * trackLength - line.getDescent(); - py = - trackOffset - advance; - buffer.pushMatrix(); - buffer.translate(px, py); - buffer.rotate(PI/2); - line.draw(g2d, 0, 0 ); - buffer.popMatrix(); - break; - case ORIENT_TRACK: - px = (parametricPos - 0.5f) * trackLength - advance /2; - if(px < -trackDisplayLength/2) - px = -trackDisplayLength/2; - else if(px + advance > trackDisplayLength /2) - px = trackDisplayLength/2 - advance; - py = -trackOffset - line.getDescent(); - line.draw(g2d, px, py ); - line = ssEndLimit.getLines(g2d).getFirst().layout; - break; - } - } - - protected void drawLimits(Graphics2D g2d){ - float px, py; - TextLayout line; - if(limitsInvalid){ - ssStartLimit.setText(getNumericDisplayString(startLimit)); - ssEndLimit.setText(getNumericDisplayString(endLimit)); - limitsInvalid = false; - } - switch(textOrientation){ - case ORIENT_LEFT: - line = ssStartLimit.getLines(g2d).getFirst().layout; - px = -trackLength/2 + line.getDescent(); - py = trackOffset + line.getVisibleAdvance(); - buffer.pushMatrix(); - buffer.translate(px, py); - buffer.rotate(-PI/2); - line.draw(g2d, 0, 0 ); - buffer.popMatrix(); - line = ssEndLimit.getLines(g2d).getFirst().layout; - px = trackLength/2 + line.getDescent(); - py = trackOffset + line.getVisibleAdvance(); - buffer.pushMatrix(); - buffer.translate(px, py); - buffer.rotate(-PI/2); - line.draw(g2d, 0, 0 ); - buffer.popMatrix(); - break; - case ORIENT_RIGHT: - line = ssStartLimit.getLines(g2d).getFirst().layout; - px = -trackLength/2 - line.getDescent(); - py = trackOffset; - buffer.pushMatrix(); - buffer.translate(px, py); - buffer.rotate(PI/2); - line.draw(g2d, 0, 0 ); - buffer.popMatrix(); - line = ssEndLimit.getLines(g2d).getFirst().layout; - px = trackLength/2 - line.getDescent(); - py = trackOffset; - buffer.pushMatrix(); - buffer.translate(px, py); - buffer.rotate(PI/2); - line.draw(g2d, 0, 0 ); - buffer.popMatrix(); - break; - case ORIENT_TRACK: - line = ssStartLimit.getLines(g2d).getFirst().layout; - px = -(trackLength + trackWidth)/2; - py = trackOffset + line.getAscent(); - line.draw(g2d, px, py ); - line = ssEndLimit.getLines(g2d).getFirst().layout; - px = (trackLength + trackWidth)/2 - line.getVisibleAdvance(); - py = trackOffset + line.getAscent(); - line.draw(g2d, px, py ); - break; - } - } - - protected void drawLabels(Graphics2D g2d){ - float px, py; - TextLayout line; - if(labelsInvalid){ - ssStartLimit.setText(getNumericDisplayString(startLimit)); - ssEndLimit.setText(getNumericDisplayString(endLimit)); - limitsInvalid = false; - } - float deltaX = 1.0f / (nbrTicks - 1); - switch(textOrientation){ - case ORIENT_LEFT: - for(int i = 0; i < labels.length; i++){ - line = labels[i].getLines(g2d).getFirst().layout; - px = (i * deltaX - 0.5f)*trackLength + line.getDescent(); - py = trackOffset + line.getVisibleAdvance(); - buffer.pushMatrix(); - buffer.translate(px, py); - buffer.rotate(-PI/2); - line.draw(g2d, 0, 0 ); - buffer.popMatrix(); - } - break; - case ORIENT_RIGHT: - for(int i = 0; i < labels.length; i++){ - line = labels[i].getLines(g2d).getFirst().layout; - px = (i * deltaX - 0.5f)*trackLength - line.getDescent(); - py = trackOffset; - buffer.pushMatrix(); - buffer.translate(px, py); - buffer.rotate(PI/2); - line.draw(g2d, 0, 0 ); - buffer.popMatrix(); - } - break; - case ORIENT_TRACK: - for(int i = 0; i < labels.length; i++){ - line = labels[i].getLines(g2d).getFirst().layout; - px = (i * deltaX - 0.5f)*trackLength - 0.5f * line.getVisibleAdvance(); - py = trackOffset + line.getAscent(); - line.draw(g2d, px, py ); - } - break; - } - } - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GMessenger.java b/Processing/libraries/G4P/src/g4p_controls/GMessenger.java deleted file mode 100644 index 319d0f7..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GMessenger.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2009 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -/** - * CLASS FOR INTERNAL USE ONLY - * - * @author Peter Lager - * - */ -class GMessenger implements GConstants, GConstantsInternal { - - /** - * Display an error message message - * - * @param id message ID number - * @param obj - * @param info - */ - static void message(Integer id, Object[] info){ - // Display G4P messages if required - if(G4P.showMessages){ - switch(id){ - case MISSING: - missingEventHandler(info); - break; - case USER_COL_SCHEME: - System.out.println("USER DEFINED colour schema active"); - break; - } - } - // Display all runtime errors - switch(id){ - case NONEXISTANT: - nonexistantEventHandler(info); - break; - case INVALID_TYPE: - inavlidControlType(info); - break; - case INVALID_PAPPLET: - unmatchedPApplet(info); - break; - case EXCP_IN_HANDLER: - eventHandlerFailed(info); - break; - } - } - - /** - * Error message when an exception is create inside an event handler. - * - * info[0] event generator class - * info[1] event handling method name - * info[2] the exception thrown - * - */ - private static void eventHandlerFailed(Object[] info) { - String className = info[0].getClass().getSimpleName(); - String methodName = (String) info[1]; - Exception e = (Exception) info[2]; - Throwable t = e.getCause(); - StackTraceElement[] calls = t.getStackTrace(); - StringBuilder output = new StringBuilder(); - output.append("################ EXCEPTION IN EVENT HANDLER ################"); - output.append("\nAn error occured during execution of the eventhandler:"); - output.append("\nCLASS: "+className+" METHOD: "+methodName); - output.append("\n\tCaused by " + t.toString()); - for(Object line : calls) - output.append("\n\t"+ line.toString()); - output.append("\n##############################################################\n"); - System.out.println(output); - } - - /** - * Unable to find the default handler method. - * - * info[0] event generator class - * info[1] event handling method name - * info[2] the parameter class names - * info[3] the parameter names (identifiers) - * - */ - private static void missingEventHandler(Object[] info) { - String className = info[0].getClass().getSimpleName(); - String methodName = (String) info[1]; - StringBuilder output = new StringBuilder(); - - output.append("You might want to add a method to handle " + className + " events syntax is\n"); - output.append("public void " + methodName + "("); - Class[] param_classes = (Class[])(info[2]); - String[] param_names = (String[])(info[3]); - if(param_classes != null) { - for(int i = 0; i < param_classes.length; i++){ - String pname = (param_classes[i]).getSimpleName(); - output.append(pname + " " + param_names[i]); - if(i < param_classes.length - 1) - output.append(", "); - } - } - - output.append(") { /* code */ }\n"); - System.out.println(output.toString()); - } - - /** - * Unable to find the user defined handler method. - * - * info[0] event generator class - * info[1] event handling method name - * info[2] the parameter class names - * - */ - private static void nonexistantEventHandler(Object[] info) { - String className = info[0].getClass().getSimpleName(); - String methodName = (String) info[1]; - String pname; - StringBuilder output = new StringBuilder(); - - output.append("The "+className+" class cannot find this method \n"); - output.append("\tpublic void " + methodName + "("); - Class[] param_names = (Class[])(info[2]); - for(int i = 0; i < param_names.length; i++){ - pname = (param_names[i]).getSimpleName(); - output.append(pname + " " + pname.substring(1).toLowerCase()); - if(i < param_names.length - 1) - output.append(", "); - } - output.append(") { /* code */ }\n"); - System.out.println(output.toString()); - } - - /** - * An attempt was made to add a G4P control that does not have a visual appearance or one that - * does not respond to mouse / keyboard events. - * - * info[0] the group class - * info[1] the G4P control class - */ - private static void inavlidControlType(Object[] info){ - String groupClassName = info[0].getClass().getSimpleName(); - String className = info[1].getClass().getSimpleName(); - - System.out.println("Controls of type " + className+" cannot be added to a control group (" + groupClassName + "\n"); - } - - /** - * An attempt was made to add a G4P control that does not have a visual appearance or one that - * does not respond to mouse / keyboard events. - * - * info[0] the group class - * info[1] the G4P control class - */ - private static void unmatchedPApplet(Object[] info){ - String groupClassName = info[0].getClass().getSimpleName(); - String className = info[1].getClass().getSimpleName(); - System.out.println("The " + className + " object cannot be added to this control group (" + groupClassName + ") because they are for different windows.\n"); - } -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GOption.java b/Processing/libraries/G4P/src/g4p_controls/GOption.java deleted file mode 100644 index 282a8dd..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GOption.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import processing.core.PApplet; - -/** - * A two-state toggle control.
- * - * GOption objects (also known as radio buttons) are two-state toggle switches that can either - * be used independently or if added to a GToggleGroup control part of a single selection - * option group. - * - * @author Peter Lager - * - */ -public class GOption extends GToggleControl{ - - /** - * Create an option button without text. - * - * @param theApplet that will display the control - * @param p0 - * @param p1 - * @param p2 - * @param p3 - */ - public GOption(PApplet theApplet, float p0, float p1, float p2, float p3) { - this(theApplet, p0, p1, p2, p3, ""); - } - - /** - * Create an option button with text. - * - * @param theApplet that will display the control - * @param p0 - * @param p1 - * @param p2 - * @param p3 - * @param text text to be displayed - */ - public GOption(PApplet theApplet, float p0, float p1, float p2, float p3, String text) { - super(theApplet, p0, p1, p2, p3); - opaque = false; - setText(text); - setIcon("pinhead.png", 2, GAlign.LEFT, null); - setTextAlign(GAlign.LEFT, null); - z = Z_SLIPPY; - // Now register control with applet - createEventHandler(G4P.sketchWindow, "handleToggleControlEvents", - new Class[]{ GToggleControl.class, GEvent.class }, - new String[]{ "option", "event" } - ); - registeredMethods = DRAW_METHOD | MOUSE_METHOD; - cursorOver = HAND; - G4P.registerControl(this); - } - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GPanel.java b/Processing/libraries/G4P/src/g4p_controls/GPanel.java deleted file mode 100644 index 5f253f1..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GPanel.java +++ /dev/null @@ -1,535 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import g4p_controls.HotSpot.HSrect; - -import java.awt.Font; -import java.awt.Graphics2D; -import java.awt.font.TextLayout; -import java.util.LinkedList; - -import processing.core.PApplet; -import processing.event.MouseEvent; - - -/** - * A component that can be used to group GUI components that can be - * dragged, collapsed (leaves title tab only) and un-collapsed. - * - * When created the Panel is collapsed by default. To open the panel - * use setCollapsed(true); after creating it.
- * - * Once a component has been added the x/y coordinates of the control are - * calculated to be the centre of the panel to the centre of the control. This - * is to facilitate rotating of controls on panels - * - * @author Peter Lager - * - */ -public class GPanel extends GTextBase { - - static protected int COLLAPSED_BAR_SPOT = 1; - static protected int EXPANDED_BAR_SPOT = 2; - static protected int SURFACE_SPOT = 0; - - - /** Whether the panel is displayed in full or tab only */ - protected boolean tabOnly = false; - - /** The height of the tab calculated from font height + padding */ - protected int tabHeight, tabWidth; - - /** Used to restore position when closing panel */ - protected float dockX, dockY; - - // Defines the area that the panel must fit inside. - protected float lowX, highX, lowY, highY; - - /** true if the panel is being dragged */ - protected boolean beingDragged = false; - - protected boolean draggable = true; - protected boolean collapsible = true; - - - /** - * Create a Panel that comprises of 2 parts the tab which is used to - * select and move the panel and the container window below the tab which - * is used to hold other components.
- * If the panel fits inside the display window then its position will be - * constrained so that it can't be dragged outside the viewable area. - * Otherwise no constraint is applied. - * - * @param theApplet the PApplet reference - * @param p0 horizontal position - * @param p1 vertical position - * @param p2 width of the panel - * @param p3 height of the panel (excl. tab) - */ - public GPanel(PApplet theApplet, float p0, float p1, float p2, float p3) { - this(theApplet, p0, p1, p2, p3, "Panel "); - } - - /** - * Create a Panel that comprises of 2 parts the tab which is used to - * select and move the panel and the container window below the tab which - * is used to hold other components.
- * If the panel fits inside the display window then its position will be - * constrained so that it can't be dragged outside the viewable area. - * Otherwise no constraint is applied. - * - * @param theApplet the PApplet reference - * @param p0 horizontal position - * @param p1 vertical position - * @param p2 width of the panel - * @param p3 height of the panel (excl. tab) - * @param text to appear on tab - */ - public GPanel(PApplet theApplet, float p0, float p1, float p2, float p3, String text) { - super(theApplet, p0, p1, p2, p3); - // Set the values used to constrain movement of the panel - if(x < 0 || y < 0 || x + width > winApp.width || y+ height > winApp.height) - clearDragArea(); - else - setDragArea(); - // Create the list of children - children = new LinkedList(); - setText(text); - calcHotSpots(); - constrainPanelPosition(); - opaque = true; - dockX = x; - dockY = y; - z = Z_PANEL; - - createEventHandler(G4P.sketchWindow, "handlePanelEvents", - new Class[]{ GPanel.class, GEvent.class }, - new String[]{ "panel", "event" } - ); - registeredMethods = DRAW_METHOD | MOUSE_METHOD; - cursorOver = HAND; - G4P.registerControl(this); - } - - /** - * This needs to be called if the tab text is changed - */ - private void calcHotSpots(){ - hotspots = new HotSpot[]{ - new HSrect(COLLAPSED_BAR_SPOT, 0, 0, tabWidth, tabHeight), // tab text area - new HSrect(EXPANDED_BAR_SPOT, 0, 0, width, tabHeight), // tab non-text area - new HSrect(SURFACE_SPOT, 0, tabHeight, width, height - tabHeight) // panel content surface - }; - } - - /** - * This panel is being added to another additional changes that need to be made this control - * is added to another.
- * - * In this case we need to set the constraint limits to keep inside the parent. - * - * @param p the parent - */ - protected void addToParent(GAbstractControl p){ - // Will this fit inside the parent panel - if(width > p.width || height > p.height){ //No - draggable = false; - } - else { - lowX = -p.width/2; - highX = p.width/2; - lowY = -p.height/2; - highY = p.height/2; - } - } - - public void setText(String text){ - super.setText(text); - buffer.beginDraw(); - stext.getLines(buffer.g2); - buffer.endDraw(); - tabHeight = (int) (stext.getMaxLineHeight() + 4); - tabWidth = (int) (stext.getMaxLineLength() + 8); - calcHotSpots(); - bufferInvalid = true; - } - - public void setFont(Font font) { - if(font != null) - localFont = font; - tabHeight = (int) (1.2f * localFont.getSize() + 2); - buffer.g2.setFont(localFont); - bufferInvalid = true; - calcHotSpots(); - bufferInvalid = true; - } - - /** - * What to do when the FPanel loses focus. - */ - protected void loseFocus(GAbstractControl grabber){ - focusIsWith = null; - beingDragged = false; - } - - /** - * Draw the panel. - * If tabOnly == true - * then display the tab only - * else - * draw tab and all child (added) components - */ - public void draw(){ - if(!visible) return; - winApp.pushStyle(); - // Update buffer if invalid - updateBuffer(); - - winApp.pushMatrix(); - // Perform the rotation - winApp.translate(cx, cy); - winApp.rotate(rotAngle); - // If opaque draw the panel tab and back - if(opaque){ - winApp.pushMatrix(); - // Move matrix to line up with top-left corner - winApp.translate(-halfWidth, -halfHeight); - // Draw buffer - winApp.imageMode(PApplet.CORNER); - if(alphaLevel < 255) - winApp.tint(TINT_FOR_ALPHA, alphaLevel); - winApp.image(buffer, 0, 0); - winApp.popMatrix(); - } - // Draw the children - if(!tabOnly){ - if(children != null){ - for(GAbstractControl c : children) - c.draw(); - } - } - winApp.popMatrix(); - winApp.popStyle(); - } - - protected void updateBuffer(){ - if(bufferInvalid) { - bufferInvalid = false; - buffer.beginDraw(); - Graphics2D g2d = buffer.g2; - g2d.setFont(localFont); - buffer.clear(); - // Draw tab - buffer.noStroke(); - buffer.fill(palette[4].getRGB()); - if(tabOnly){ - buffer.rect(0, 0, tabWidth, tabHeight); - } - else { - buffer.rect(0, 0, width, tabHeight); - } - // Draw tab text (panel name) - stext.getLines(g2d); - g2d.setColor(palette[2]); - TextLayout tl = stext.getTLIforLineNo(0).layout; - tl.draw(g2d, 4, 2 + tl.getAscent()); - // Draw extended panel background - if(!tabOnly){ - buffer.noStroke(); - buffer.fill(palette[5].getRGB()); - buffer.rect(0, tabHeight, width, height - tabHeight); - } - buffer.endDraw(); - } - } - - /** - * Determines if a particular pixel position is over the panel taking - * into account whether it is collapsed or not. - */ - public boolean isOver(float x, float y){ - calcTransformedOrigin(winApp.mouseX, winApp.mouseY); - currSpot = whichHotSpot(ox, oy); - return (tabOnly)? currSpot == COLLAPSED_BAR_SPOT : currSpot == EXPANDED_BAR_SPOT | currSpot == COLLAPSED_BAR_SPOT; - } - - /** - * All GUI components are registered for mouseEvents - */ - public void mouseEvent(MouseEvent event){ - if(!visible || !enabled || !available) return; - - calcTransformedOrigin(winApp.mouseX, winApp.mouseY); - - currSpot = whichHotSpot(ox, oy); - // Is mouse over the panel tab (taking into account extended with when not collapsed) - boolean mouseOver = (tabOnly)? currSpot == COLLAPSED_BAR_SPOT : currSpot == EXPANDED_BAR_SPOT | currSpot == COLLAPSED_BAR_SPOT; - - if(mouseOver || focusIsWith == this) - cursorIsOver = this; - else if(cursorIsOver == this) - cursorIsOver = null; - - switch(event.getAction()){ - case MouseEvent.PRESS: - if(focusIsWith != this && mouseOver && z >= focusObjectZ()){ - takeFocus(); - beingDragged = false; - } - break; - case MouseEvent.CLICK: - if(focusIsWith == this && collapsible){ - tabOnly = !tabOnly; - // Perform appropriate action depending on collapse state - setCollapsed(tabOnly); - if(tabOnly){ - x = dockX; - y = dockY; - } - else { - dockX = x; - dockY = y; - // Open panel move on screen if needed - if(y + height > winApp.height) - y = winApp.height - height; - if(x + width > winApp.width) - x = winApp.width - width; - } - // Maintain centre for drawing purposes - cx = x + width/2; - cy = y + height/2; - constrainPanelPosition(); - if(tabOnly) - fireEvent(this, GEvent.COLLAPSED); - else - fireEvent(this, GEvent.EXPANDED); - bufferInvalid = true; - beingDragged = false; - // This component does not keep the focus when clicked - loseFocus(null); - } - break; - case MouseEvent.RELEASE: // After dragging NOT clicking - if(focusIsWith == this){ - if(beingDragged){ - // Remember the dock position when the mouse has - // been released after the panel has been dragged - dockX = x; - dockY = y; - beingDragged = false; - loseFocus(null); - } - } - break; - case MouseEvent.DRAG: - if(focusIsWith == this && draggable ){//&& parent == null){ - // Maintain centre for drawing purposes - cx += (winApp.mouseX - winApp.pmouseX); - cy += (winApp.mouseY - winApp.pmouseY); - // Update x and y positions - x = cx - width/2; - y = cy - height/2; - constrainPanelPosition(); - beingDragged = true; - fireEvent(this, GEvent.DRAGGED); - } - break; - } - } - - /** - * Determines whether to show the tab and panel back colour. If the - * parameter is the same as the current state then no changes will - * be made.
- * If the parameter is false then the panel will be
- *
    - *
  • expanded
  • - *
  • made non-collasible
  • - *
  • made unavailable to mouse control (so can't be dragged)
  • - *
- * If the parameter is true then the panel will remain non-collapsible - * and the user must change this if required.
- * @param opaque - */ - public void setOpaque(boolean opaque){ - if(this.opaque == opaque) - return; // no change - if(!opaque){ - setCollapsed(false); - setCollapsible(false); - } - available = opaque; - this.opaque = opaque; - } - - /** - * This method is used to discover whether the panel is being - * dragged to a new position on the screen. - * @return true if being dragged to a new position - */ - public boolean isDragging(){ - return beingDragged; - } - - /** - * Sets whether the panel can be dragged by the mouse or not. - * @param draggable - */ - public void setDraggable(boolean draggable){ - this.draggable = draggable; - } - - /** - * Can we drag this panel with the mouse? - * @return true if draggable - */ - public boolean isDraggable(){ - return draggable; - } - - /** - * Collapse or open the panel - * @param collapse - */ - public void setCollapsed(boolean collapse){ - if(collapsible){ - tabOnly = collapse; - // If we open the panel make sure it fits on the screen but if we collapse - // the panel disable the panel controls but leave the panel available - if(tabOnly){ - setAvailable(false); - available = true; // Needed so we can click on the title bar - } - else { - setAvailable(true); - } - } - } - - /** - * Find out if the panel is collapsed - * @return true if collapsed - */ - public boolean isCollapsed(){ - return tabOnly; - } - - /** - * Determine whether the panel can be collapsed when the title bar is clicked.
- * - * If this is set to false then the panel will be expanded and it will - * not be possible to collapse it until set back to true. - * - */ - public void setCollapsible(boolean c){ - collapsible = c; - if(c == false){ - tabOnly = false; - setAvailable(true); - } - } - - /** - * Is this panel collapsible - */ - public boolean isCollapsible(){ - return collapsible; - } - - public int getTabHeight(){ - return tabHeight; - } - - /** - * Provided the panel is physically small enough this method will set the area - * within which the panel can be dragged and move the panel inside the area if - * not already inside.
- * - * @param xMin - * @param yMin - * @param xMax - * @param yMax - * @return true if the constraint was applied successfully else false - */ - public boolean setDragArea(float xMin, float yMin, float xMax, float yMax){ - if(xMax - xMin < width || yMax - yMin < height){ - if(G4P.showMessages) - System.out.println("The constraint area is too small for this panel - request ignored"); - return false; - } - lowX = xMin; - lowY = yMin; - highX = xMax; - highY = yMax; - constrainPanelPosition(); - return true; - } - - /** - * Provided the panel is small enough to fit inside the display area then - * the panel will be constrained to fit inside the display area. - * - * @return true if the constraint was applied successfully else false - */ - public boolean setDragArea(){ - return setDragArea(0, 0, winApp.width, winApp.height); - } - - /** - * Remove any drag constraint from this panel. - */ - public void clearDragArea(){ - lowX = lowY = -Float.MAX_VALUE; - highX = highY = Float.MAX_VALUE; - } - - /** - * Ensures that the panel tab and panel body if open does not - * extend off the screen. - */ - private void constrainPanelPosition(){ - // Calculate the size of the visible part of the panel - int w = (int) ((tabOnly)? tabWidth : width); - int h = (int) ((tabOnly)? tabHeight : height); - // Constrain horizontally - if(x < lowX) - x = lowX; - else if(x + w > highX) - x = (int) (highX - w); - // Constrain vertically - if(y < lowY) - y = lowY; - else if(y + h > highY) - y = highY - h; - // Maintain centre for - cx = x + width/2; - cy = y + height/2; - } - - - public String toString(){ - return tag + " [" + x + ", " + y+"]" + " [" + cx + ", " + cy+"]"+ " [" + dockX + ", " + dockY+"]"; - } -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GPassword.java b/Processing/libraries/G4P/src/g4p_controls/GPassword.java deleted file mode 100644 index 658b9aa..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GPassword.java +++ /dev/null @@ -1,757 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2014 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import g4p_controls.HotSpot.HSrect; -import g4p_controls.StyledString.TextLayoutHitInfo; -import g4p_controls.StyledString.TextLayoutInfo; - -import java.awt.Font; -import java.awt.Graphics2D; -import java.awt.font.TextHitInfo; -import java.awt.font.TextLayout; -import java.awt.geom.GeneralPath; -import java.util.LinkedList; - -import processing.core.PApplet; -import processing.core.PGraphics; -import processing.awt.PGraphicsJava2D; -import processing.event.KeyEvent; -import processing.event.MouseEvent; - -/** - * The password field component.
- * - * This control allows the user to secretly enter a password and supports an - * optional horizontal scrollbar.
- * - * Each key typed will display a # character, but the user can specify another character.
- * - * Unlike a text field it does not support text selection or the copying and pasting of - * text via the clipboard.
- * - * Fires CHANGED, ENTERED, LOST_FOCUS, GETS_FOCUS events.
- * The focus events are only fired if the control is added to a GTabManager object.
- * - * @author Peter Lager - * - */ -public final class GPassword extends GAbstractControl implements Focusable{ - - protected TextLayoutHitInfo cursorTLHI = new TextLayoutHitInfo(); - - private static char cover = '#'; - - private StyledString stext = new StyledString(" "); - private StyledString hidden = new StyledString(" "); - private int maxWordLength = 10; - private int wordLength = 0; - - GTabManager tabManager = null; - - // The width to break a line - protected int wrapWidth = Integer.MAX_VALUE; - - // The typing area - protected float tx,ty,th,tw; - // Offset to display area - protected float ptx, pty; - // Caret position - protected float caretX, caretY; - - protected boolean keepCursorInView = false; - - protected GeneralPath gpTextDisplayArea; - - // Used for identifying selection and cursor position - protected TextLayoutHitInfo startTLHI = new TextLayoutHitInfo(); - protected TextLayoutHitInfo endTLHI = new TextLayoutHitInfo(); - - // The scrollbars available -// protected final int scrollbarPolicy; -// protected boolean autoHide = false; -// protected GScrollbar hsb, vsb; - - protected GTimer caretFlasher; - protected boolean showCaret = false; - - // Stuff to manage text selections - protected int endChar = -1, startChar = -1, pos = endChar, nbr = 0, adjust = 0; - protected boolean textChanged = false; - - protected Font localFont = G4P.globalFont; - - /** - * Create a password field without a scrollbar. - * - * @param theApplet - * @param p0 - * @param p1 - * @param p2 - * @param p3 - */ - public GPassword(PApplet theApplet, float p0, float p1, float p2, float p3) { - this(theApplet, p0, p1, p2, p3, SCROLLBARS_NONE); - } - - /** - * Create a password field with the given scrollbar policy.
- * This policy can be one of these
- *
    - *
  • SCROLLBARS_NONE
  • - *
  • SCROLLBARS_HORIZONTAL_ONLY
  • - *
- * If you want the scrollbar to auto hide then perform a logical or with - *
    - *
  • SCROLLBARS_AUTOHIDE
  • - *
- * e.g. SCROLLBARS_HORIZONTAL_ONLY | SCROLLBARS_AUTOHIDE - *
- * @param theApplet - * @param p0 - * @param p1 - * @param p2 - * @param p3 - * @param sbPolicy - */ - public GPassword(PApplet theApplet, float p0, float p1, float p2, float p3, int sbPolicy) { - super(theApplet, p0, p1, p2, p3); -// scrollbarPolicy = sbPolicy; -// autoHide = ((sbPolicy & SCROLLBARS_AUTOHIDE) == SCROLLBARS_AUTOHIDE); - caretFlasher = new GTimer(theApplet, this, "flashCaret", 400); - caretFlasher.start(); - opaque = true; - cursorOver = TEXT; - - setVisibleChar(cover); - children = new LinkedList(); - tx = ty = 2; - tw = width - 2 * 2; -// th = height - ((scrollbarPolicy & SCROLLBAR_HORIZONTAL) != 0 ? 11 : 0); - th = height; - gpTextDisplayArea = new GeneralPath(); - gpTextDisplayArea.moveTo( 0, 0); - gpTextDisplayArea.lineTo( 0, th); - gpTextDisplayArea.lineTo(tw, th); - gpTextDisplayArea.lineTo(tw, 0); - gpTextDisplayArea.closePath(); - - hotspots = new HotSpot[]{ - new HSrect(1, tx, ty, tw, th), // typing area - new HSrect(9, 0, 0, width, height) // control surface - }; - - G4P.pushStyle(); - G4P.showMessages = false; - - z = Z_STICKY; - - G4P.control_mode = GControlMode.CORNER; -// if((scrollbarPolicy & SCROLLBAR_HORIZONTAL) != 0){ -// hsb = new GScrollbar(theApplet, 0, 0, tw, 10); -// addControl(hsb, tx, ty + th + 2, 0); -// hsb.addEventHandler(this, "hsbEventHandler"); -// hsb.setAutoHide(autoHide); -// } - G4P.popStyle(); - // z = Z_STICKY; - createEventHandler(G4P.sketchWindow, "handlePasswordEvents", - new Class[]{ GPassword.class, GEvent.class }, - new String[]{ "pwordControl", "event" } - ); - registeredMethods = PRE_METHOD | DRAW_METHOD | MOUSE_METHOD | KEY_METHOD; - // Must register control - G4P.registerControl(this); - bufferInvalid = true; - } - - /** - * Set the character that will be displayed instead of the actual character - * entered by the user.
- * Default value is '#' - */ - public void setVisibleChar(char c){ - int ascii = (int) c; - if((ascii >= 33 && ascii <= 255 && ascii != 127) || ascii == 8364) - cover = c; - } - - /** - * Get the current password (hidden) value of this field. - * @return actual password text - */ - public String getPassword(){ - String password = hidden.getPlainText(); - return password.equals(" ") ? "" : password; - } - - /** - * Get the current length of the password entered. - */ - public int getWordLength(){ - return wordLength; - } - - /** - * Sets the max length of the password. This method is ignored if the control - * already holds some user input.
- * The default value is 10. - * @param ml the new max length (must be >= 1) - */ - public void setMaxWordLength(int ml){ - if(wordLength == 0 && ml >= 1) - maxWordLength = ml; - } - - /** - * Set the font to be used in this control - * - * @param font AWT font to use - */ - public void setFont(Font font) { - if(font != null && font != localFont && buffer != null){ - localFont = font; - buffer.g2.setFont(localFont); - bufferInvalid = true; - } - } - - public PGraphics getSnapshot(){ - updateBuffer(); - PGraphicsJava2D snap = (PGraphicsJava2D) winApp.createGraphics(buffer.width, buffer.height, PApplet.JAVA2D); - snap.beginDraw(); - snap.image(buffer,0,0); -// if(hsb != null){ -// snap.pushMatrix(); -// snap.translate(hsb.getX(), hsb.getY()); -// snap.image(hsb.getBuffer(), 0, 0); -// snap.popMatrix(); -// } - snap.endDraw(); - return snap; - } - - public void pre(){ - if(keepCursorInView){ - boolean horzScroll = false; - float max_ptx = caretX - tw + 2; - if(endTLHI != null){ - if(ptx > caretX){ // Scroll to the left (text moves right) - ptx -= HORZ_SCROLL_RATE; - if(ptx < 0) ptx = 0; - horzScroll = true; - } - else if(ptx < max_ptx){ // Scroll to the right (text moves left)? - ptx += HORZ_SCROLL_RATE; - if(ptx > max_ptx) ptx = max_ptx; - horzScroll = true; - } - // Ensure that we show as much text as possible keeping the caret in view - // This is particularly important when deleting from the end of the text - if(ptx > 0 && endTLHI.tli.layout.getAdvance() - ptx < tw - 2){ - ptx = Math.max(0, endTLHI.tli.layout.getAdvance() - tw - 2); - horzScroll = true; - } -// if(horzScroll && hsb != null) -// hsb.setValue(ptx / (stext.getMaxLineLength() + 4)); - } - // If we have scrolled invalidate the buffer otherwise forget it - if(horzScroll) - bufferInvalid = true; - else - keepCursorInView = false; - } - } - - /** - * Do not call this directly. A timer calls this method as and when required. - */ - public void flashCaret(GTimer timer){ - showCaret = !showCaret; - } - - public void mouseEvent(MouseEvent event){ - if(!visible || !enabled || !available) return; - - calcTransformedOrigin(winApp.mouseX, winApp.mouseY); - ox -= tx; oy -= ty; // Remove translation - - currSpot = whichHotSpot(ox, oy); - - if(currSpot == 1 || focusIsWith == this) - cursorIsOver = this; - else if(cursorIsOver == this) - cursorIsOver = null; - - switch(event.getAction()){ - case MouseEvent.PRESS: - if(currSpot == 1){ - if(focusIsWith != this && z >= focusObjectZ()){ - keepCursorInView = true; - takeFocus(); - } - dragging = false; - if(stext == null || stext.length() == 0){ - stext = new StyledString(" ", wrapWidth); - stext.getLines(buffer.g2); - } - endTLHI = stext.calculateFromXY(buffer.g2, ox + ptx, oy + pty); - startTLHI = new TextLayoutHitInfo(endTLHI); - calculateCaretPos(endTLHI); - bufferInvalid = true; - } - else { // Not over this control so if we have focus loose it - if(focusIsWith == this) - loseFocus(null); - } - break; - case MouseEvent.RELEASE: - dragging = false; - bufferInvalid = true; - break; - } - } - - public void keyEvent(KeyEvent e) { - if(!visible || !enabled || !available) return; - if(focusIsWith == this && endTLHI != null){ - char keyChar = e.getKey(); - int keyCode = e.getKeyCode(); - int keyID = e.getAction(); - boolean shiftDown = e.isShiftDown(); - boolean ctrlDown = e.isControlDown(); - - textChanged = false; - keepCursorInView = true; - -// int startPos = pos, startNbr = nbr; - - // Get selection details - endChar = endTLHI.tli.startCharIndex + endTLHI.thi.getInsertionIndex(); - startChar = (startTLHI != null) ? startTLHI.tli.startCharIndex + startTLHI.thi.getInsertionIndex() : endChar; - pos = endChar; - nbr = 0; - adjust = 0; - if(endChar != startChar){ // Have we some text selected? - if(startChar < endChar){ // Forward selection - pos = startChar; nbr = endChar - pos; - } - else if(startChar > endChar){ // Backward selection - pos = endChar; nbr = startChar - pos; - } - } - // Select either keyPressedProcess or keyTypeProcess. These two methods are overridden in child classes - if(keyID == KeyEvent.PRESS) { - keyPressedProcess(keyCode, keyChar, shiftDown, ctrlDown); -// setScrollbarValues(ptx, pty); - } - else if(keyID == KeyEvent.TYPE ){ // && e.getKey() != KeyEvent.CHAR_UNDEFINED && !ctrlDown){ - keyTypedProcess(keyCode, keyChar, shiftDown, ctrlDown); -// setScrollbarValues(ptx, pty); - } - if(textChanged){ - changeText(); - fireEvent(this, GEvent.CHANGED); - } - } - } - - protected void keyPressedProcess(int keyCode, char keyChar, boolean X, boolean ctrlDown){ - boolean cursorMoved = true; - switch(keyCode){ - case LEFT: - moveCaretLeft(endTLHI); - break; - case RIGHT: - moveCaretRight(endTLHI); - break; - case GConstants.HOME: - moveCaretStartOfLine(endTLHI); - break; - case GConstants.END: - moveCaretEndOfLine(endTLHI); - break; - default: - cursorMoved = false; - } - if(cursorMoved){ - calculateCaretPos(endTLHI); - startTLHI.copyFrom(endTLHI); - } - } - - protected void keyTypedProcess(int keyCode, char keyChar, boolean shiftDown, boolean ctrlDown){ - int ascii = (int)keyChar; - if(isDisplayable(ascii) && wordLength < maxWordLength){ - if(hidden.getPlainText().equals(" ")){ - stext.setText(""+cover); - hidden.setText(""+keyChar); - } - else { - stext.insertCharacters( "" + cover, pos); - hidden.insertCharacters("" + keyChar, pos); - } - wordLength++; - adjust = 1; textChanged = true; - } - else if(keyChar == BACKSPACE){ - if(stext.deleteCharacters(pos - 1, 1)){ - hidden.deleteCharacters(pos - 1, 1); - wordLength = --wordLength < 0 ? 0: wordLength; - adjust = -1; textChanged = true; - } - } - else if(keyChar == DELETE){ - if(stext.deleteCharacters(pos, 1)){ - hidden.deleteCharacters(pos, 1); - wordLength--; - adjust = 0; textChanged = true; - } - } - else if(keyChar == ENTER || keyChar == RETURN) { - fireEvent(this, GEvent.ENTERED); - // If we have a tab manager and can tab forward then do so - if(tabManager != null && tabManager.nextControl(this)){ - startTLHI.copyFrom(endTLHI); - return; - } - } - else if(keyChar == TAB){ - // If possible move to next text control - if(tabManager != null){ - boolean result = (shiftDown) ? tabManager.prevControl(this) : tabManager.nextControl(this); - if(result){ - startTLHI.copyFrom(endTLHI); - return; - } - } - } - // If we have emptied the text then recreate a one character string (space) - if(stext.length() == 0){ - stext.insertCharacters(" ", 0); - hidden.insertCharacters(" ", 0); - adjust++; textChanged = true; - } - } - - protected boolean changeText(){ - TextLayoutInfo tli; - TextHitInfo thi = null, thiRight = null; - - pos += adjust; - // Force layouts to be updated - stext.getLines(buffer.g2); - - // Try to get text layout info for the current position - tli = stext.getTLIforCharNo(pos); - if(tli == null){ - // If unable to get a layout for pos then reset everything - endTLHI = null; - startTLHI = null; - ptx = pty = 0; - caretX = caretY = 0; - return false; - } - // We have a text layout so we can do something - // First find the position in line - int posInLine = pos - tli.startCharIndex; - - // Get some hit info so we can see what is happening - try{ - thiRight = tli.layout.getNextRightHit(posInLine); - } - catch(Exception excp){ - thiRight = null; - } - - if(posInLine <= 0){ // At start of line - thi = tli.layout.getNextLeftHit(thiRight); - } - else if(posInLine >= tli.nbrChars){ // End of line - thi = tli.layout.getNextRightHit(tli.nbrChars - 1); - } - else { // Character in line; - thi = tli.layout.getNextLeftHit(thiRight); - } - - endTLHI.setInfo(tli, thi); - // Cursor at end of paragraph graphic - calculateCaretPos(endTLHI); - bufferInvalid = true; - - startTLHI.copyFrom(endTLHI); - return true; - } - - public void draw(){ - if(!visible) return; - updateBuffer(); - - winApp.pushStyle(); - winApp.pushMatrix(); - - winApp.translate(cx, cy); - winApp.rotate(rotAngle); - - winApp.pushMatrix(); - // Move matrix to line up with top-left corner - winApp.translate(-halfWidth, -halfHeight); - // Draw buffer - winApp.imageMode(PApplet.CORNER); - if(alphaLevel < 255) - winApp.tint(TINT_FOR_ALPHA, alphaLevel); - winApp.image(buffer, 0, 0); - - // Draw caret if text display area - if(focusIsWith == this && showCaret && endTLHI.tli != null){ - float[] cinfo = endTLHI.tli.layout.getCaretInfo(endTLHI.thi); - float x_left = - ptx + cinfo[0]; - float y_top = - pty + endTLHI.tli.yPosInPara; - float y_bot = y_top - cinfo[3] + cinfo[5]; - if(x_left >= 0 && x_left <= tw && y_top >= 0 && y_bot <= th){ - winApp.strokeWeight(1.9f); - winApp.stroke(palette[12].getRGB()); - winApp.line(tx+x_left, ty+Math.max(0, y_top), tx+x_left, ty+Math.min(th, y_bot)); - } - } - - winApp.popMatrix(); - - if(children != null){ - for(GAbstractControl c : children) - c.draw(); - } - winApp.popMatrix(); - winApp.popStyle(); - } - - /** - * If the buffer is invalid then redraw it. - * @TODO need to use palette for colours - */ - protected void updateBuffer(){ - if(bufferInvalid) { - bufferInvalid = false; - buffer.beginDraw(); - Graphics2D g2d = buffer.g2; - g2d.setFont(localFont); - - // Get the latest lines of text - LinkedList lines = stext.getLines(g2d); - - // Whole control surface if opaque - if(opaque) - buffer.background(palette[6].getRGB()); - else - buffer.background(buffer.color(255,0)); - - // Now move to top left corner of text display area - buffer.translate(tx,ty); - - // Typing area surface - buffer.noStroke(); - buffer.fill(palette[7].getRGB()); - buffer.rect(-1,-1,tw+2,th+2); - - g2d.setClip(gpTextDisplayArea); - buffer.translate(-ptx, -pty); - // Translate in preparation for display selection and text - - // Display selection and text - for(TextLayoutInfo lineInfo : lines){ - TextLayout layout = lineInfo.layout; - buffer.translate(0, layout.getAscent()); - // Draw text - g2d.setColor(palette[2]); - lineInfo.layout.draw(g2d, 0, 0); - buffer.translate(0, layout.getDescent() + layout.getLeading()); - } - g2d.setClip(null); - buffer.endDraw(); - } - } - - /** - * Give up focus but if the text is only made from spaces - * then set it to null text.
- * Fire focus events for the GTextField and GTextArea controls - */ - protected void loseFocus(GAbstractControl grabber){ - // If this control has focus then Fire a lost focus event - if(focusIsWith == this) - fireEvent(this, GEvent.LOST_FOCUS); - // Process mouse-over cursor - if(cursorIsOver == this) - cursorIsOver = null; - focusIsWith = grabber; - // If only blank text clear it out allowing default text (if any) to be displayed - if(stext.length() > 0){ - int tl = stext.getPlainText().trim().length(); - if(tl == 0) - stext.setText("", wrapWidth); - } - keepCursorInView = true; - bufferInvalid = true; - } - - /** - * Give the focus to this component but only after allowing the - * current component with focus to release it gracefully.
- * Always cancel the keyFocusIsWith irrespective of the component - * type. - * Fire focus events for the GTextField and GTextArea controls - */ - protected void takeFocus(){ - // If focus is not yet with this control fire a gets focus event - if(focusIsWith != this){ - // If the focus is with another control then tell - // that control to lose focus - if(focusIsWith != null) - focusIsWith.loseFocus(this); - fireEvent(this, GEvent.GETS_FOCUS); - } - focusIsWith = this; - } - - /** - * Determines whether this component is to have focus or not.
- */ - public void setFocus(boolean focus){ - if(!focus){ - loseFocus(null); - return; - } - // Make sure we have some text - if(focusIsWith != this){ - dragging = false; - if(stext == null || stext.length() == 0) - stext.setText(" ", wrapWidth); - LinkedList lines = stext.getLines(buffer.g2); - startTLHI = new TextLayoutHitInfo(lines.getFirst(), null); - startTLHI.thi = startTLHI.tli.layout.getNextLeftHit(1); - - endTLHI = new TextLayoutHitInfo(lines.getLast(), null); - int lastChar = endTLHI.tli.layout.getCharacterCount(); - endTLHI.thi = startTLHI.tli.layout.getNextRightHit(lastChar-1); - startTLHI.copyFrom(endTLHI); - - calculateCaretPos(endTLHI); - bufferInvalid = true; - } - keepCursorInView = true; - takeFocus(); - } - - - /** - * Calculate the caret (text insertion point) - * - * @param tlhi - */ - protected void calculateCaretPos(TextLayoutHitInfo tlhi){ - float temp[] = tlhi.tli.layout.getCaretInfo(tlhi.thi); - caretX = temp[0]; - caretY = tlhi.tli.yPosInPara; - } - - /** - * Move caret to home position - * @param currPos the current position of the caret - * @return true if caret moved else false - */ - protected boolean moveCaretStartOfLine(TextLayoutHitInfo currPos){ - if(currPos.thi.getCharIndex() == 0) - return false; // already at start of line - currPos.thi = currPos.tli.layout.getNextLeftHit(1); - return true; - } - - /** - * Move caret to the end of the line that has the current caret position - * @param currPos the current position of the caret - * @return true if caret moved else false - */ - protected boolean moveCaretEndOfLine(TextLayoutHitInfo currPos){ - if(currPos.thi.getCharIndex() == currPos.tli.nbrChars - 1) - return false; // already at end of line - currPos.thi = currPos.tli.layout.getNextRightHit(currPos.tli.nbrChars - 1); - return true; - } - - /** - * Move caret left by one character. - * @param currPos the current position of the caret - * @return true if caret moved else false - */ - protected boolean moveCaretLeft(TextLayoutHitInfo currPos){ - TextHitInfo nthi = currPos.tli.layout.getNextLeftHit(currPos.thi); - if(nthi == null){ - return false; - } - else { - // Move the caret to the left of current position - currPos.thi = nthi; - } - return true; - } - - /** - * Move caret right by one character. - * @param currPos the current position of the caret - * @return true if caret moved else false - */ - protected boolean moveCaretRight(TextLayoutHitInfo currPos){ - TextHitInfo nthi = currPos.tli.layout.getNextRightHit(currPos.thi); - if(nthi == null){ - return false; - } - else { - currPos.thi = nthi; - } - return true; - } - -// public void setJustify(boolean justify){ -// stext.setJustify(justify); -// bufferInvalid = true; -// } - - /** - * Sets the local colour scheme for this control - */ - public void setLocalColorScheme(int cs){ - super.setLocalColorScheme(cs); -// if(hsb != null) -// hsb.setLocalColorScheme(localColorScheme); -// if(vsb != null) -// vsb.setLocalColorScheme(localColorScheme); - } - - @Override - public void setTabManager(GTabManager tm){ - tabManager = tm; - } - - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GScrollbar.java b/Processing/libraries/G4P/src/g4p_controls/GScrollbar.java deleted file mode 100644 index bcfb9be..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GScrollbar.java +++ /dev/null @@ -1,299 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import g4p_controls.HotSpot.HSrect; -import processing.core.PApplet; -import processing.event.MouseEvent; - -/** - * This class is only used by the GDropList, GTextField and GTextArea components to provide - * a scrollbar. - * - * @author Peter Lager - * - */ -class GScrollbar extends GAbstractControl { - - private static float CORNER_RADIUS = 6; - private static final int TRACK = 5; - - protected float value = 0.2f; - protected float filler = .5f; - protected boolean autoHide = true; - protected boolean currOverThumb = false; - protected boolean isValueChanging = false; - - protected float last_ox, last_oy; - - /** - * Create the scroll bar - * @param theApplet - * @param p0 - * @param p1 - * @param p2 - * @param p3 - */ - public GScrollbar(PApplet theApplet, float p0, float p1, float p2, float p3) { - super(theApplet, p0, p1, p2, p3); - hotspots = new HotSpot[]{ - new HSrect(1, 0, 0, 16, height), // low cap - new HSrect(2, width - 16, 0, 16, height), // high cap - new HSrect(9, 17, 0, width - 17, height) // thumb track - }; - - opaque = false; - z = Z_SLIPPY; - registeredMethods = DRAW_METHOD | MOUSE_METHOD; - cursorOver = HAND; - // Must register control - G4P.registerControl(this); - } - - /** - * If set to true then the scroll bar is only displayed when needed. - * - * @param autoHide - */ - public void setAutoHide(boolean autoHide){ - if(this.autoHide != autoHide){ - this.autoHide = autoHide; - if(this.autoHide && filler > 0.99999f) - visible = false; - bufferInvalid = true; - } - } - - /** - * Set the position of the thumb. If the value forces the thumb - * past the end of the scrollbar, reduce the filler. - * - * @param value must be in the range 0.0 to 1.0 - */ - public void setValue(float value){ - if(value + filler > 1) - filler = 1 - value; - this.value = value; - if(autoHide && filler > 0.99999f) - visible = false; - else - visible = true; - bufferInvalid = true; - } - - /** - * Set the value and the thumb size. Force the value to be valid - * depending on filler. - * @param value must be in the range 0.0 to 1.0 - * @param filler must be >0 and <= 1 - */ - public void setValue(float value, float filler){ - if(value + filler > 1) - value = 1 - filler; - this.value = value; - this.filler = filler; - if(autoHide && this.filler > 0.99999f) - visible = false; - else - visible = true; - bufferInvalid = true; - } - - /** - * Get the current value of the scrolbar - * @return - */ - public float getValue(){ - return value; - } - - /** - * All GUI components are registered for mouseEvents - */ - public void mouseEvent(MouseEvent event){ - if(!visible || !enabled || !available) return; - - calcTransformedOrigin(winApp.mouseX, winApp.mouseY); - - int spot = whichHotSpot(ox, oy); - - // If over the track then see if we are over the thumb - if(spot >= 9 && isOverThumb(ox, oy)) - spot = 10; - -// if(spot >= 9){ -// if(isOverThumb(ox, oy)) -// spot = 10; -// else -// spot = -1; // Over empty track so ignore -// } - if(spot != currSpot){ - currSpot = spot; - bufferInvalid = true; - } - - if(currSpot >= 0 || focusIsWith == this) - cursorIsOver = this; - else if(cursorIsOver == this) - cursorIsOver = null; - - switch(event.getAction()){ - case MouseEvent.PRESS: - if(focusIsWith != this && currSpot>= 0 && z > focusObjectZ()){ - dragging = false; - last_ox = ox; last_oy = oy; - takeFocus(); - } - break; - case MouseEvent.CLICK: - if(focusIsWith == this){ - switch(currSpot){ - case 1: - value -= 0.1f; - if(value < 0) - value = 0; - bufferInvalid = true; - fireEvent(this, GEvent.CHANGED); - break; - case 2: - value += 0.1f; - if(value + filler > 1.0) - value = 1 - filler; - bufferInvalid = true; - fireEvent(this, GEvent.CHANGED); - break; - } - dragging = false; - loseFocus(parent); - } - break; - case MouseEvent.WHEEL: - if(currSpot > -1 && z >= focusObjectZ()){ - float pv = value + event.getCount() * 0.01f * G4P.wheelForScrollbar; - pv = pv < 0 ? 0 : pv > 1 ? 1 : pv; - setValue(pv, filler); - isValueChanging = true; - bufferInvalid = true; - dragging = true; - fireEvent(this, GEvent.CHANGED); - } - break; - case MouseEvent.RELEASE: - if(focusIsWith == this && dragging){ - loseFocus(parent); - dragging = false; - isValueChanging = false; - bufferInvalid = true; - } - break; - case MouseEvent.DRAG: - if(focusIsWith == this && spot == 10){ - float movement = ox - last_ox; - last_ox = ox; - float deltaV = movement / (width - 32); - value += deltaV; - value = PApplet.constrain(value, 0, 1.0f - filler); - isValueChanging = true; - bufferInvalid = true; - dragging = true; - fireEvent(this, GEvent.CHANGED); - } - break; - } - } - - protected boolean isOverThumb(float px, float py){ - float p = (px - 16) / (width - 32); - boolean over =( p >= value && p < value + filler); - return over; - } - - protected void updateBuffer(){ - if(bufferInvalid) { - bufferInvalid = false; - buffer.beginDraw(); - if(opaque) { - buffer.background(buffer.color(255,0)); - buffer.fill(palette[6].getRGB()); - buffer.noStroke(); - buffer.rect(8,0,width-16,height); - } - else - buffer.background(buffer.color(255,0)); - // Draw the track - buffer.fill(palette[TRACK].getRGB()); - buffer.noStroke(); - buffer.rect(8,3,width-8,height-5); - - // **************************************** - buffer.strokeWeight(1); - buffer.stroke(3); - - // Draw the low cap - if(currSpot == 1) - buffer.fill(palette[6].getRGB()); - else - buffer.fill(palette[4].getRGB()); - buffer.rect(1, 1, 15, height-2, CORNER_RADIUS, CORNER_RADIUS, CORNER_RADIUS, CORNER_RADIUS); - - // Draw the high cap - if(currSpot == 2) - buffer.fill(palette[6].getRGB()); - else - buffer.fill(palette[4].getRGB()); - buffer.rect(width - 15, 1, 14.5f, height-2, CORNER_RADIUS, CORNER_RADIUS, CORNER_RADIUS, CORNER_RADIUS); - - // draw thumb - float thumbWidth = (width - 32) * filler; - buffer.translate((width - 32) * value + 16, 0); - if(currSpot == 10) - buffer.fill(palette[6].getRGB()); - else - buffer.fill(palette[4].getRGB()); - buffer.rect(1,1,thumbWidth-1, height-2, CORNER_RADIUS, CORNER_RADIUS, CORNER_RADIUS, CORNER_RADIUS); - - buffer.endDraw(); - } - } - - public void draw(){ - if(!visible) return; - if(bufferInvalid) - updateBuffer(); - - winApp.pushStyle(); - winApp.pushMatrix(); - - winApp.translate(cx, cy); - winApp.rotate(rotAngle); - winApp.imageMode(PApplet.CENTER); - if(alphaLevel < 255) - winApp.tint(TINT_FOR_ALPHA, alphaLevel); - winApp.image(buffer, 0, 0); - - winApp.popMatrix(); - winApp.popStyle(); - } - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GSketchPad.java b/Processing/libraries/G4P/src/g4p_controls/GSketchPad.java deleted file mode 100644 index cfa9d93..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GSketchPad.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import processing.core.PApplet; -import processing.core.PGraphics; - -/** - * Display area for user generated graphics.
- * - * This control will display a PGraphics object created and updated by the user. - * If the size of the users graphic is different from the control the output will be - * rescaled to fit the control size irrespective of the aspect ratio. - * - * @author Peter Lager - * - */ -public class GSketchPad extends GAbstractControl { - - // Scale graphic should be set to true if the grpahics object - // and this sketch pad object are of different sizes. - protected boolean scaleGraphic = false; - - protected PGraphics pad = null; - - public GSketchPad(PApplet theApplet, float p0, float p1, float p2, float p3) { - super(theApplet, p0, p1, p2, p3); - cursorOver = G4P.mouseOff; // does not change - registeredMethods = DRAW_METHOD; - G4P.registerControl(this); - } - - public void setGraphic(PGraphics pg){ - if(pg == null) - return; - pad = pg; - scaleGraphic = (int)width != pg.width || (int)height != pg.height; - } - - public void draw(){ - if(!visible) return; - - winApp.pushStyle(); - winApp.pushMatrix(); - // Perform the rotation - winApp.translate(cx, cy); - winApp.rotate(rotAngle); - // Move matrix to line up with top-left corner - winApp.translate(-halfWidth, -halfHeight); - // Draw buffer - winApp.imageMode(PApplet.CORNER); - if(alphaLevel < 255) - winApp.tint(TINT_FOR_ALPHA, alphaLevel); - if(pad != null){ - try { - if(scaleGraphic) - winApp.image(pad, 0, 0, width, height); - else - winApp.image(pad, 0, 0); -// System.out.println("Graphic updated with alpha " + alphaLevel); - } - catch(Exception excp){ /* Do nothing */ } - } -// winApp.noFill(); -// winApp.stroke(palette[3]); -// winApp.strokeWeight(1.5f); -// winApp.rect(0, 0, width, height); - winApp.popMatrix(); - winApp.popStyle(); - } - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GSlider.java b/Processing/libraries/G4P/src/g4p_controls/GSlider.java deleted file mode 100644 index 0851878..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GSlider.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import g4p_controls.HotSpot.HScircle; -import g4p_controls.HotSpot.HSrect; - -import java.awt.Graphics2D; - -import processing.core.PApplet; - -/** - * A simple graphical slider. - * - * Either drag the thumb or click on the track to change the slider value.
- * - * Supports
- * user defined limits (ascending or descending values)
- * numeric display for limits and current value
- * track ticks and stick to ticks
- * - * - * @author Peter Lager - * - */ -public class GSlider extends GLinearTrackControl { - - public GSlider(PApplet theApplet, float p0, float p1, float p2, float p3, float tr_width) { - super(theApplet, p0, p1, p2, p3); - trackWidth = tr_width; - trackDisplayLength = width - 2 * TINSET; - trackLength = trackDisplayLength - trackWidth; - trackOffset = calcTrackOffset(); - - hotspots = new HotSpot[]{ - new HScircle(THUMB_SPOT, width/2 + (parametricPos - 0.5f) * trackLength, height/2, trackWidth/2 ), // thumb - new HSrect(TRACK_SPOT, (width-trackLength)/2, (height-trackWidth)/2, trackLength, trackWidth), // track - }; - z = Z_SLIPPY; - - epsilon = 0.98f / trackLength; - - ssStartLimit = new StyledString("0.00"); - ssEndLimit = new StyledString("1.00"); - ssValue = new StyledString("0.50"); - - // Now register control with applet - createEventHandler(G4P.sketchWindow, "handleSliderEvents", - new Class[]{ GValueControl.class, GEvent.class }, - new String[]{ "slider", "event" } - ); - registeredMethods = PRE_METHOD | DRAW_METHOD | MOUSE_METHOD; - cursorOver = HAND; - G4P.registerControl(this); - } - - protected void updateDueToValueChanging(){ - hotspots[0].x = (width/2 + (parametricPos - 0.5f) * trackLength); - } - - /** - * Enable or disable the ability of the component to generate mouse events.
- * GTextField - it also controls key press events
- * GPanel - controls whether the panel can be moved/collapsed/expanded
- * @param enable true to enable else false - */ - public void setEnabled(boolean enable){ - super.setEnabled(enable); - if(!enable) - status = OFF_CONTROL; - } - - // Palette index constants - static int BACK = 6; - static int TOFF = 3, TOVER = 11, TDOWN = 14, TDRAG = 15; - - protected void updateBuffer(){ - if(bufferInvalid) { - bufferInvalid = false; - buffer.beginDraw(); - Graphics2D g2d = buffer.g2; - g2d.setFont(localFont); - - buffer.rectMode(PApplet.CENTER); - buffer.ellipseMode(PApplet.CENTER); - // Back ground colour - buffer.background(opaque ? palette[6].getRGB() : palette[2].getRGB() & 0xFFFFFF); - - // Draw track, thumb, ticks etc. - buffer.pushMatrix(); - buffer.translate(width/2, height/2); - // draw ticks - if(showTicks){ - float delta = 1.0f / (nbrTicks - 1); - for(int i = 0; i < nbrTicks; i++){ - float tickx = ((i * delta - 0.5f)*trackLength); - buffer.strokeWeight(2); - buffer.stroke(palette[4].getRGB()); - buffer.line(tickx, -trackWidth, tickx, trackWidth); - buffer.strokeWeight(1.2f); - buffer.stroke(palette[1].getRGB()); - buffer.line(tickx, -trackWidth, tickx, trackWidth); - } - } - - // Draw track surface - buffer.fill(palette[5].getRGB()); - buffer.stroke(palette[3].getRGB()); - buffer.strokeWeight(2); - buffer.rect(0, 0, trackDisplayLength, trackWidth, trackWidth ); - - - // Draw thumb - switch(status){ - case OFF_CONTROL: - buffer.fill(palette[TOFF].getRGB()); - break; - case OVER_CONTROL: - buffer.fill(palette[TOVER].getRGB()); - break; - case PRESS_CONTROL: - buffer.fill(palette[TDOWN].getRGB()); - break; - case DRAG_CONTROL: - buffer.fill(palette[TDRAG].getRGB()); - break; - } - buffer.noStroke(); - buffer.ellipse((parametricPos - 0.5f) * trackLength, 0, trackWidth, trackWidth); - - - // Display slider values - g2d.setColor(palette[2]); - if(labels != null){ - drawLabels(g2d); - } - else { - if(showLimits) - drawLimits(g2d); - // Display slider value - if(showValue) - drawValue(g2d); - } - buffer.popMatrix(); - buffer.endDraw(); - } - } - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GSlider2D.java b/Processing/libraries/G4P/src/g4p_controls/GSlider2D.java deleted file mode 100644 index 8ea71ad..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GSlider2D.java +++ /dev/null @@ -1,607 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2013 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import g4p_controls.HotSpot.HSrect; -import processing.core.PApplet; -import processing.event.MouseEvent; - -/** - * This slider is used to control 2 variables by dragging the thumb over - * a 2D surface. It has all the features of the standard slider (GSlider) - * except that it does not have ticks or stick-to-ticks functionality.
- * - * If no limits are set then the control will return a value in the range - * 0.0 to 1.0 for both the x and the y axis. The setXlimits and setYlimits - * can be used to set a different range for each axis independently. - * - * The minimum size for this control is 40x40 pixels and this is enforced - * when the control is created. If necessary the width and/or height the - * rectangle will be increased to 40pixels.
- * - * @author Peter Lager - * - */ -public class GSlider2D extends GValueControl2D { - - // Palette index constants - static int DBORDER = 1, LBORDER = 3, BACK = 6; - static int TBORDER = 15, TOFF = 3, TOVER = 11, TDOWN = 14, TDRAG = 15; - - static final float THUMB_SIZE = 10; - static final float HALF_THUMB_SIZE = THUMB_SIZE / 2; - static final float BORDER_WIDTH = 2; - - // Define the drag area for this control - protected float dragWidth, dragHeight, dragD; - - protected int downHotSpot = -1; - // Mouse over status - protected int status = OFF_CONTROL; - - protected float startXlimit = 0, endXlimit = 1; - protected float startYlimit = 0, endYlimit = 1; - - /** - * Create a 2D slider inside the specified rectangle. - * @param theApplet - * @param p0 - * @param p1 - * @param p2 - * @param p3 - */ - public GSlider2D(PApplet theApplet, float p0, float p1, float p2, float p3) { - super(theApplet, p0, p1, p2, p3); - // Enforce minimum size constraint - if(width < 40 || height < 40) - resize(PApplet.max(Math.round(width),40), PApplet.max(Math.round(height),40)); - - dragWidth = width - THUMB_SIZE - 2 * BORDER_WIDTH; - dragHeight = height - THUMB_SIZE - 2 * BORDER_WIDTH; - dragD = 2 + THUMB_SIZE/2; - - hotspots = new HotSpot[]{ - new HSrect(THUMB_SPOT, dragD - HALF_THUMB_SIZE + parametricPosX * dragWidth, - dragD - HALF_THUMB_SIZE + parametricPosY * dragHeight, THUMB_SIZE, THUMB_SIZE ), // thumb - new HSrect(TRACK_SPOT, dragD, dragD, dragWidth, dragHeight) // track - }; - z = Z_SLIPPY; - - epsilon = 0.98f / PApplet.max(dragWidth, dragHeight); - opaque = true; - - // Now register control with applet - createEventHandler(G4P.sketchWindow, "handleSlider2DEvents", - new Class[]{ GSlider2D.class, GEvent.class }, - new String[]{ "slider2d", "event" } - ); - registeredMethods = PRE_METHOD | DRAW_METHOD | MOUSE_METHOD; - cursorOver = HAND; - G4P.registerControl(this); - } - - /** - * Updates thumb hotspot due changes caused by easing - */ - protected void updateDueToValueChanging(){ - hotspots[0].x = dragD - HALF_THUMB_SIZE + parametricPosX * dragWidth; - hotspots[0].y = dragD - HALF_THUMB_SIZE + parametricPosY * dragHeight; - } - - - /** - * Set the amount of easing to be used when a value is changing. The default value - * is 1 (no easing) values > 1 will cause the value to rush from its starting value - * and decelerate towards its final values. In other words it smoothes the movement - * of the slider thumb or knob rotation. - * - * @param easeBy the easing to set - */ - public void setEasing(float easeBy) { - easing = (easeBy < 1) ? 1 : easeBy; - } - - /** - * X (horz) limits - * Sets the range of values to be returned. This method will - * assume that you want to set the valueType to INTEGER - * - * @param start the start value of the range - * @param end the end value of the range - */ - public void setXlimits(int start, int end){ - startXlimit = start; - endXlimit = end; - setEpsilon(); - valueType = INTEGER; - bufferInvalid = true; - } - - /** - * X (horz) limits - * Sets the initial value and the range of values to be returned. This - * method will assume that you want to set the valueType to INTEGER. - * - * @param initValue the initial value - * @param start the start value of the range - * @param end the end value of the range - */ - public void setLimitsX(int initValue, int start, int end){ - startXlimit = start; - endXlimit = end; - valueType = INTEGER; - setEpsilon(); - bufferInvalid = true; - setValueX(initValue); - updateDueToValueChanging(); - } - - /** - * X (horz) limits - * Sets the range of values to be returned. This method will - * assume that you want to set the valueType to DECIMAL - * - * @param start - * @param end - */ - public void setLimitsX(float start, float end){ - startXlimit = start; - endXlimit = end; - if(valueType == INTEGER){ - valueType = DECIMAL; - setPrecision(1); - } - setEpsilon(); - bufferInvalid = true; - } - - /** - * X (horz) limits - * Sets the initial value and the range of values to be returned. This - * method will assume that you want to set the valueType to DECIMAL. - * - * @param initValue the initial value - * @param start the start value of the range - * @param end the end value of the range - */ - public void setLimitsX(float initValue, float start, float end){ - startXlimit = start; - endXlimit = end; - initValue = PApplet.constrain(initValue, start, end); - if(valueType == INTEGER){ - valueType = DECIMAL; - setPrecision(1); - } - setEpsilon(); - bufferInvalid = true; - setValueX(initValue); - updateDueToValueChanging(); - } - - /** - * Y (vert) limits - * Sets the range of values to be returned. This method will - * assume that you want to set the valueType to INTEGER - * - * @param start the start value of the range - * @param end the end value of the range - */ - public void setLimitsY(int start, int end){ - startYlimit = start; - endYlimit = end; - setEpsilon(); - valueType = INTEGER; - bufferInvalid = true; - } - - /** - * Y (vert) limits - * Sets the initial value and the range of values to be returned. This - * method will assume that you want to set the valueType to INTEGER. - * - * @param initValue the initial value - * @param start the start value of the range - * @param end the end value of the range - */ - public void setLimitsY(int initValue, int start, int end){ - startYlimit = start; - endYlimit = end; - valueType = INTEGER; - setEpsilon(); - bufferInvalid = true; - setValueY(initValue); - updateDueToValueChanging(); - } - - /** - * Y (vert) limits - * Sets the range of values to be returned. This method will - * assume that you want to set the valueType to DECIMAL - * - * @param start - * @param end - */ - public void setLimitsY(float start, float end){ - startYlimit = start; - endYlimit = end; - if(valueType == INTEGER){ - valueType = DECIMAL; - setPrecision(1); - } - setEpsilon(); - bufferInvalid = true; - } - - /** - * Y (vert) limits - * Sets the initial value and the range of values to be returned. This - * method will assume that you want to set the valueType to DECIMAL. - * - * @param initValue the initial value - * @param start the start value of the range - * @param end the end value of the range - */ - public void setLimitsY(float initValue, float start, float end){ - startYlimit = start; - endYlimit = end; - initValue = PApplet.constrain(initValue, start, end); - if(valueType == INTEGER){ - valueType = DECIMAL; - setPrecision(1); - } - setEpsilon(); - bufferInvalid = true; - setValueY(initValue); - updateDueToValueChanging(); - } - - /** - * Set the X (horz) value for the slider.
- * The value supplied will be constrained to the current limits. - * @param v the new value - */ - public void setValueX(float v){ - if(valueType == INTEGER) - v = Math.round(v); - float t = (v - startXlimit) / (endXlimit - startXlimit); - t = PApplet.constrain(t, 0.0f, 1.0f); - parametricTargetX = t; - } - - /** - * Set the Y (vert) value for the slider.
- * The value supplied will be constrained to the current limits. - * @param v the new value - */ - public void setValueY(float v){ - if(valueType == INTEGER) - v = Math.round(v); - float t = (v - startYlimit) / (endYlimit - startYlimit); - t = PApplet.constrain(t, 0.0f, 1.0f); - parametricTargetY = t; - } - - /** - * Set both the XY values for the slider.
- * The values supplied will be constrained to the appropriate current limits. - * @param vx the new X (horz) value - * @param vy the new Y (vert) value - */ - public void setValueXY(float vx, float vy){ - setValueX(vx); - setValueY(vy); - } - - /** - * Get the current X value as a float - */ - public float getValueXF(){ - return startXlimit + (endXlimit - startXlimit) * parametricPosX; - } - - /** - * Get the current X value as an integer.
- * DECIMAL and EXPONENT value types will be rounded to the nearest integer. - */ - public int getValueXI(){ - return Math.round(getValueXF()); - } - - /** - * Get the current X value as a string taking into account the number format.
- */ - public String getValueXS(){ - return getNumericDisplayString(getValueXF()); - } - - /** - * Get the current Y value as a float - */ - public float getValueYF(){ - return startYlimit + (endYlimit - startYlimit) * parametricPosY; - } - - /** - * Get the current Y value as an integer.
- * DECIMAL and EXPONENT value types will be rounded to the nearest integer. - */ - public int getValueYI(){ - return Math.round(getValueYF()); - } - - /** - * Get the current Y value as a string taking into account the number format.
- */ - public String getValueYS(){ - return getNumericDisplayString(getValueYF()); - } - - /** - * Used to format the number into a string for display. - * @param number - * @return the number formated as a string - */ - protected String getNumericDisplayString(float number){ - String s = ""; - switch(valueType){ - case INTEGER: - s = String.format("%d", Math.round(number)); - break; - case DECIMAL: - s = String.format("%." + precision + "f", number); - break; - case EXPONENT: - s = String.format("%." + precision + "e", number); - break; - } - return s.trim(); - } - - /** - * For DECIMAL values this sets the number of decimal places to - * be displayed. - * @param nd must be >= 1 otherwise will use 1 - */ - public void setPrecision(int nd){ - nd = PApplet.constrain(nd, 1, 5); - if(nd < 1) - nd = 1; - if(nd != precision){ - precision = nd; - setEpsilon(); - bufferInvalid = true; - } - } - - /** - * Set the numberFormat and precision in one go.
- * Valid number formats are INTEGER, DECIMAL, EXPONENT
- * Precision must be >= 1 and is ignored for INTEGER. - * - * @param numberFormat G4P.INTEGER, G4P.DECIMAL orG4P. EXPONENT - * @param precision must be >= 1 - */ - public void setNumberFormat(int numberFormat, int precision){ - switch(numberFormat){ - case INTEGER: - case DECIMAL: - case EXPONENT: - this.valueType = numberFormat; - break; - default: - valueType = DECIMAL; - } - setPrecision(precision); - bufferInvalid = true; - } - - /** - * Set the numberFormat and precision in one go.
- * Valid number formats are INTEGER, DECIMAL, EXPONENT
- * Precision must be >= 1 and is ignored for INTEGER. - * - * @param numberFormat G4P.INTEGER, G4P.DECIMAL or G4P.EXPONENT - */ - public void setNumberFormat(int numberFormat){ - switch(numberFormat){ - case INTEGER: - case DECIMAL: - case EXPONENT: - this.valueType = numberFormat; - break; - default: - valueType = DECIMAL; - } - bufferInvalid = true; - } - - public void mouseEvent(MouseEvent event){ - if(!visible || !enabled || !available) return; - - calcTransformedOrigin(winApp.mouseX, winApp.mouseY); - currSpot = whichHotSpot(ox, oy); - // Make ox,oy relative to top-left of drag area - ox -= dragD; - oy -= dragD; - - if(currSpot >= 0 || focusIsWith == this) - cursorIsOver = this; - else if(cursorIsOver == this) - cursorIsOver = null; - - switch(event.getAction()){ - case MouseEvent.PRESS: - if(focusIsWith != this && currSpot > -1 && z >= focusObjectZ()){ - downHotSpot = currSpot; - status = (downHotSpot == THUMB_SPOT) ? PRESS_CONTROL : OFF_CONTROL; - offsetH = ox - parametricPosX * dragWidth; // normalised - offsetV = oy - parametricPosY * dragHeight; // normalised - takeFocus(); - bufferInvalid = true; - } - break; - case MouseEvent.CLICK: - if(focusIsWith == this){ - parametricTargetX = ox / dragWidth; - parametricTargetY = oy / dragHeight; - dragging = false; - status = OFF_CONTROL; - loseFocus(null); - bufferInvalid = true; - } - break; - case MouseEvent.RELEASE: - if(focusIsWith == this && dragging){ - if(downHotSpot == THUMB_SPOT){ - mouseUpdateTargets(); - } - status = OFF_CONTROL; - bufferInvalid = true; - loseFocus(null); - } - dragging = false; - break; - case MouseEvent.DRAG: - if(focusIsWith == this){ - status = DRAG_CONTROL; - dragging = true; - if(downHotSpot == THUMB_SPOT){ - mouseUpdateTargets(); - bufferInvalid = true; - } - } - break; - case MouseEvent.MOVE: - int currStatus = status; - // If dragged state will stay as PRESSED - if(currSpot == THUMB_SPOT) - status = OVER_CONTROL; - else - status = OFF_CONTROL; - if(currStatus != status) - bufferInvalid = true; - break; - } - } - - /** - * Convenience method called during mouse event handling - */ - private void mouseUpdateTargets(){ - parametricTargetX = ox / dragWidth; - if(parametricTargetX < 0){ - parametricTargetX = 0; - offsetH = 0; - } - else if(parametricTargetX > 1){ - parametricTargetX = 1; - offsetH = 0; - } - parametricTargetY = oy / dragHeight; - if(parametricTargetY < 0){ - parametricTargetY = 0; - offsetV = 0; - } - else if(parametricTargetY > 1){ - parametricTargetY = 1; - offsetV = 0; - } - } - - public void draw(){ - if(!visible) return; - // Update buffer if invalid - updateBuffer(); - winApp.pushStyle(); - - winApp.pushMatrix(); - // Perform the rotation - winApp.translate(cx, cy); - winApp.rotate(rotAngle); - winApp.pushMatrix(); - // Move matrix to line up with top-left corner - winApp.translate(-halfWidth, -halfHeight); - // Draw buffer - winApp.imageMode(PApplet.CORNER); - if(alphaLevel < 255) - winApp.tint(TINT_FOR_ALPHA, alphaLevel); - winApp.image(buffer, 0, 0); - winApp.popMatrix(); - winApp.popMatrix(); - - winApp.popStyle(); - } - - protected void updateBuffer(){ - if(bufferInvalid) { - bufferInvalid = false; - buffer.beginDraw(); - - buffer.ellipseMode(PApplet.CENTER); - buffer.rectMode(PApplet.CENTER); - // Back ground colour - if(opaque == true) - buffer.background(palette[BACK].getRGB()); - else - buffer.background(buffer.color(255,0)); - - buffer.pushMatrix(); - // Draw thumb cursor lines - float tx = dragD + parametricPosX * dragWidth; - float ty = dragD + parametricPosY * dragHeight; - buffer.stroke(palette[TBORDER].getRGB()); - buffer.strokeWeight(1); - buffer.line(0, ty, width, ty); - buffer.line(tx, 0, tx, height); - switch(status){ - case OFF_CONTROL: - buffer.fill(palette[TOFF].getRGB()); - break; - case OVER_CONTROL: - buffer.fill(palette[TOVER].getRGB()); - break; - case PRESS_CONTROL: - buffer.fill(palette[TDOWN].getRGB()); - break; - case DRAG_CONTROL: - buffer.fill(palette[TDRAG].getRGB()); - break; - } - buffer.rect(tx, ty, THUMB_SIZE, THUMB_SIZE); - - // Draw control border - buffer.rectMode(PApplet.CORNERS); - buffer.noFill(); - buffer.stroke(palette[LBORDER].getRGB()); - buffer.strokeWeight(2); - buffer.rect(0,0,width-1,height-1); - buffer.stroke(palette[DBORDER].getRGB()); - buffer.strokeWeight(1); - buffer.rect(1,1,width-1,height-1); - - buffer.popMatrix(); - buffer.endDraw(); - } - } -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GStick.java b/Processing/libraries/G4P/src/g4p_controls/GStick.java deleted file mode 100644 index e296683..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GStick.java +++ /dev/null @@ -1,431 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import g4p_controls.HotSpot.HScircle; -import processing.core.PApplet; -import processing.event.MouseEvent; - -/** - * This control simulates a digital joystick and is designed to give more - * intuitive control in game scenarios where you might use the keyboard - * e.g. WASD keys for movement.
- * - * The joystick has two modes - in the default mode the joystick just - * responds to movement in 4 directions (left,right, up and down) the - * second mode allows for diagonals so recognises 8 directions.
- * - * As in a real joystick you have a dead zone near the centre which - * does not generate signals, thus avoiding jitter. This area is shown - * graphically.
- * - * The direction of the joystick is represented by an integer in the - * range 0-7 and -1 when in the dead zone.
- *
- *     5   6   7
- * 		\  |  /
- *       \ | /
- *   4 --- + --- 0         + is the dea zone so -1
- *       / | \
- *      /  |  \
- *     3   2   1
- * 

- * As well as the direction there are two useful methods to decode these - * into X and Y directions -
getStickX()
and
getStickY()
- * which give the values.
- *
- * X= -1   0   +1 
- * 		\  |  /  -1
- *       \ | /
- *     --- + ---  0
- *       / | \
- *      /  |  \
- *           Y=  +1
- * 

- * The stick will auto-center when released.
- * - * The minimum size for this control is 40x40 pixels and this is enforced - * when the control is created. If necessary the width and/or height the - * rectangle will be increased to 40pixels. - * - * @author Peter Lager - * - */ -public class GStick extends GAbstractControl { - // palette index constants - protected static final int BORDERS = 0; - protected static final int LED_INACTIVE = 1; - protected static final int LED_ACTIVE = 14; - protected static final int STICK = 0; - protected static final int STICK_TOP = 3; - protected static final int STICK_TOP_OVER = 11; - protected static final int STICK_TOP_PRESS = 14; - protected static final int STICK_TOP_DRAG = 15; - protected static final int OUTERRING = 6; - protected static final int ACTIONRING = 5; - protected static final int BACK = 6; - protected static final int ROD = 1; - //angle constants - protected static final float RAD90 = PApplet.radians(90); - protected static final float RAD45 = PApplet.radians(45); - protected static final float RAD22_5 = PApplet.radians(22.5f); - - - protected static final int[] posMap = new int[] { 0x01, 0x07, 0x04, 0x1c, 0x10, 0x70, 0x40, 0xc1 }; - protected static final int[] posX = new int[] { 1, 1, 0, -1, -1, -1, 0, 1 }; - protected static final int[] posY= new int[] { 0, 1, 1, 1, 0, -1, -1, -1 }; - - - protected final float ledWidth, ledHeight; - protected float ledRingRad; - - protected float actionRad, actionRadLimit, gripRad, rodRad; - protected float rodLength = 0, stickAngle; - - protected int position = -1; - protected int mode = X4; // X4 or X8 - protected int status = OFF_CONTROL; - - /** - * Create the stick inside the specified rectangle. - * @param theApplet - * @param p0 - * @param p1 - * @param p2 - * @param p3 - */ - public GStick(PApplet theApplet, float p0, float p1, float p2, float p3) { - super(theApplet, p0, p1, p2, p3); - // Enforce minimum size constraint - if(width < 40 || height < 40) - resize(PApplet.max(Math.round(width),40), PApplet.max(Math.round(height),40)); - - opaque = false; - // Calculate stick metrics - float stickSize = PApplet.min(width, height); - float mag = stickSize/50; - ledWidth = 6 * mag; - ledHeight = 1.6f * ledWidth; - ledRingRad = (stickSize - ledWidth - 3)/2; - actionRad = 0.50f * ledRingRad; - gripRad = 4.0f * mag; - rodRad = 3.0f * mag; - actionRadLimit = ledRingRad - gripRad - ledWidth/2; - - hotspots = new HotSpot[]{ - new HScircle(1, width/2, height/2, gripRad) - }; - z = Z_SLIPPY; - - // Now register control with applet - createEventHandler(G4P.sketchWindow, "handleStickEvents", - new Class[]{ GStick.class, GEvent.class }, - new String[]{ "stick", "event" } - ); - registeredMethods = DRAW_METHOD | MOUSE_METHOD ; - cursorOver = HAND; - G4P.registerControl(this); - } - - /** - * Sets the stick mode to either 4 or 8 directions.
- * If the mode parameter should be either G4P.X4 or G4P.X8 any - * other value will be silently ignored - * - * @param m the new mode - */ - public void setMode(int m){ - if(m != mode && m == X4 || m == X8){ - mode = m; - bufferInvalid = true; - } - } - - /** - * Get the current mode - */ - public int getMode(){ - return mode; - } - - /** - * Returns the current position of the stick based on
- *
-	 *     5   6   7
-	 * 		\  |  /
-	 *       \ | /
-	 *   4 --- + --- 0         + is the dea zone so -1
-	 *       / | \
-	 *      /  |  \
-	 *     3   2   1
-	 * 

- * @return current stick direction - */ - public int getPosition(){ - return position; - } - - /** - * Get the X position of the stick from
- * *
-	 * X= -1   0   +1 
-	 * 		\  |  /  -1
-	 *       \ | /
-	 *     --- + ---  0
-	 *       / | \
-	 *      /  |  \
-	 *           Y=  +1
-	 * 

- * @return the X value (-1, 0 or 1) - */ - public int getStickX(){ - return (position < 0) ? 0 : posX[position]; - } - - /** - * Get the Y position of the stick from
- * *
-	 * X= -1   0   +1 
-	 * 		\  |  /  -1
-	 *       \ | /
-	 *     --- + ---  0
-	 *       / | \
-	 *      /  |  \
-	 *           Y=  +1
-	 * 

- * @return the Y value (-1, 0 or 1) - */ - public int getStickY(){ - return (position < 0) ? 0 : posY[position]; - } - - /** - * Calculate the angle to the knob centre making sure it is in - * the range 0-360 - * @param px relative to centre - * @param py relative to centre - * @return the angle made by the stick - */ - protected float calcStickAngle(float px, float py){ - float a = PApplet.atan2(py, px); - if(a < 0) - a += PApplet.TWO_PI; - return a; - } - - /** - * Calculate the position (mode dependent) from an angle in the range 0-2PI - * @param a the angle 0-2PI - * @return direction (0-7) - */ - protected int getPositionFromAngle(float a){ - int newState; - if(mode == 1){ - a = (a + RAD45) % PApplet.TWO_PI; - newState = 2 * (int)(a / RAD90); - } - else { - a = (a + RAD22_5) % PApplet.TWO_PI; - newState = (int)(a / RAD45); - } - return newState % 8; - } - - public void mouseEvent(MouseEvent event){ - if(!visible || !enabled || !available) return; - - calcTransformedOrigin(winApp.mouseX, winApp.mouseY); - currSpot = whichHotSpot(ox, oy); - // Make ox and oy relative to the centre of the stick - ox -= width/2; - oy -= height/2; - - // currSpot == 1 for text display area - if(currSpot >= 0 || focusIsWith == this) - cursorIsOver = this; - else if(cursorIsOver == this) - cursorIsOver = null; - - switch(event.getAction()){ - case MouseEvent.PRESS: - if(focusIsWith != this && currSpot > -1 && z > focusObjectZ()){ - status = PRESS_CONTROL; - position = -1; - rodLength = PApplet.sqrt(ox*ox + oy*oy); - stickAngle = calcStickAngle(ox, oy); - dragging = false; - takeFocus(); - bufferInvalid = true; - } - break; - case MouseEvent.RELEASE: - if(focusIsWith == this){ - loseFocus(null); - } - // If we are not already near the centre then make it so - // and fire an event - if(position != -1){ - position = -1; - fireEvent(this, GEvent.CHANGED); - } - hotspots[0].adjust(width/2, height/2); - rodLength = stickAngle = 0; - dragging = false; - status = OFF_CONTROL; - bufferInvalid = true; - break; - case MouseEvent.DRAG: - if(focusIsWith == this){ - status = DRAG_CONTROL; - dragging = true; - rodLength = PApplet.sqrt(ox*ox + oy*oy); - stickAngle = calcStickAngle(ox, oy); - int newPosition = -1; - if(rodLength >= actionRad){ - newPosition = getPositionFromAngle(stickAngle); - } - if(rodLength > actionRadLimit){ - ox = actionRadLimit * PApplet.cos(stickAngle); - oy = actionRadLimit * PApplet.sin(stickAngle); - rodLength = actionRadLimit; - } - hotspots[0].adjust(ox + width/2, oy + height/2); - if(newPosition != position){ - position = newPosition; - fireEvent(this, GEvent.CHANGED); - } - bufferInvalid = true; - } - break; - case MouseEvent.MOVE: - int currStatus = status; - // If dragged state will stay as PRESSED - if(currSpot == 1) - status = OVER_CONTROL; - else - status = OFF_CONTROL; - if(currStatus != status) - bufferInvalid = true; - break; - } - } - - public void draw(){ - if(!visible) return; - - // Update buffer if invalid - updateBuffer(); - winApp.pushStyle(); - - winApp.pushMatrix(); - // Perform the rotation - winApp.translate(cx, cy); - winApp.rotate(rotAngle); - // Move matrix to line up with top-left corner - winApp.translate(-halfWidth, -halfHeight); - // Draw buffer - winApp.imageMode(PApplet.CORNER); - if(alphaLevel < 255) - winApp.tint(TINT_FOR_ALPHA, alphaLevel); - winApp.image(buffer, 0, 0); - winApp.popMatrix(); - - winApp.popStyle(); - } - - protected void updateBuffer(){ - if(bufferInvalid) { - bufferInvalid = false; - buffer.beginDraw(); - // Back ground colour - if(opaque == true) - buffer.background(palette[BACK].getRGB()); - else - buffer.background(buffer.color(255,0)); - // Move origin to centre - - buffer.translate(width/2, height/2); - - buffer.fill(palette[OUTERRING].getRGB()); - buffer.stroke(palette[BORDERS].getRGB()); - buffer.strokeWeight(1.0f); - buffer.ellipse(0,0,2*ledRingRad, 2*ledRingRad); - buffer.ellipse(0,0,2*actionRad, 2*actionRad); - // Draw everything except the stick - buffer.pushMatrix(); - int led = 0x00000001, delta = 2/mode; - for(int i = 0; i < 8; i += delta){ - buffer.stroke(palette[BORDERS].getRGB()); - buffer.strokeWeight(1.0f); - buffer.line(0,0,ledRingRad,0); - // Only draw LEDs on even directions - if(i%2 == 0){ - buffer.noStroke(); - if(position >= 0 && (posMap[position] & led) == led) - buffer.fill(palette[LED_ACTIVE].getRGB()); - else - buffer.fill(palette[LED_INACTIVE].getRGB()); - buffer.ellipse(ledRingRad,0,ledWidth,ledHeight); - } - led <<= delta; - buffer.rotate(delta * RAD45); - } - buffer.popMatrix(); - - // Draw the inactive area near the centre of the - buffer.fill(palette[ACTIONRING].getRGB()); - buffer.stroke(palette[BORDERS].getRGB()); - buffer.strokeWeight(1.0f); - buffer.ellipse(0,0,2*actionRad, 2*actionRad); - - // Draw the rod and button - buffer.pushMatrix(); - buffer.rotate(stickAngle); - buffer.noStroke(); - buffer.fill(palette[ROD].getRGB()); - buffer.ellipse(0,0,2*rodRad,2*rodRad); - buffer.rect(0,-rodRad,rodLength,2*rodRad); - buffer.strokeWeight(1); - buffer.stroke(palette[ROD].getRGB()); - // Draw thumb - switch(status){ - case OFF_CONTROL: - buffer.fill(palette[STICK_TOP].getRGB()); - break; - case OVER_CONTROL: - buffer.fill(palette[STICK_TOP_OVER].getRGB()); - break; - case PRESS_CONTROL: - buffer.fill(palette[STICK_TOP_PRESS].getRGB()); - break; - case DRAG_CONTROL: - buffer.fill(palette[STICK_TOP_DRAG].getRGB()); - break; - } - buffer.ellipse(rodLength,0,2*gripRad, 2*gripRad); - buffer.popMatrix(); - buffer.endDraw(); - } - } -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GTabManager.java b/Processing/libraries/G4P/src/g4p_controls/GTabManager.java deleted file mode 100644 index f229c04..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GTabManager.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import java.util.LinkedList; - -/** - * Allows TABBING between text controls. - * A tab manager allows the user to use the TAB key to move from one text control - * (GTextField or GTextArea) to the another. This is useful when creating a 'form' - * made from several text controls.
- * The tab order is decided by the order the text controls are added to the tab - * manager. The TAB key move the focus forwards and SHIFT+TAB moves it backwards. - * Note that tabbing is not cyclic so pressing TAB on the last control does not - * set the focus on the first control, in fact it will be ignored. Similar - * logic applies to SHIFT_TAB on the first control
- * At least 2 controls must be added to the tab manager. - * - * @author Peter Lager - * - */ -public class GTabManager { - - private LinkedList textControls; - - public GTabManager(){ - textControls = new LinkedList(); - } - - /** - * Attempt to add multiple controls to the tab manager. The tab order is determined - * by their order as parameters to this method. - * - * @param controls a comma separated list of text field or text area controls. - * @return true if any or all of the controls were added and false if none were added. - */ - public boolean addControls(Focusable... controls){ - boolean result = false; - for(Focusable control : controls) - result |= addControl(control); - return result; - } - - /** - * Add the next text control to this tab manager. - * - * @param control to add - * @return true if added successfully - */ - public boolean addControl(Focusable control){ - if(!textControls.contains(control)){ - control.setTabManager(this); - textControls.addLast(control); - return true; - } - return false; - } - - /** - * Remove a control from the tab manager. This does not affect the tab - * order of the remaining controls. - * - * @param control - * @return true if remove successfully - */ - public boolean removeControl(Focusable control){ - int index = textControls.lastIndexOf(control); - if(index > 0){ - control.setTabManager(null); - textControls.remove(index); - return true; - } - return false; - } - - /** - * Used when the tab key is pressed to move to the next control - * @param control - * @return true if it found a next control else false - */ - boolean nextControl(Focusable control){ - int index = textControls.lastIndexOf(control); - if(textControls.size() > 1 && index >= 0 && index < textControls.size() - 1){ - index++; - GAbstractControl.controlToTakeFocus = (GAbstractControl)textControls.get(index);; - return true; - } - return false; - } - - /** - * Used when the shift+tab key is pressed to move to the previous control - * @param control - * @return true if it found a previous control else false - */ - boolean prevControl(Focusable control){ - int index = textControls.lastIndexOf(control); - if(textControls.size() > 1 && index > 0){ - index--; - GAbstractControl.controlToTakeFocus = (GAbstractControl)textControls.get(index); - return true; - } - return false; - } - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GTextAlign.java b/Processing/libraries/G4P/src/g4p_controls/GTextAlign.java deleted file mode 100644 index 2b288ec..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GTextAlign.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import processing.core.PApplet; - - -/** - * - * Is the basis for all classes that have some simple non-editable text element to them.
- * - * @author Peter Lager - * - */ -public abstract class GTextAlign extends GTextBase { - - protected GAlign textAlignH = GAlign.CENTER, textAlignV = GAlign.MIDDLE; - - protected float stX, stY; - - public GTextAlign(PApplet theApplet, float p0, float p1, float p2, float p3) { - super(theApplet, p0, p1, p2, p3); - } - - /** - * Set the horizontal and/or vertical text alignment. Use the constants in GAlign - * e.g.
GAlign.LEFT

- * - * If you want to set just one of these then pass null in the other - * - * @param horz LEFT, CENTER, RIGHT or JUSTIFY - * @param vert TOP, MIDDLE, BOTTOM - */ - public void setTextAlign(GAlign horz, GAlign vert){ - if(horz != null && horz.isHorzAlign()){ - textAlignH = horz; - stext.setJustify(textAlignH == GAlign.JUSTIFY); - } - if(vert != null && vert.isVertAlign()){ - textAlignV = vert; - } - bufferInvalid = true; - } - - /** - * Combines setting the text and text alignment in one method.
- * - * If you want to set just one of the alignments then pass null - * in the other. - * - * @param text - * @param horz LEFT, CENTER, RIGHT or JUSTIFY - * @param vert TOP, MIDDLE, BOTTOM - */ - public void setText(String text, GAlign horz, GAlign vert){ - setText(text); - setTextAlign(horz, vert); - bufferInvalid = true; - } - - protected void calcAlignment(){ - switch(textAlignH){ - case RIGHT: - stX = width - stext.getWrapWidth() - TPAD2; - break; - case LEFT: - case CENTER: - case JUSTIFY: - default: - stX = TPAD2; - } - switch(textAlignV){ - case TOP: - stY = TPAD2; - break; - case BOTTOM: - stY = height - stext.getTextAreaHeight() - TPAD2; - break; - case MIDDLE: - default: - stY = (height - stext.getTextAreaHeight()) / 2; - } - } - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GTextArea.java b/Processing/libraries/G4P/src/g4p_controls/GTextArea.java deleted file mode 100644 index 1af389a..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GTextArea.java +++ /dev/null @@ -1,1112 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import g4p_controls.HotSpot.HSrect; -import g4p_controls.StyledString.TextLayoutHitInfo; -import g4p_controls.StyledString.TextLayoutInfo; - -import java.awt.Graphics2D; -import java.awt.Shape; -import java.awt.font.TextAttribute; -import java.awt.font.TextHitInfo; -import java.awt.font.TextLayout; -import java.awt.geom.GeneralPath; -import java.util.LinkedList; - -import processing.core.PApplet; -import processing.core.PGraphics; -import processing.event.MouseEvent; - -/** - * The text area component.
- * - * This control allows the user to enter and edit multiple lines of text. The control - * also allows default text, horizontal and vertical scrollbars.
- * - * Enables user to enter text at runtime. Text can be selected using the mouse - * or keyboard shortcuts and then copied or cut to the clipboard. Text - * can also be pasted in.
- * - * There are some methods to add and clear text attributes to all or some of the - * text in the control. If a method is expecting a line number, you should specify - * the actual line number for the entire text (lines numbers start at 0). It is - * not the line number in the visible display because this can change if the text - * has been scrolled vertically.
- * - * - * Fires SELECTION_CHANGED, CHANGED, ENTERED, LOST_FOCUS, GETS_FOCUS events.
- * The focus events are only fired if the control is added to a GTabManager object.
- * - * @author Peter Lager - * - */ -public class GTextArea extends GEditableTextControl { - - protected boolean newline = false, backspace = false; - - /** - * Create a text area without scrollbars and a text wrap width to fit the control. - * - * @param theApplet - * @param p0 - * @param p1 - * @param p2 - * @param p3 - */ - public GTextArea(PApplet theApplet, float p0, float p1, float p2, float p3) { - this(theApplet, p0, p1, p2, p3, SCROLLBARS_NONE, Integer.MAX_VALUE); - } - - /** - * Create a text field with the given scrollbar policy and a text wrap width to fit the control.
- * The scrollbar policy can be one of these
- *
    - *
  • SCROLLBARS_NONE
  • - *
  • SCROLLBARS_HORIZONTAL_ONLY
  • - *
  • SCROLLBARS_VERTICAL_ONLY
  • - *
  • SCROLLBARS_BOTH
  • - *
- * If you want the scrollbar to auto hide then perform a logical or with - *
    - *
  • SCROLLBARS_AUTOHIDE
  • - *
- * e.g. SCROLLBARS_BOTH | SCROLLBARS_AUTOHIDE - *
- * @param theApplet - * @param p0 - * @param p1 - * @param p2 - * @param p3 - * @param sbPolicy - */ - public GTextArea(PApplet theApplet, float p0, float p1, float p2, float p3, int sbPolicy) { - this(theApplet, p0, p1, p2, p3, sbPolicy, Integer.MAX_VALUE); - } - - /** - * Create a text field with the given scrollbar policy with a user specified text wrap length
- * - * @param theApplet - * @param p0 - * @param p1 - * @param p2 - * @param p3 - * @param sbPolicy - * @param wrapWidth - */ - public GTextArea(PApplet theApplet, float p0, float p1, float p2, float p3, int sbPolicy, int wrapWidth) { - super(theApplet, p0, p1, p2, p3, sbPolicy); - children = new LinkedList(); - tx = ty = TPAD6; - tw = width - 2 * TPAD6 - ((scrollbarPolicy & SCROLLBAR_VERTICAL) != 0 ? 18 : 0); - th = height - 2 * TPAD6 - ((scrollbarPolicy & SCROLLBAR_HORIZONTAL) != 0 ? 18 : 0); - // The text wrap width is based on the width of the text display area unless - // some other value is specified. - this.wrapWidth = (wrapWidth == Integer.MAX_VALUE) ? (int)tw : wrapWidth; - // Clip zone - gpTextDisplayArea = new GeneralPath(); - gpTextDisplayArea.moveTo( 0, 0); - gpTextDisplayArea.lineTo( 0, th); - gpTextDisplayArea.lineTo(tw, th); - gpTextDisplayArea.lineTo(tw, 0); - gpTextDisplayArea.closePath(); - - hotspots = new HotSpot[]{ - new HSrect(1, tx, ty, tw, th), // typing area - new HSrect(9, 0, 0, width, height) // control surface - }; - // Create scrollbars - G4P.pushStyle(); - G4P.showMessages = false; - z = Z_STICKY; - G4P.control_mode = GControlMode.CORNER; - if((scrollbarPolicy & SCROLLBAR_HORIZONTAL) != 0){ - hsb = new GScrollbar(theApplet, 0, 0, tw, 16); - addControl(hsb, tx, ty + th + 2, 0); - hsb.addEventHandler(this, "hsbEventHandler"); - hsb.setAutoHide(autoHide); - } - if((scrollbarPolicy & SCROLLBAR_VERTICAL) != 0){ - vsb = new GScrollbar(theApplet, 0, 0, th, 16); - addControl(vsb, tx + tw + 18, ty, PI/2); - vsb.addEventHandler(this, "vsbEventHandler"); - vsb.setAutoHide(autoHide); - } - setScrollbarValues(0,0); - G4P.popStyle(); - - setText(""); - createEventHandler(G4P.sketchWindow, "handleTextEvents", - new Class[]{ GEditableTextControl.class, GEvent.class }, - new String[]{ "textcontrol", "event" } - ); - registeredMethods = PRE_METHOD | DRAW_METHOD | MOUSE_METHOD | KEY_METHOD; - // Must register control - G4P.registerControl(this); - bufferInvalid = true; - } - - protected void setTextImpl(String text, int wrapWidth){ - if(text != null){ - // Change empty string to a 'space' character - text = text.length() > 0 ? text : " "; - stext.setText(text, wrapWidth); - setStyledText(stext); - bufferInvalid = true; - } - } - - /** - * Set the text to display and adjust any scrollbars - * @param text text to display - * @param wrapWidth the wrap width - */ - public void setText(String text, int wrapWidth){ - setTextImpl(text, wrapWidth); - } - - /** - * Set the text to be used. The wrap width is determined by the current - * text wrapwidth or if there is no text then the text width - * of the control. - * - * @param text to be displayed - */ - public void setText(String text){ - // Set the wrap width the same as the control - setTextImpl(text, wrapWidth); - } - - /** - * Set the text to display and adjust any scrollbars - * @param lines an array of Strings representing the text to display - */ - public void setText(String[] lines){ - if(lines != null && lines.length > 0) - setTextImpl(PApplet.join(lines, "\n"), wrapWidth); - } - - - /** - * Set the text to display and adjust any scrollbars - * @param lines an array of Strings representing the text to display - * @param wrapWidth the wrap width - */ - public void setText(String[] lines, int wrapWidth){ - if(lines != null && lines.length > 0) - setTextImpl(PApplet.join(lines, "\n"), wrapWidth); - } - - /** - * Get the text as a String array. (splitting on line breaks). - * - * @return the associated plain text as a String array split on line breaks - */ - public String[] getTextAsArray(){ - return stext.getPlainTextAsArray(); - } - - /** - * Adds the text attribute to a range of characters on a particular display line. If charEnd - * is past the EOL then the attribute will be applied to the end-of-line. - * - * @param attr the text attribute to add - * @param value value of the text attribute - * @param lineNo the display line number (starts at 0) - * @param charStart the position of the first character to apply the attribute - * @param charEnd the position after the last character to apply the attribute - */ - public void addStyle(TextAttribute attr, Object value, int lineNo, int charStart, int charEnd){ - stext.addAttribute(attr, value, lineNo, charStart, charEnd); - bufferInvalid = true; - } - - /** - * Adds the text attribute to an entire display line. - * - * @param attr the text attribute to add - * @param value value of the text attribute - * @param lineNo the display line number (starts at 0) - */ - public void addStyle(TextAttribute attr, Object value, int lineNo){ - stext.addAttribute(attr, value, lineNo); - bufferInvalid = true; - } - - /** - * Clears all text attribute from a range of characters on a particular display line. - * If charEnd is past the EOL then the attributes will be cleared to the - * end-of-line. - * - * @param lineNo the display line number (starts at 0) - * @param charStart the position of the first character to apply the attribute - * @param charEnd the position after the last character to apply the attribute - */ - public void clearStyles(int lineNo, int charStart, int charEnd){ - stext.clearAttributes(lineNo, charStart, charEnd); - bufferInvalid = true; - } - - /** - * Clears all text attribute from an entire display line. - * - * @param lineNo the display line number (starts at 0) - */ - public void clearStyles(int lineNo){ - stext.clearAttributes(lineNo); - bufferInvalid = true; - } - - /** - * Set the styled text to be displayed. - * - */ - public void setStyledText(StyledString st){ - stext = st; - if(stext.getWrapWidth() == Integer.MAX_VALUE) - stext.setWrapWidth(wrapWidth); - else - wrapWidth = stext.getWrapWidth(); - stext.getLines(buffer.g2); - if(stext.getNbrLines() > 0){ - endTLHI.tli = stext.getLines(buffer.g2).getFirst(); - endTLHI.thi = endTLHI.tli.layout.getNextLeftHit(1); - startTLHI.copyFrom(endTLHI); - calculateCaretPos(endTLHI); - keepCursorInView = true; - } - ptx = pty = 0; - setScrollbarValues(ptx,pty); - bufferInvalid = true; - } - - /** - * Add text to the end of the current text. This is useful for a logging' type activity.
- * - * No events will be generated and the caret will be moved to the end of any appended text.
- * - * @param text the text to append - * @return true if some characters were added - */ - public boolean appendText(String text){ - if(text == null || text.equals("") || stext.insertCharacters(text, stext.length(), true, false) == 0) - return false; - LinkedList lines = stext.getLines(buffer.g2); - endTLHI.tli = lines.getLast(); - endTLHI.thi = endTLHI.tli.layout.getNextRightHit(endTLHI.tli.nbrChars - 1); - startTLHI.copyFrom(endTLHI); - calculateCaretPos(endTLHI); - setScrollbarValues(ptx,pty); - bufferInvalid = true; - return true; - } - - - /** - * Insert text at the display position specified.
- * - * The area line number starts at 0 and includes any lines scrolled off the top. So if - * three lines have been scrolled off the top the first visible line is number 3.
- * - * No events will be generated and the caret will be moved to the end of any inserted text.
- * - * @param text the text to insert - * @param lineNo the area line number - * @param charNo the character position to insert text in display line - * @return true if some characters were inserted - */ - public boolean insertText(String text, int lineNo, int charNo){ - return insertText(text, lineNo, charNo, false, false); - } - - /** - * Insert text at the display position specified.
- * - * The area line number starts at 0 and includes any lines scrolled off the top. So if - * three lines have been scrolled off the top the first visible line is number 3.
- * - * No events will be generated and the caret will be moved to the end of any inserted text.
- * - * @param text the text to insert - * @param lineNo the area line number - * @param charNo the character position to insert text in display line - * @param startWithEOL if true,inserted text will start on newline - * @param endWithEOL if true, text after inserted text will start on new line - * @return true if some characters were inserted - */ - public boolean insertText(String text, int lineNo, int charNo, boolean startWithEOL, boolean endWithEOL){ - if(text != null && text.length() > 0){ - int pos = stext.getPos(lineNo, charNo); - int change = stext.insertCharacters(text, lineNo, charNo, startWithEOL, endWithEOL); - // displayCaretPos("Caret starts at "); - if(change != 0){ - // Move caret to end of insert if possible - pos += change; - TextLayoutHitInfo tlhi = stext.getTLHIforCharPosition(pos); - if(tlhi != null){ - endTLHI.copyFrom(tlhi); - moveCaretLeft(endTLHI); - startTLHI.copyFrom(endTLHI); - // displayCaretPos("Caret ends at "); - calculateCaretPos(tlhi); - keepCursorInView = true; - showCaret = true; - } - setScrollbarValues(ptx,pty); - bufferInvalid = true; - return true; - } - } - return false; - } - - /** - * Insert text at the current caret position. If the current caret position is undefined - * the text will be inserted at the beginning of the text.
- * - * No events will be generated and the caret will be moved to the end of any inserted text.
- * - * @param text the text to insert - * @param startWithEOL if true,inserted text will start on newline - * @param endWithEOL if true, text after inserted text will start on new line - * @return true if some characters were inserted - */ - public boolean insertText(String text, boolean startWithEOL, boolean endWithEOL){ - int lineNo = 0, charNo = 0; - if(endTLHI.tli != null && endTLHI.thi != null){ - lineNo = endTLHI.tli.lineNo; - charNo = endTLHI.thi.getCharIndex(); - } - return insertText(text, lineNo, charNo, startWithEOL, endWithEOL); - } - - /** - * Insert text at the current caret position. If the current caret position is undefined - * the text will be inserted at the beginning of the text.
- * - * No events will be generated and the caret will be moved to the end of any inserted text.
- * - * @param text the text to insert - * @return true if some characters were inserted - */ - public boolean insertText(String text){ - return insertText(text, false, false); - } - - // For debugging only - @SuppressWarnings("unused") - private void displayCaretPos(String title){ - if(endTLHI != null && endTLHI.tli != null && endTLHI.thi != null){ - System.out.println(title + " :: Carat on line " + endTLHI.tli.lineNo + " at char " + endTLHI.thi.getCharIndex()); - } - else { - System.out.println(title + " :: unknown caret position"); - } - } - - // private void updateScrollbars(float hvalue){ - // if(vsb != null){ - // float vfiller = Math.min(1, th/stext.getTextAreaHeight()); - // vsb.setValue(1 - vfiller, vfiller); - // keepCursorInView = true; - // } - // // If needed update the horizontal scrollbar - // if(hsb != null){ - // //float hvalue = lines.getLast().layout.getVisibleAdvance(); - // float hlinelength = stext.getMaxLineLength(); - // float hfiller = Math.min(1, tw/hlinelength); - // if(caretX < tw) - // hsb.setValue(0,hfiller); - // else - // hsb.setValue(hvalue/hlinelength, hfiller); - // keepCursorInView = true; - // } - // } - - /** - * Get the text on a particular line in the text area.
- * The line does not need to be visible and the line numbers - * always start at 0.
- * The result is not dependent on what is visible at any - * particular time but on the overall position in text area - * control.
- * If the line number is invalid then an empty string is returned.
- * Trailing EOL characters are removed. - * - * @param lineNo the text area line number we want - * @return the plain text in a display line - */ - public String getText(int lineNo){ - Graphics2D g2d = buffer.g2; - // Get the latest lines of text - LinkedList lines = stext.getLines(g2d); - if(lineNo < 0 || lineNo >= lines.size()) - return ""; - TextLayoutInfo tli = lines.get(lineNo); - String s = stext.getPlainText(tli.startCharIndex, tli.startCharIndex + tli.nbrChars); - // Strip off trailing EOL - int p = s.length() - 1; - while(p > 0 && s.charAt(p) == EOL) - p--; - return (p == s.length() - 1) ? s : s.substring(0, p+1); - } - - /** - * Get the length of text on a particular line in the text area.
- * The line does not need to be visible and the line numbers - * always start at 0.
- * The result is not dependent on what is visible at any - * particular time but on the overall position in text area - * control.
- * If ignoreEOL is true then EOL characters are not included in the count. - * - * @param lineNo the text area line number we want - * @param ignoreEOL if true do not include trailing end=of-line characters - * @return the length of the line, or <) if the line number is invalid - */ - public int getTextLength(int lineNo, boolean ignoreEOL){ - Graphics2D g2d = buffer.g2; - // Get the latest lines of text - LinkedList lines = stext.getLines(g2d); - if(lineNo < 0 || lineNo >= lines.size()) - return -1; - TextLayoutInfo tli = lines.get(lineNo); - // String s = stext.getPlainText(tli.startCharIndex, tli.startCharIndex + tli.nbrChars); - String s = stext.getPlainText(); - int len = tli.nbrChars; - if(ignoreEOL){ - // Strip off trailing EOL - int p = tli.startCharIndex + tli.nbrChars-1; - while(p > tli.startCharIndex && s.charAt(p) == EOL){ - p--; - len--; - } - } - return len; - } - - /** - * If the buffer is invalid then redraw it. - */ - protected void updateBuffer(){ - if(bufferInvalid) { - bufferInvalid = false; - buffer.beginDraw(); - Graphics2D g2d = buffer.g2; - g2d.setFont(localFont); - // Get the latest lines of text - LinkedList lines = stext.getLines(g2d); - - boolean usePromptText = promptText != null && !hasFocus() && (lines.isEmpty() || stext.getPlainText().equals("") || stext.getPlainText().equals(" ")); - if(usePromptText) - lines = promptText.getLines(g2d); - - TextLayoutHitInfo startSelTLHI = null, endSelTLHI = null; - // Whole control surface if opaque - if(opaque) - buffer.background(palette[6].getRGB()); - else - buffer.background(buffer.color(255,0)); - - // Now move to top left corner of text display area - buffer.translate(tx,ty); - - // Typing area surface - buffer.noStroke(); - buffer.fill(palette[7].getRGB()); - buffer.rect(-1,-1,tw+2,th+2); - - g2d.setClip(gpTextDisplayArea); - buffer.translate(-ptx, -pty); - // Translate in preparation for display selection and text - - if(hasFocus() && stext.getPlainText().equals(" ")){ - lines = stext.getLines(buffer.g2); - startTLHI = new TextLayoutHitInfo(lines.getFirst(), null); - startTLHI.thi = startTLHI.tli.layout.getNextLeftHit(1); - - endTLHI = new TextLayoutHitInfo(lines.getLast(), null); - int lastChar = endTLHI.tli.layout.getCharacterCount(); - endTLHI.thi = startTLHI.tli.layout.getNextRightHit(lastChar-1); - } - - if(hasSelection()){ - if(endTLHI.compareTo(startTLHI) == -1){ - startSelTLHI = endTLHI; - endSelTLHI = startTLHI; - } - else { - startSelTLHI = startTLHI; - endSelTLHI = endTLHI; - } - } - - // Display selection and text - for(TextLayoutInfo lineInfo : lines){ - TextLayout layout = lineInfo.layout; - buffer.translate(0, layout.getAscent()); - // Draw selection if any - if(!usePromptText && hasSelection() && lineInfo.compareTo(startSelTLHI.tli) >= 0 && lineInfo.compareTo(endSelTLHI.tli) <= 0 ){ - int ss = 0; - ss = (lineInfo.compareTo(startSelTLHI.tli) == 0) ? startSelTLHI.thi.getInsertionIndex() : 0; - int ee = endSelTLHI.thi.getInsertionIndex(); - ee = (lineInfo.compareTo(endSelTLHI.tli) == 0) ? endSelTLHI.thi.getInsertionIndex() : lineInfo.nbrChars-1; - g2d.setColor(palette[14]); - Shape selShape = layout.getLogicalHighlightShape(ss, ee); - g2d.fill(selShape); - } - // display text - g2d.setColor(palette[2]); - lineInfo.layout.draw(g2d, 0, 0); - buffer.translate(0, layout.getDescent() + layout.getLeading()); - } - g2d.setClip(null); - buffer.endDraw(); - } - } - - public void pre(){ - if(keepCursorInView){ - boolean horzScroll = false, vertScroll = false; - float max_ptx = caretX - tw + 2; - float max_pty = caretY - th + 2 * stext.getMaxLineHeight(); - - if(endTLHI != null){ - if(ptx > caretX){ // LEFT? - ptx -= HORZ_SCROLL_RATE; - if(ptx < 0) ptx = 0; - horzScroll = true; - } - else if(ptx < max_ptx){ // RIGHT? - ptx += HORZ_SCROLL_RATE; - if(ptx > max_ptx) ptx = max_ptx; - horzScroll = true; - } - if(pty > caretY){ // UP? - pty -= VERT_SCROLL_RATE; - if(pty < 0) pty = 0; - vertScroll = true; - } - else if(pty < max_pty){ // DOWN? - pty += VERT_SCROLL_RATE; - vertScroll = true; - } - if(horzScroll && hsb != null) - hsb.setValue(ptx / (stext.getMaxLineLength() + 4)); - if(vertScroll && vsb != null) - vsb.setValue(pty / (stext.getTextAreaHeight() + 1.5f * stext.getMaxLineHeight())); - } - // If we have scrolled invalidate the buffer otherwise forget it - if(horzScroll || vertScroll) - bufferInvalid = true; - else - keepCursorInView = false; - } - } - - public void draw(){ - if(!visible) return; - - // Update buffer if invalid - updateBuffer(); - winApp.pushStyle(); - winApp.pushMatrix(); - // Perform the rotation - winApp.translate(cx, cy); - winApp.rotate(rotAngle); - - winApp.pushMatrix(); - // Move matrix to line up with top-left corner - winApp.translate(-halfWidth, -halfHeight); - // Draw buffer - winApp.imageMode(PApplet.CORNER); - if(alphaLevel < 255) - winApp.tint(TINT_FOR_ALPHA, alphaLevel); - winApp.image(buffer, 0, 0); - - // Draw caret if text display area - if(focusIsWith == this && showCaret && endTLHI != null){ - float[] cinfo = endTLHI.tli.layout.getCaretInfo(endTLHI.thi); - float x_left = - ptx + cinfo[0]; - float y_top = - pty + endTLHI.tli.yPosInPara; - float y_bot = y_top - cinfo[3] + cinfo[5]; - if(x_left >= 0 && x_left <= tw && y_top >= 0 && y_bot <= th){ - winApp.strokeWeight(1.5f); - winApp.stroke(palette[12].getRGB()); - winApp.line(tx+x_left, ty + Math.max(0, y_top), tx+x_left, ty + Math.min(th, y_bot)); - } - } - winApp.popMatrix(); - // Draw scrollbars - if(children != null){ - for(GAbstractControl c : children) - c.draw(); - } - winApp.popMatrix(); - winApp.popStyle(); - } - - public PGraphics getSnapshot(){ - updateBuffer(); - PGraphics snap = winApp.createGraphics(buffer.width, buffer.height, PApplet.JAVA2D); - snap.beginDraw(); - snap.image(buffer,0,0); - if(hsb != null){ - snap.pushMatrix(); - snap.translate(hsb.getX(), hsb.getY()); - snap.image(hsb.getBuffer(), 0, 0); - snap.popMatrix(); - } - if(vsb != null){ - snap.pushMatrix(); - //snap.translate(vsb.getX(), vsb.getY() - vsb.width); - snap.translate(width - TPAD6, TPAD6); - snap.rotate(PApplet.PI/2); - snap.image(vsb.getBuffer(), 0, 0); - snap.popMatrix(); - } - snap.endDraw(); - return snap; - } - - protected void keyPressedProcess(int keyCode, char keyChar, boolean shiftDown, boolean ctrlDown){ - boolean validKeyCombo = true; - - switch(keyCode){ - case LEFT: - moveCaretLeft(endTLHI); - break; - case RIGHT: - moveCaretRight(endTLHI); - break; - case UP: - moveCaretUp(endTLHI); - break; - case DOWN: - moveCaretDown(endTLHI); - break; - case GConstants.HOME: - if(ctrlDown) // move to start of text - moveCaretStartOfText(endTLHI); - else // Move to start of line - moveCaretStartOfLine(endTLHI); - break; - case GConstants.END: - if(ctrlDown) // move to end of text - moveCaretEndOfText(endTLHI); - else // Move to end of line - moveCaretEndOfLine(endTLHI); - break; - case 'A': - if(ctrlDown){ - moveCaretStartOfText(startTLHI); - moveCaretEndOfText(endTLHI); - // Make shift down so that the start caret position is not - // moved to match end caret position. - shiftDown = true; - } - else - validKeyCombo = false; - break; - case 'C': - if(ctrlDown) - GClip.copy(getSelectedText()); - validKeyCombo = false; - break; - case 'V': - if(ctrlDown){ - String p = GClip.paste(); - if(p.length() > 0){ - // delete selection and add - if(hasSelection()) - stext.deleteCharacters(pos, nbr); - stext.insertCharacters(p, pos); - adjust = p.length(); - textChanged = true; - } - } - else - validKeyCombo = false; - break; - default: - validKeyCombo = false; - } - - if(validKeyCombo){ - calculateCaretPos(endTLHI); - //**************************************************************** - // If we have moved to the end of a paragraph marker - if(caretX > stext.getWrapWidth()){ - switch(keyCode){ - case LEFT: - case UP: - case DOWN: - case END: - moveCaretLeft(endTLHI); - validKeyCombo = true; - break; - case RIGHT: - if(!moveCaretRight(endTLHI)) - moveCaretLeft(endTLHI); - validKeyCombo = true; - } - // Calculate new caret position - // calculateCaretPos(startTLHI); - calculateCaretPos(endTLHI); - } - //**************************************************************** - - calculateCaretPos(endTLHI); - - if(!shiftDown) - startTLHI.copyFrom(endTLHI); - bufferInvalid = true; - } - } - - protected void keyTypedProcess(int keyCode, char keyChar, boolean shiftDown, boolean ctrlDown){ - int ascii = (int)keyChar; - newline = false; - backspace = false; - if(isDisplayable(ascii)){ - if(hasSelection()) - stext.deleteCharacters(pos, nbr); - stext.insertCharacters("" + keyChar, pos); - adjust = 1; textChanged = true; - } - else if(keyChar == BACKSPACE){ - if(hasSelection()){ - stext.deleteCharacters(pos, nbr); - adjust = 0; textChanged = true; - } - else if(stext.deleteCharacters(pos - 1, 1)){ - adjust = -1; textChanged = true; backspace = true; - } - } - else if(keyChar == DELETE){ - if(hasSelection()){ - stext.deleteCharacters(pos, nbr); - adjust = 0; textChanged = true; - } - else if(stext.deleteCharacters(pos, 1)){ - adjust = 0; textChanged = true; - } - } - else if(keyChar == ENTER || keyChar == RETURN) { - fireEvent(this, GEvent.ENTERED); // Ticket 11 - if(stext.insertEOL(pos)){ - adjust = 1; textChanged = true; - newline = true; - } - } - else if(keyChar == TAB){ - // If possible move to next text control - if(tabManager != null){ - boolean result = (shiftDown) ? tabManager.prevControl(this) : tabManager.nextControl(this); - if(result){ - startTLHI.copyFrom(endTLHI); - return; - } - } - } - // If we have emptied the text then recreate a one character string (space) - if(stext.length() == 0){ - stext.insertCharacters(" ", 0); - adjust++; textChanged = true; - } - } - - protected boolean changeText(){ - if(!super.changeText()) - return false; - // The following actions handle multi-line stuff - // Do we have to move cursor to start of next line - if(newline) { - if(pos >= stext.length()){ - stext.insertCharacters(" ", pos); - stext.getLines(buffer.g2); - } - moveCaretRight(endTLHI); - calculateCaretPos(endTLHI); - } - if(backspace && pos > 0){ - char ch = stext.getPlainText().charAt(pos-1); - if(ch == '\n'){ - moveCaretRight(endTLHI); - calculateCaretPos(endTLHI); - } - if(pos >= stext.length()){ - stext.insertCharacters(" ", pos); - stext.getLines(buffer.g2); - } - } - // Finish off by ensuring no selection, invalidate buffer etc. - startTLHI.copyFrom(endTLHI); - return true; - - } - - /** - * Move caret to home position - * @return true if caret moved else false - */ - protected boolean moveCaretStartOfLine(TextLayoutHitInfo currPos){ - if(currPos.thi.getCharIndex() == 0) - return false; // already at start of line - currPos.thi = currPos.tli.layout.getNextLeftHit(1); - return true; - } - - protected boolean moveCaretEndOfLine(TextLayoutHitInfo currPos){ - if(currPos.thi.getCharIndex() == currPos.tli.nbrChars - 1) - return false; // already at end of line - currPos.thi = currPos.tli.layout.getNextRightHit(currPos.tli.nbrChars - 1); - return true; - } - - protected boolean moveCaretStartOfText(TextLayoutHitInfo currPos){ - if(currPos.tli.lineNo == 0 && currPos.thi.getCharIndex() == 0) - return false; // already at start of text - currPos.tli = stext.getTLIforLineNo(0); - currPos.thi = currPos.tli.layout.getNextLeftHit(1); - return true; - } - - protected boolean moveCaretEndOfText(TextLayoutHitInfo currPos){ - if(currPos.tli.lineNo == stext.getNbrLines() - 1 && currPos.thi.getCharIndex() == currPos.tli.nbrChars - 1) - return false; // already at end of text - currPos.tli = stext.getTLIforLineNo(stext.getNbrLines() - 1); - currPos.thi = currPos.tli.layout.getNextRightHit(currPos.tli.nbrChars - 1); - return true; - } - - protected boolean moveCaretUp(TextLayoutHitInfo currPos){ - if(currPos.tli.lineNo == 0) - return false; - TextLayoutInfo ntli = stext.getTLIforLineNo(currPos.tli.lineNo - 1); - TextHitInfo nthi = ntli.layout.hitTestChar(caretX, 0); - currPos.tli = ntli; - currPos.thi = nthi; - return true; - } - - protected boolean moveCaretDown(TextLayoutHitInfo currPos){ - if(currPos.tli.lineNo == stext.getNbrLines() - 1) - return false; - TextLayoutInfo ntli = stext.getTLIforLineNo(currPos.tli.lineNo + 1); - TextHitInfo nthi = ntli.layout.hitTestChar(caretX, 0); - currPos.tli = ntli; - currPos.thi = nthi; - return true; - } - - /** - * Move caret left by one character. If necessary move to the end of the line above - * @return true if caret was moved else false - */ - protected boolean moveCaretLeft(TextLayoutHitInfo currPos){ - TextLayoutInfo ntli; - TextHitInfo nthi = currPos.tli.layout.getNextLeftHit(currPos.thi); - if(nthi == null){ - // Move the caret to the end of the previous line - if(currPos.tli.lineNo == 0) - // Can't goto previous line because this is the first line - return false; - else { - // Move to end of previous line - ntli = stext.getTLIforLineNo(currPos.tli.lineNo - 1); - nthi = ntli.layout.getNextRightHit(ntli.nbrChars-1); - currPos.tli = ntli; - currPos.thi = nthi; - } - } - else { - // Move the caret to the left of current position - currPos.thi = nthi; - } - return true; - } - - /** - * Move caret right by one character. If necessary move to the start of the next line - * @return true if caret was moved else false - */ - protected boolean moveCaretRight(TextLayoutHitInfo currPos){ - TextLayoutInfo ntli; - TextHitInfo nthi = currPos.tli.layout.getNextRightHit(currPos.thi); - if(nthi == null){ - // Move the caret to the start of the next line the previous line - if(currPos.tli.lineNo >= stext.getNbrLines() - 1) - // Can't goto next line because this is the last line - return false; - else { - // Move to start of next line - ntli = stext.getTLIforLineNo(currPos.tli.lineNo + 1); - nthi = ntli.layout.getNextLeftHit(1); - currPos.tli = ntli; - currPos.thi = nthi; - } - } - else { - // Move the caret to the right of current position - currPos.thi = nthi; - } - return true; - } - - /** - * Move the insertion point (caret) to the specified line and character. If the position is invalid - * then the caret is not moved. The text will be scrolled so that the caret position is visible. - * - * @param lineNo the line number (starts at 0) - * @param charNo the character position on the line (starts at 0) - */ - public void moveCaretTo(int lineNo, int charNo){ - try { - TextLayoutHitInfo tlhi = stext.getTLHIforCharPosition(lineNo, charNo); - if(tlhi != null){ - startTLHI.copyFrom(tlhi); - endTLHI.copyFrom(tlhi); - calculateCaretPos(tlhi); - keepCursorInView = true; - showCaret = true; - } - } - catch(Exception e){} - } - - /** - * Get the current caret position.
- * - * The method will always return a 2 element array with the current caret position - * { line no, char no }
- * - * If the current caret position is undefined then it will return the array { -1, -1 } - * - * @return a two element int array holding the caret position. - */ - public int[] getCaretPos(){ - return getCaretPos(null); - } - - /** - * Get the current caret position.
- * - * If the parameter is a 2 element int array then it will be populated with the line number [0] - * and character no [1] of the caret's current position.
- * - * The method will always return a 2 element array with the current caret position - * { line no, char no }
- * - * If the current caret position is undefined then it will return the array { -1, -1 } - * - * @param cpos array to be populated with caret position - * @return a two element int array holding the caret position. - */ - public int[] getCaretPos(int [] cpos){ - if(cpos == null || cpos.length != 2) - cpos = new int[2]; - if(endTLHI == null || endTLHI.tli == null || endTLHI.thi == null){ - cpos[0] = cpos[1] = -1; - } - else { - cpos[0] = endTLHI.tli.lineNo; - cpos[1] = endTLHI.thi.getCharIndex(); - } - return cpos; - } - - /** - * Will respond to mouse events. - */ - public void mouseEvent(MouseEvent event){ - if(!visible || !enabled || !available) return; - - calcTransformedOrigin(winApp.mouseX, winApp.mouseY); - ox -= tx; oy -= ty; // Remove translation - - currSpot = whichHotSpot(ox, oy); - - if(currSpot == 1 || focusIsWith == this) - cursorIsOver = this; - else if(cursorIsOver == this) - cursorIsOver = null; - - switch(event.getAction()){ - case MouseEvent.PRESS: - if(currSpot == 1){ - if(focusIsWith != this && z >= focusObjectZ()){ - keepCursorInView = true; - takeFocus(); - } - dragging = false; - // If there is just a space then select it so it gets deleted on first key press - if(stext.getPlainText().equals("")) - stext.setText(" ", stext.getWrapWidth()); - if(stext.getPlainText().equals(" ")){ - LinkedList lines = stext.getLines(buffer.g2); - startTLHI = new TextLayoutHitInfo(lines.getFirst(), null); - startTLHI.thi = startTLHI.tli.layout.getNextLeftHit(1); - - endTLHI = new TextLayoutHitInfo(lines.getLast(), null); - int lastChar = endTLHI.tli.layout.getCharacterCount(); - endTLHI.thi = startTLHI.tli.layout.getNextRightHit(lastChar-1); - } - else { - endTLHI = stext.calculateFromXY(buffer.g2, ox + ptx, oy + pty); - startTLHI = new TextLayoutHitInfo(endTLHI); - } - calculateCaretPos(endTLHI); - bufferInvalid = true; - } - else { // Not over this control so if we have focus loose it - if(focusIsWith == this) - loseFocus(null); - } - break; - case MouseEvent.RELEASE: - dragging = false; - bufferInvalid = true; - break; - case MouseEvent.DRAG: - if(focusIsWith == this){ - keepCursorInView = true; - dragging = true; - endTLHI = stext.calculateFromXY(buffer.g2, ox + ptx, oy + pty); - calculateCaretPos(endTLHI); - fireEvent(this, GEvent.SELECTION_CHANGED); - bufferInvalid = true; - } - break; - } - } - - protected void calculateCaretPos(TextLayoutHitInfo tlhi){ - float temp[] = tlhi.tli.layout.getCaretInfo(tlhi.thi); - caretX = temp[0]; - caretY = tlhi.tli.yPosInPara; - } - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GTextBase.java b/Processing/libraries/G4P/src/g4p_controls/GTextBase.java deleted file mode 100644 index 6181456..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GTextBase.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2013 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import java.awt.Font; -import java.awt.font.TextAttribute; - -import processing.core.PApplet; - -/** - * Base class for any control that uses styled text. - * - * @author Peter Lager - * - */ -public abstract class GTextBase extends GAbstractControl { - - /** The styled text used by this control */ - protected StyledString stext = new StyledString(""); - - protected Font localFont = G4P.globalFont; - - - /** - * Constructor - * @param theApplet - * @param p0 - * @param p1 - * @param p2 - * @param p3 - */ - public GTextBase(PApplet theApplet, float p0, float p1, float p2, float p3) { - super(theApplet, p0, p1, p2, p3); - setFont(localFont); - } - - /** - * Used internally to enforce minimum size constraints and to enable - * minimising the height used by text icon controls (labels, buttons, - * radio button and checkboxes) - * - * @param w the new width - * @param h the new height - */ - protected void resize(int w, int h){ - super.resize(w, h); - setFont(localFont); - } - - /** - * Set the text to be displayed. - * - * @param text - */ - public void setText(String text){ - if(text == null || text.length() == 0 ) - text = " "; - stext.setText(text, Integer.MAX_VALUE); - bufferInvalid = true; - } - - /** - * Load the styled string to be used by this control. - * - * @param fname the name of the file to use - * @return true if loaded successfully else false - */ - public boolean loadText(String fname){ - StyledString ss = StyledString.load(winApp, fname); - if(ss != null){ - setStyledText(ss); - stext.startIdx = stext.endIdx = -1; - bufferInvalid = true; - return true; - } - return false; - } - - /** - * Save the styled text used by this control to file. - * - * @param fname the name of the file to use - * @return true if saved successfully else false - */ - public boolean saveText(String fname){ - stext.startIdx = stext.endIdx = -1; - StyledString.save(winApp, stext, fname); - return true; - } - - /** - * Set the font to be used in this control - * - * @param font AWT font to use - */ - public void setFont(Font font) { - if(font != null && font != localFont) {// && buffer != null){ - localFont = font; - bufferInvalid = true; - } - } - - /** - * Allows the user to provide their own styled text for this component - * @param ss - */ - public void setStyledText(StyledString ss){ - if(ss != null) { - stext = ss; - stext.setWrapWidth((int)width - TPAD4); - bufferInvalid = true; - } - } - - public void forceBufferUpdate(){ - if(stext != null) - stext.invalidateText(); - bufferInvalid = true; - } - - /** - * Clear all applied styles from the whole text. - */ - public void setTextPlain(){ - stext.clearAttributes(); - bufferInvalid = true; - } - - /** - * Make the selected characters bold.
- * Characters affected are >= start and < end - * - * @param start the first character to style - * @param end the first character not to style - */ - public void setTextBold(int start, int end){ - addAttributeImpl(G4P.WEIGHT, G4P.WEIGHT_BOLD, start, end); - } - - /** - * Make all the characters bold. - */ - public void setTextBold(){ - addAttributeImpl(G4P.WEIGHT, G4P.WEIGHT_BOLD); - } - - /** - * Make the selected characters italic.
- * Characters affected are >= start and < end - * - * @param start the first character to style - * @param end the first character not to style - */ - public void setTextItalic(int start, int end){ - addAttributeImpl(G4P.POSTURE, G4P.POSTURE_OBLIQUE, start, end); - } - - /** - * Make all the characters italic. - */ - public void setTextItalic(){ - addAttributeImpl(G4P.POSTURE, G4P.POSTURE_OBLIQUE); - } - - /** - * Get the text used for this control. - * @return the displayed text with styling - */ - public StyledString getStyledText(){ - return stext; - } - - /** - * Get the text used for this control. - * @return the displayed text without styling - */ - public String getText(){ - return stext.getPlainText(); - } - - /** - * Apply the style to the whole text - * - * @param style the style attribute - * @param value 'amount' to apply - */ - protected void addAttributeImpl(TextAttribute style, Object value){ - stext.addAttribute(style, value); - bufferInvalid = true; - } - - /** - * Apply the style to a portion of the string - * - * @param style the style attribute - * @param value 'amount' to apply - * @param s first character to be included for styling - * @param e the first character not to be included for styling - */ - protected void addAttributeImpl(TextAttribute style, Object value, int s, int e){ - if(s >= e) return; - if(s < 0) s = 0; - if(e > stext.length()) e = stext.length(); - stext.addAttribute(style, value, s, e); - bufferInvalid = true; - } - - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GTextField.java b/Processing/libraries/G4P/src/g4p_controls/GTextField.java deleted file mode 100644 index 831d04d..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GTextField.java +++ /dev/null @@ -1,634 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import g4p_controls.HotSpot.HSrect; -import g4p_controls.StyledString.TextLayoutHitInfo; -import g4p_controls.StyledString.TextLayoutInfo; - -import java.awt.Graphics2D; -import java.awt.Shape; -import java.awt.font.TextLayout; -import java.awt.geom.GeneralPath; -import java.util.LinkedList; - -import processing.core.PApplet; -import processing.core.PGraphics; -import processing.event.KeyEvent; -import processing.event.MouseEvent; - -/** - * The text field component.
- * - * This control allows the user to enter and edit a single line of text. The control - * also allows default text and a horizontal scrollbar. - * - * can be created to manage either a single line of text or - * multiple lines of text.
- * - * Enables user text input at runtime. Text can be selected using the mouse - * or keyboard shortcuts and then copied or cut to the clipboard. Text - * can also be pasted in.
- * - * Fires SELECTION_CHANGED, CHANGED, ENTERED, LOST_FOCUS, GETS_FOCUS events.
- * The focus events are only fired if the control is added to a GTabManager object.
- * - * @author Peter Lager - * - */ -public class GTextField extends GEditableTextControl { - - /** - * Create a text field without a scrollbar. - * - * @param theApplet - * @param p0 - * @param p1 - * @param p2 - * @param p3 - */ - public GTextField(PApplet theApplet, float p0, float p1, float p2, float p3) { - this(theApplet, p0, p1, p2, p3, SCROLLBARS_NONE); - } - - /** - * Create a text field with the given scrollbar policy.
- * This policy can be one of these
- *
    - *
  • SCROLLBARS_NONE
  • - *
  • SCROLLBARS_HORIZONTAL_ONLY
  • - *
- * If you want the scrollbar to auto hide then perform a logical or with - *
    - *
  • SCROLLBARS_AUTOHIDE
  • - *
- * e.g. SCROLLBARS_HORIZONTAL_ONLY | SCROLLBARS_AUTOHIDE - *
- * @param theApplet - * @param p0 - * @param p1 - * @param p2 - * @param p3 - * @param sbPolicy - */ - public GTextField(PApplet theApplet, float p0, float p1, float p2, float p3, int sbPolicy) { - super(theApplet, p0, p1, p2, p3, sbPolicy); - children = new LinkedList(); - tx = ty = 2; - tw = width - 2 * 2; - th = height - ((scrollbarPolicy & SCROLLBAR_HORIZONTAL) != 0 ? 11 : 0); - wrapWidth = Integer.MAX_VALUE; - gpTextDisplayArea = new GeneralPath(); - gpTextDisplayArea.moveTo( 0, 0); - gpTextDisplayArea.lineTo( 0, th); - gpTextDisplayArea.lineTo(tw, th); - gpTextDisplayArea.lineTo(tw, 0); - gpTextDisplayArea.closePath(); - - hotspots = new HotSpot[]{ - new HSrect(1, tx, ty, tw, th), // typing area - new HSrect(9, 0, 0, width, height) // control surface - }; - - G4P.pushStyle(); - G4P.showMessages = false; - - z = Z_STICKY; - - G4P.control_mode = GControlMode.CORNER; - if((scrollbarPolicy & SCROLLBAR_HORIZONTAL) != 0){ - hsb = new GScrollbar(theApplet, 0, 0, tw, 10); - addControl(hsb, tx, ty + th - hsb.halfHeight + 2, 0); - hsb.addEventHandler(this, "hsbEventHandler"); - hsb.setAutoHide(autoHide); - } - G4P.popStyle(); - setText(""); - - createEventHandler(G4P.sketchWindow, "handleTextEvents", - new Class[]{ GEditableTextControl.class, GEvent.class }, - new String[]{ "textcontrol", "event" } - ); - registeredMethods = PRE_METHOD | DRAW_METHOD | MOUSE_METHOD | KEY_METHOD; - - // Must register control - G4P.registerControl(this); - bufferInvalid = true; - } - - /** - * Set the styled text for this textfield after ensuring that all EOL characters - * have been removed. - * @param ss - */ - public void setStyledText(StyledString ss){ - stext = ss.convertToSingleLineText(); - stext.getLines(buffer.g2); - if(stext.getNbrLines() > 0){ - endTLHI.tli = stext.getLines(buffer.g2).getFirst(); - endTLHI.thi = endTLHI.tli.layout.getNextLeftHit(1); - startTLHI.copyFrom(endTLHI); - calculateCaretPos(endTLHI); - keepCursorInView = true; - } - ptx = pty = 0; - // If needed update the horizontal scrollbar - if(hsb != null){ - if(stext.getMaxLineLength() < tw) - hsb.setValue(0, 1); - else - hsb.setValue(0, tw/stext.getMaxLineLength()); - } - bufferInvalid = true; - } - - /** - * Set the text to be displayed. - * - * @param text - */ - public void setText(String text){ - if(text != null){ - stext.setText(text, Integer.MAX_VALUE); - setScrollbarValues(0,0); - bufferInvalid = true; - } - } - - /** - * Add some plain text to the end of the existing text. - * - * @param extraText - */ - public void appendText(String extraText){ - if(extraText == null || extraText.equals("")) - return; - if(stext.insertCharacters(extraText, stext.length()) == 0) - return; - LinkedList lines = stext.getLines(buffer.g2); - endTLHI.tli = lines.getLast(); - endTLHI.thi = endTLHI.tli.layout.getNextRightHit(endTLHI.tli.nbrChars - 1); - startTLHI.copyFrom(endTLHI); - calculateCaretPos(endTLHI); - if(hsb != null){ - float hvalue = lines.getLast().layout.getVisibleAdvance(); - float hlinelength = stext.getMaxLineLength(); - float hfiller = Math.min(1, tw/hlinelength); - if(caretX < tw) - hsb.setValue(0,hfiller); - else - hsb.setValue(hvalue/hlinelength, hfiller); - keepCursorInView = true; - } - bufferInvalid = true; - } - - public PGraphics getSnapshot(){ - updateBuffer(); - PGraphics snap = winApp.createGraphics(buffer.width, buffer.height, PApplet.JAVA2D); - snap.beginDraw(); - snap.image(buffer,0,0); - if(hsb != null){ - snap.pushMatrix(); - snap.translate(hsb.getX(), hsb.getY() - hsb.halfHeight + 4); - snap.image(hsb.getBuffer(), 0, 0); - snap.popMatrix(); - } - snap.endDraw(); - return snap; - } - - public void pre(){ - if(keepCursorInView){ - boolean horzScroll = false; - float max_ptx = caretX - tw + 2; - if(endTLHI != null){ - if(ptx > caretX){ // Scroll to the left (text moves right) - ptx -= HORZ_SCROLL_RATE; - if(ptx < 0) ptx = 0; - horzScroll = true; - } - else if(ptx < max_ptx){ // Scroll to the right (text moves left)? - ptx += HORZ_SCROLL_RATE; - if(ptx > max_ptx) ptx = max_ptx; - horzScroll = true; - } - // Ensure that we show as much text as possible keeping the caret in view - // This is particularly important when deleting from the end of the text - if(ptx > 0 && endTLHI.tli.layout.getAdvance() - ptx < tw - 2){ - ptx = Math.max(0, endTLHI.tli.layout.getAdvance() - tw - 2); - horzScroll = true; - } - if(horzScroll && hsb != null) - hsb.setValue(ptx / (stext.getMaxLineLength() + 4)); - } - // If we have scrolled invalidate the buffer otherwise forget it - if(horzScroll) - bufferInvalid = true; - else - keepCursorInView = false; - } - } - - public void mouseEvent(MouseEvent event){ - if(!visible || !enabled || !available) return; - - calcTransformedOrigin(winApp.mouseX, winApp.mouseY); - ox -= tx; oy -= ty; // Remove translation - - currSpot = whichHotSpot(ox, oy); - - if(currSpot == 1 || focusIsWith == this) - cursorIsOver = this; - else if(cursorIsOver == this) - cursorIsOver = null; - - switch(event.getAction()){ - case MouseEvent.PRESS: - if(currSpot == 1){ - if(focusIsWith != this && z >= focusObjectZ()){ - keepCursorInView = true; - takeFocus(); - } - dragging = false; - // If there is just a space then select it so it gets deleted on first key press - if(stext.getPlainText().equals("")) - stext.setText(" "); - if(stext.getPlainText().equals(" ")){ - LinkedList lines = stext.getLines(buffer.g2); - startTLHI = new TextLayoutHitInfo(lines.getFirst(), null); - startTLHI.thi = startTLHI.tli.layout.getNextLeftHit(1); - - endTLHI = new TextLayoutHitInfo(lines.getLast(), null); - int lastChar = endTLHI.tli.layout.getCharacterCount(); - endTLHI.thi = startTLHI.tli.layout.getNextRightHit(lastChar-1); - } - else { - endTLHI = stext.calculateFromXY(buffer.g2, ox + ptx, oy + pty); - startTLHI = new TextLayoutHitInfo(endTLHI); - } - calculateCaretPos(endTLHI); - bufferInvalid = true; - } - else { // Not over this control so if we have focus loose it - if(focusIsWith == this) - loseFocus(null); - } - break; - case MouseEvent.RELEASE: - dragging = false; - bufferInvalid = true; - break; - case MouseEvent.DRAG: - if(focusIsWith == this){ - keepCursorInView = true; - dragging = true; - endTLHI = stext.calculateFromXY(buffer.g2, ox + ptx, oy + pty); - calculateCaretPos(endTLHI); - fireEvent(this, GEvent.SELECTION_CHANGED); - bufferInvalid = true; - } - break; - } - } - - public void keyEvent(KeyEvent e) { - if(!visible || !enabled || !textEditEnabled || !available) return; - if(focusIsWith == this && endTLHI != null){ - char keyChar = e.getKey(); - int keyCode = e.getKeyCode(); - int keyID = e.getAction(); - boolean shiftDown = e.isShiftDown(); - boolean ctrlDown = e.isControlDown(); - - textChanged = false; - keepCursorInView = true; - - int startPos = pos, startNbr = nbr; - - // Get selection details - endChar = endTLHI.tli.startCharIndex + endTLHI.thi.getInsertionIndex(); - startChar = (startTLHI != null) ? startTLHI.tli.startCharIndex + startTLHI.thi.getInsertionIndex() : endChar; - pos = endChar; - nbr = 0; - adjust = 0; - if(endChar != startChar){ // Have we some text selected? - if(startChar < endChar){ // Forward selection - pos = startChar; nbr = endChar - pos; - } - else if(startChar > endChar){ // Backward selection - pos = endChar; nbr = startChar - pos; - } - } - if(startPos >= 0){ - if(startPos != pos || startNbr != nbr) - fireEvent(this, GEvent.SELECTION_CHANGED); - } - // Select either keyPressedProcess or keyTypeProcess. These two methods are overridden in child classes - if(keyID == KeyEvent.PRESS) { - keyPressedProcess(keyCode, keyChar, shiftDown, ctrlDown); - setScrollbarValues(ptx, pty); - } - else if(keyID == KeyEvent.TYPE ){ // && e.getKey() != KeyEvent.CHAR_UNDEFINED && !ctrlDown){ - keyTypedProcess(keyCode, keyChar, shiftDown, ctrlDown); - setScrollbarValues(ptx, pty); - } - if(textChanged){ - changeText(); - fireEvent(this, GEvent.CHANGED); - } - } - } - - /** - * Do not call this method directly, G4P uses it to handle input from - * the horizontal scrollbar. - */ - public void hsbEventHandler(GScrollbar scrollbar, GEvent event){ - keepCursorInView = false; - ptx = hsb.getValue() * (stext.getMaxLineLength() + 4); - bufferInvalid = true; - } - - protected void keyPressedProcess(int keyCode, char keyChar, boolean shiftDown, boolean ctrlDown){ - boolean validKeyCombo = true; - - switch(keyCode){ - case LEFT: - moveCaretLeft(endTLHI); - break; - case RIGHT: - moveCaretRight(endTLHI); - break; - case GConstants.HOME: - moveCaretStartOfLine(endTLHI); - break; - case GConstants.END: - moveCaretEndOfLine(endTLHI); - break; - case 'A': - if(ctrlDown){ // Ctrl + A select all - moveCaretStartOfLine(startTLHI); - moveCaretEndOfLine(endTLHI); - // Make shift down so that the start caret position is not - // moved to match end caret position. - shiftDown = true; - } - else - validKeyCombo = false; - break; - case 'C': - if(ctrlDown) // Ctrl + C copy selected text - GClip.copy(getSelectedText()); - validKeyCombo = false; - break; - case 'V': - if(ctrlDown){ // Ctrl + V paste selected text - String p = GClip.paste(); - p.replaceAll("\n", ""); - if(p.length() > 0){ - // delete selection and add - if(hasSelection()) - stext.deleteCharacters(pos, nbr); - stext.insertCharacters(p, pos); - adjust = p.length(); - textChanged = true; - } - } - else - validKeyCombo = false; - break; - default: - validKeyCombo = false; - } - calculateCaretPos(endTLHI); - - if(validKeyCombo){ - if(!shiftDown) // Not extending selection - startTLHI.copyFrom(endTLHI); - bufferInvalid = true; // Selection changed - } - } - - protected void keyTypedProcess(int keyCode, char keyChar, boolean shiftDown, boolean ctrlDown){ - int ascii = (int)keyChar; - if(isDisplayable(ascii)){ - if(hasSelection()) - stext.deleteCharacters(pos, nbr); - stext.insertCharacters("" + keyChar, pos); - adjust = 1; textChanged = true; - } - else if(keyChar == BACKSPACE){ - if(hasSelection()){ - stext.deleteCharacters(pos, nbr); - adjust = 0; textChanged = true; - } - else if(stext.deleteCharacters(pos - 1, 1)){ - adjust = -1; textChanged = true; - } - } - else if(keyChar == DELETE){ - if(hasSelection()){ - stext.deleteCharacters(pos, nbr); - adjust = 0; textChanged = true; - } - else if(stext.deleteCharacters(pos, 1)){ - adjust = 0; textChanged = true; - } - } - else if(keyChar == ENTER || keyChar == RETURN) { - fireEvent(this, GEvent.ENTERED); - // If we have a tab manager and can tab forward then do so - if(tabManager != null && tabManager.nextControl(this)){ - startTLHI.copyFrom(endTLHI); - return; - } - } - else if(keyChar == TAB){ - // If possible move to next text control - if(tabManager != null){ - boolean result = (shiftDown) ? tabManager.prevControl(this) : tabManager.nextControl(this); - if(result){ - startTLHI.copyFrom(endTLHI); - return; - } - } - } - // If we have emptied the text then recreate a one character string (space) - if(stext.length() == 0){ - stext.insertCharacters(" ", 0); - adjust++; textChanged = true; - } -// if(stext.length() == 0){ -// stext.insertCharacters(" ", 0); -// adjust++; textChanged = true; -// LinkedList lines = stext.getLines(buffer.g2); -// startTLHI = new TextLayoutHitInfo(lines.getFirst(), null); -// startTLHI.thi = startTLHI.tli.layout.getNextLeftHit(1); -// -// endTLHI = new TextLayoutHitInfo(lines.getLast(), null); -// int lastChar = endTLHI.tli.layout.getCharacterCount(); -// endTLHI.thi = startTLHI.tli.layout.getNextRightHit(lastChar-1); -// } - - } - - protected boolean changeText(){ - if(!super.changeText()) - return false; - startTLHI.copyFrom(endTLHI); - return true; - } - - - public void draw(){ - if(!visible) return; - updateBuffer(); - - winApp.pushStyle(); - winApp.pushMatrix(); - - winApp.translate(cx, cy); - winApp.rotate(rotAngle); - - winApp.pushMatrix(); - // Move matrix to line up with top-left corner - winApp.translate(-halfWidth, -halfHeight); - // Draw buffer - winApp.imageMode(PApplet.CORNER); - if(alphaLevel < 255) - winApp.tint(TINT_FOR_ALPHA, alphaLevel); - winApp.image(buffer, 0, 0); - - // Draw caret if text display area - if(focusIsWith == this && showCaret && endTLHI.tli != null){ - float[] cinfo = endTLHI.tli.layout.getCaretInfo(endTLHI.thi); - float x_left = - ptx + cinfo[0]; - float y_top = - pty + endTLHI.tli.yPosInPara; - float y_bot = y_top - cinfo[3] + cinfo[5]; - if(x_left >= 0 && x_left <= tw && y_top >= 0 && y_bot <= th){ - winApp.strokeWeight(1.5f); - winApp.stroke(palette[12].getRGB()); - winApp.line(tx+x_left, ty+Math.max(0, y_top), tx+x_left, ty+Math.min(th, y_bot)); - } - } - - winApp.popMatrix(); - - if(children != null){ - for(GAbstractControl c : children) - c.draw(); - } - winApp.popMatrix(); - winApp.popStyle(); - } - - /** - * If the buffer is invalid then redraw it. - * @TODO need to use palette for colours - */ - protected void updateBuffer(){ - if(bufferInvalid) { - bufferInvalid = false; - buffer.beginDraw(); - Graphics2D g2d = buffer.g2; - g2d.setFont(localFont); - - // Get the latest lines of text - LinkedList lines = stext.getLines(g2d); - - boolean usePromptText = promptText != null && !hasFocus() && (lines.isEmpty() || stext.getPlainText().equals("") || stext.getPlainText().equals(" ")); - if(usePromptText) - lines = promptText.getLines(g2d); - - // If needed update the horizontal scrollbar -// if(hsb != null){ -// if(stext.getMaxLineLength() < tw) -// hsb.setValue(0, 1); -// else -// hsb.setValue(0, tw/stext.getMaxLineLength()); -// } - - TextLayoutHitInfo startSelTLHI = null, endSelTLHI = null; - // Whole control surface if opaque - if(opaque) - buffer.background(palette[6].getRGB()); - else - buffer.background(buffer.color(255,0)); - - // Now move to top left corner of text display area - buffer.translate(tx,ty); - - // Typing area surface - buffer.noStroke(); - buffer.fill(palette[7].getRGB()); - buffer.rect(-1,-1,tw+2,th+2); - - g2d.setClip(gpTextDisplayArea); - buffer.translate(-ptx, -pty); - // Translate in preparation for display selection and text - - if(hasFocus() && stext.getPlainText().equals(" ")){ - lines = stext.getLines(buffer.g2); - startTLHI = new TextLayoutHitInfo(lines.getFirst(), null); - startTLHI.thi = startTLHI.tli.layout.getNextLeftHit(1); - - endTLHI = new TextLayoutHitInfo(lines.getLast(), null); - int lastChar = endTLHI.tli.layout.getCharacterCount(); - endTLHI.thi = startTLHI.tli.layout.getNextRightHit(lastChar-1); - } - - if(hasSelection()){ - if(endTLHI.compareTo(startTLHI) == -1){ - startSelTLHI = endTLHI; - endSelTLHI = startTLHI; - } - else { - startSelTLHI = startTLHI; - endSelTLHI = endTLHI; - } - } - // Display selection and text - for(TextLayoutInfo lineInfo : lines){ - TextLayout layout = lineInfo.layout; - buffer.translate(0, layout.getAscent()); - // Draw selection if any - if(!usePromptText && hasSelection() && lineInfo.compareTo(startSelTLHI.tli) >= 0 && lineInfo.compareTo(endSelTLHI.tli) <= 0 ){ - int ss = startSelTLHI.thi.getInsertionIndex(); - int ee = endSelTLHI.thi.getInsertionIndex(); - g2d.setColor(palette[14]); - Shape selShape = layout.getLogicalHighlightShape(ss, ee); - g2d.fill(selShape); - } - // Draw text - g2d.setColor(palette[2]); - lineInfo.layout.draw(g2d, 0, 0); - buffer.translate(0, layout.getDescent() + layout.getLeading()); - } - g2d.setClip(null); - buffer.endDraw(); - } - } - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GTextIconAlignBase.java b/Processing/libraries/G4P/src/g4p_controls/GTextIconAlignBase.java deleted file mode 100644 index f7d1b09..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GTextIconAlignBase.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import processing.core.PApplet; -import processing.core.PImage; - -/** - * Base class for controls with text and/or icon.
- * - * This class forms the basis for any control that has text and/or an icon.
- * Use the setIcon, setIconAlign, setText and setTextAlign to control - * horizontal and vertical alignment of the icon and text within the control face. - * - * @author Peter Lager - * - */ -public abstract class GTextIconAlignBase extends GTextAlign { - - protected PImage[] bicon = null; - protected int iconW = 0, iconH = 0; - protected GAlign iconAlignH = GAlign.RIGHT, iconAlignV = GAlign.MIDDLE; - protected int siX, siY; - - - public GTextIconAlignBase(PApplet theApplet, float p0, float p1, float p2, float p3) { - super(theApplet, p0, p1, p2, p3); - } - - /** - * Set the text to be displayed and calculate the wrap length taking into - * account any icon set. - * - * @param text - */ - public void setText(String text){ - if(text == null || text.length() == 0 ) - text = " "; - if(iconW == 0) - stext.setText(text, (int) width - TPAD4); - else - stext.setText(text, (int) width - iconW - TPAD8); - bufferInvalid = true; - } - - /** - * Set the icon to be used and the horizontal and/or vertical icon alignment. - * Use the constants in GAlign e.g.
GAlign.LEFT

- * - * @param fname the filename of the icon - * @param nbrImages number of tiled images in the icon - * @param horz LEFT or RIGHT - * @param vert TOP, MIDDLE, BOTTOM - */ - public void setIcon(String fname, int nbrImages, GAlign horz, GAlign vert){ - PImage iconImage = ImageManager.loadImage(winApp, fname); - setIcon(iconImage, nbrImages, horz, vert); - } - - /** - * Set the icon to be used and the horizontal and/or vertical icon alignment. - * Use the constants in GAlign e.g.
GAlign.LEFT

- * - * If you want to set just one of these then pass null in the other - * - * @param icon the icon - * @param nbrImages number of tiled images in the icon - * @param horz LEFT or RIGHT - * @param vert TOP, MIDDLE, BOTTOM - */ - public void setIcon(PImage icon, int nbrImages, GAlign horz, GAlign vert){ - if(icon != null){ - if(nbrImages == 3) - bicon = ImageManager.makeTiles1D(winApp, icon, nbrImages, 1); - else { - bicon = new PImage[3]; - PImage[] temp = ImageManager.makeTiles1D(winApp, icon, nbrImages, 1); - System.arraycopy(temp, 0, bicon, 0, temp.length); - for(int i = temp.length; i < 3; i++){ - bicon[i] = bicon[i-1]; - } - } - - // We have loaded the image so validate alignment - if(horz != null && horz.isHorzAlign() && horz != GAlign.CENTER){ - iconAlignH = horz; - } - if(vert != null && vert.isVertAlign()){ - iconAlignV = vert; - } - iconW = bicon[0].width; - iconH = bicon[0].height; - stext.setWrapWidth((int) width - iconW - TPAD8); - bufferInvalid = true; - } - } - - /** - * Change the alignment of an existing icon. - * @param horz horizontal alignment (see @see GAlign) - * @param vert vertical alignment (see @see GAlign) - */ - public void setIconAlign(GAlign horz, GAlign vert){ - if(iconW != 0){ - if(horz != null && horz.isHorzAlign() && horz != GAlign.CENTER){ - iconAlignH = horz; - } - if(vert != null && vert != null && vert.isVertAlign()){ - iconAlignV = vert; - } - bufferInvalid = true; - } - } - - /** - * This will change the controls height without changing the width so that it just - * fits round the text and icon (if any). - */ - public void setHeightToFit(){ - if(stext != null && buffer != null){ - stext.getLines(buffer.g2); - int high = Math.round(stext.getTextAreaHeight()); - high = Math.max(high, iconH); - int wide = Math.round(width); - resize(wide, high); // resize this control - calcAlignment(); - bufferInvalid = true; - } - } - - /** - * Calculate various values based on alignment of text and icon - */ - protected void calcAlignment(){ - super.calcAlignment(); // calculate the text alignment - if(iconW != 0){ - switch(iconAlignH){ - case LEFT: - siX = TPAD2; - if(textAlignH != GAlign.RIGHT) - stX += (iconW + TPAD4); // Image on left so adjust text start x position - break; - case RIGHT: - default: - siX = (int)width - iconW - TPAD4; - if(textAlignH == GAlign.RIGHT) - stX -= (iconW + TPAD4); - break; - } - switch(iconAlignV){ - case TOP: - siY = TPAD2; - break; - case BOTTOM: - siY = (int) height - iconH - TPAD4; - break; - case MIDDLE: - default: - siY = (int)(height - iconH)/2; - } - } - } - - public String toString(){ - return tag; - } -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GTimer.java b/Processing/libraries/G4P/src/g4p_controls/GTimer.java deleted file mode 100644 index 2af8da1..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GTimer.java +++ /dev/null @@ -1,265 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.lang.reflect.Method; - -import javax.swing.Timer; - -import processing.core.PApplet; - -/** - * This class is used to trigger events at user defined intervals. The event will - * call a user defined method/function. The only restriction is that the method - * used has a single parameter of type GTimer and returns void eg
- *
- * void fireBall(GTimer timer){ ... }
- * 

- * - * Each timer object must have its own handler - * - * It has no visible GUI representation so will not appear in the GUI. - * - * @author Peter Lager - * - */ -public class GTimer implements GConstantsInternal { - - /* This must be set by the constructor */ - protected PApplet app; - - /* The object to handle the event */ - protected Object eventHandlerObject = null; - /* The method in eventHandlerObject to execute */ - protected Method eventHandlerMethod = null; - /* the name of the method to handle the event */ - protected String eventHandlerMethodName; - - // The number of repeats i.e. events to be fired. - protected int nrepeats = -1; - - protected Timer timer = null; - - /** - * Create the GTimer object with this ctor. - * - * 'methodName' is the method/function to be called every 'interval' - * milliseconds. 'obj' is the object that contains the method/function - * 'methodName' - * - * For most users 'methodName' will be in their main sketch so this - * parameter has the same value as 'theApplet' - * - * @param theApplet a reference to the PApplet object (invariably this) - * @param obj the object that has the method to be executed (likely to be this) - * @param methodName the name of the method to be called by the timer - * @param delay the initial delay and the time (in millisecs) between function calls - */ - public GTimer(PApplet theApplet, Object obj, String methodName, int delay){ - this(theApplet, obj, methodName, delay, delay); - } - - /** - * Create the GTimer object with this ctor. - * - * 'methodName' is the method/function to be called every 'interval' - * milliseconds. 'obj' is the object that contains the method/function - * 'methodName' - * - * For most users 'methodName' will be in their main sketch so this - * parameter has the same value as 'theApplet' - * - * @param theApplet a reference to the PApplet object (invariably this) - * @param obj the object that has the method to be executed (likely to be this) - * @param methodName the name of the method to be called by the timer - * @param delay the time (in millisecs) between function calls - * @param initDelay the initial delay (in millisecs) - */ - public GTimer(PApplet theApplet, Object obj, String methodName, int delay, int initDelay){ - app = theApplet; - createEventHandler(obj, methodName); - // If we have something to handle the event then create the Timer - if(eventHandlerObject != null){ - timer = new Timer(delay, new ActionListener(){ - - public void actionPerformed(ActionEvent e) { - fireEvent(); - } - - }); - timer.setInitialDelay(initDelay); - timer.setDelay(delay); - timer.stop(); - } - } - - /** - * See if 'obj' has a method called 'methodName' that has a single parameter of type - * GTimer and if so keep a reference to it. - * - * @param obj - * @param methodName - */ - protected void createEventHandler(Object handlerObj, String methodName){ - try{ - eventHandlerMethod = handlerObj.getClass().getMethod(methodName, new Class[] { GTimer.class } ); - eventHandlerObject = handlerObj; - eventHandlerMethodName = methodName; - } catch (Exception e) { - GMessenger.message(NONEXISTANT, new Object[] {this, methodName, new Class[] { GTimer.class }}); - eventHandlerObject = null; - } - } - - /** - * Attempt to fire an event for this timer. This will call the - * method/function defined in the ctor. - */ - protected void fireEvent(){ - if(eventHandlerMethod != null){ - try { - eventHandlerMethod.invoke(eventHandlerObject, this); - if(--nrepeats == 0) - stop(); - } catch (Exception e) { - GMessenger.message(EXCP_IN_HANDLER, - new Object[] {eventHandlerObject, eventHandlerMethodName, e } ); - System.out.println("Disabling " + eventHandlerMethod.getName() + " due to an unknown error"); - eventHandlerMethod = null; - eventHandlerObject = null; - } - } - } - - /** - * Start the timer (call the method forever) - */ - public void start(){ - this.nrepeats = -1; - if(timer != null) - timer.start(); - } - - /** - * Start the timer and call the method for the number of - * times indicated by nrepeats - * If nrepeats is <=0 then repeat forever - * - * @param nrepeats - */ - public void start(int nrepeats){ - this.nrepeats = nrepeats; - if(timer != null) - timer.start(); - } - - /** - * Stop the timer (can be restarted with start() method) - */ - public void stop(){ - if(timer != null) - timer.stop(); - } - - /** - * Is the timer running? - * @return true if running - */ - public boolean isRunning(){ - if(timer != null) - return timer.isRunning(); - else - return false; - } - - /** - * Set the interval between events - * @param interval delay between events in milliseconds - */ - public void setInterval(int interval){ - if(timer != null) - timer.setDelay(interval); - } - - /** - * Set the delay before the first event is triggered - * @param initDelay initial delay in milliseconds - */ - public void setInitialDelay(int initDelay){ - if(timer != null) - timer.setInitialDelay(initDelay); - } - - /** - * Sets the initial delay and the interval between events.
- * This is equivalent to calling both -
- *
-	 * setInterval(delay);
-	 * setInitialDelay(delay);
-	 * 

- * @param delay initial delay and interval in milliseconds - */ - public void setDelay(int delay){ - if(timer != null){ - timer.setInitialDelay(delay); - timer.setDelay(delay); - } - } - - /** - * Get the interval time (milliseconds) between - * events. - * @return interval in millsecs or -1 if the timer failed to - * be created. - */ - public int getInterval(){ - if(timer != null) - return timer.getDelay(); - else - return -1; - } - - /** - * Get the initial delay time (milliseconds). - * @return initial delay in millsecs or -1 if the timer failed to - * be created. - */ - public int getInitialDelay(){ - if(timer != null) - return timer.getInitialDelay(); - else - return -1; - } - - /** - * See if the GTimer object has been created successfully - * @return true if successful - */ - public boolean isValid(){ - return (eventHandlerObject != null && timer != null); - } - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GToggleControl.java b/Processing/libraries/G4P/src/g4p_controls/GToggleControl.java deleted file mode 100644 index 271de41..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GToggleControl.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import g4p_controls.HotSpot.HSrect; -import g4p_controls.StyledString.TextLayoutInfo; - -import java.awt.Graphics2D; -import java.awt.font.TextLayout; -import java.util.LinkedList; - -import processing.core.PApplet; -import processing.event.MouseEvent; - -/** - * This class forms the basis for any two-state type control (toggle switch).
- * A toggle control can be in one of 2 states selected or not selected - * and is the base class for the GOption and GCheckbox controls. - * - * @author Peter Lager - * - */ -public abstract class GToggleControl extends GTextIconAlignBase { - - protected GToggleGroup group = null; - - protected boolean selected = false; - - public GToggleControl(PApplet theApplet, float p0, float p1, float p2, float p3) { - super(theApplet, p0, p1, p2, p3); - opaque = false; - hotspots = new HotSpot[]{ - new HSrect(1, 0, 0, width, height) // control surface - }; - } - - // This method is called if this control is added to a toggle group. A toggle group - // enforces single option selection from the group. Override this with an empty method - // to allow each toggle control to be independent of others. - protected void setToggleGroup(GToggleGroup tg) { - this.group = tg; - } - - /** - * Get the toggle group. If null is returned then it is not part - * of the group. - */ - public GToggleGroup getToggleGroup(){ - return group; - } - - /** - * @return the selected - */ - public boolean isSelected() { - return selected; - } - - /** - * @param selected the selected to set - */ - public void setSelected(boolean selected) { - if(this.selected != selected) - bufferInvalid = true; - if(selected && group != null) - group.makeSelected(this); - this.selected = selected; - } - -// public void setSelected() { -// setSelected(true); -// } - - /* - * Only executed when clicked in the GUI. - */ - protected void hasBeenClicked(){ - if(group == null){ - // Independent action e.g. check box - selected = !selected; - bufferInvalid = true; - } - else { - // Only need to do something if we click on an unselected option - if(!selected) - setSelected(true); - } - } - - public void mouseEvent(MouseEvent event){ - // If this option does not belong to a group then ignore mouseEvents - if(!visible || !enabled || !available) return; - - - calcTransformedOrigin(winApp.mouseX, winApp.mouseY); - currSpot = whichHotSpot(ox, oy); - // currSpot == 1 for text display area - if(currSpot >= 0 || focusIsWith == this) - cursorIsOver = this; - else if(cursorIsOver == this) - cursorIsOver = null; - - - switch(event.getAction()){ - case MouseEvent.PRESS: - if(focusIsWith != this && currSpot >= 0 && z > focusObjectZ()){ - dragging = false; - takeFocus(); - } - break; - case MouseEvent.CLICK: - if(focusIsWith == this){ - hasBeenClicked(); - loseFocus(null); - if(selected) - fireEvent(this, GEvent.SELECTED); - else if(group == null) - fireEvent(this, GEvent.DESELECTED); - } - break; - case MouseEvent.DRAG: - dragging = true; - break; - case MouseEvent.RELEASE: - // Release focus without firing an event - that would have - // been done - if(focusIsWith == this && dragging) - this.loseFocus(null); - dragging = false; - break; - } - } - - public void draw(){ - if(!visible) return; - - // Update buffer if invalid - updateBuffer(); - winApp.pushStyle(); - - winApp.pushMatrix(); - // Perform the rotation - winApp.translate(cx, cy); - winApp.rotate(rotAngle); - // Move matrix to line up with top-left corner - winApp.translate(-halfWidth, -halfHeight); - // Draw buffer - winApp.imageMode(PApplet.CORNER); - if(alphaLevel < 255) - winApp.tint(TINT_FOR_ALPHA, alphaLevel); - winApp.image(buffer, 0, 0); - winApp.popMatrix(); - - winApp.popStyle(); - } - - protected void updateBuffer(){ - if(bufferInvalid) { - bufferInvalid = false; - buffer.beginDraw(); - Graphics2D g2d = buffer.g2; - g2d.setFont(localFont); - // Get the latest lines of text - LinkedList lines = stext.getLines(g2d); - // Back ground colour - buffer.background(opaque ? palette[6].getRGB() : palette[2].getRGB() & 0xFFFFFF); - // Calculate text and icon placement - calcAlignment(); - // If there is an icon draw it - if(iconW != 0) - if(selected) - buffer.image(bicon[1], siX, siY); - else - buffer.image(bicon[0], siX, siY); - float wrapWidth = stext.getWrapWidth(); - float sx = 0, tw = 0; - buffer.translate(stX, stY); - for(TextLayoutInfo lineInfo : lines){ - TextLayout layout = lineInfo.layout; - buffer.translate(0, layout.getAscent()); - switch(textAlignH){ - case CENTER: - tw = layout.getAdvance(); - tw = (tw > wrapWidth) ? tw - wrapWidth : tw; - sx = (wrapWidth - tw)/2; - break; - case RIGHT: - tw = layout.getAdvance(); - tw = (tw > wrapWidth) ? tw - wrapWidth : tw; - sx = wrapWidth - tw; - break; - case LEFT: - case JUSTIFY: - default: - sx = 0; - } - // display text - g2d.setColor(palette[2]); - lineInfo.layout.draw(g2d, sx, 0); - buffer.translate(0, layout.getDescent() + layout.getLeading()); - } - buffer.endDraw(); - } - } -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GToggleGroup.java b/Processing/libraries/G4P/src/g4p_controls/GToggleGroup.java deleted file mode 100644 index 4925dfd..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GToggleGroup.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - - -/** - * Use this class to create a single selection collection of options.
- * - * To use create an object of this class and then add GOption objects to it with - * the addControl method.
- * - * You cannot add GCheckbox objects because they are designed to work independently. - * - * @author Peter Lager - * - */ -public class GToggleGroup { - - private GToggleControl selected = null; - private GToggleControl deselected = null; - - /** - * Create a toggle group object. - */ - public GToggleGroup(){ } - - /** - * Add a GOption object to this group. - * @param tc - */ - public void addControl(GToggleControl tc){ - tc.setToggleGroup(this); - } - - /** - * Add a set of comma separated GOptions. - * @param controls - */ - public void addControls(GToggleControl... controls ){ - for(GToggleControl tc : controls) - tc.setToggleGroup(this); - } - - /** - * Used internally to change selection - */ - void makeSelected(GToggleControl tc){ - deselected = selected; - if(deselected != null) - deselected.setSelected(false); - selected = tc; - } -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GValueControl.java b/Processing/libraries/G4P/src/g4p_controls/GValueControl.java deleted file mode 100644 index e9ab185..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GValueControl.java +++ /dev/null @@ -1,536 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import processing.core.PApplet; - -/** - * Base class for all slider and knob type controls. - * - * This class enables the creation of tick marks and constraining values to - * the tick mark values.
- * - * It also controls how the values are to be displayed INTEGER, DECIMAL or EXPONENT - * - * @author Peter Lager - * - */ -public abstract class GValueControl extends GAbstractControl { - - protected StyledString ssStartLimit, ssEndLimit, ssValue; - - protected float startLimit = 0, endLimit = 1; - protected boolean showLimits = false; - - protected int valueType = DECIMAL; - protected int precision = 2; - protected String unit = ""; - protected boolean showValue = false; - - protected float parametricPos = 0.5f, parametricTarget = 0.5f; - protected float easing = 1.0f; // must be >= 1.0 - - - protected int nbrTicks = 2; - protected boolean stickToTicks = false; - protected boolean showTicks = false; - protected float wheelDelta = WHEEL_DELTA; - - protected boolean limitsInvalid = true; - protected boolean valueInvalid = true; - - // Offset to between mouse and thumb centre - protected float offset; - - public GValueControl(PApplet theApplet, float p0, float p1, float p2, float p3) { - super(theApplet, p0, p1, p2, p3); - } - - public void pre(){ - if(Math.abs(parametricTarget - parametricPos) > epsilon){ - parametricPos += (parametricTarget - parametricPos) / easing; - updateDueToValueChanging(); - bufferInvalid = true; - if(Math.abs(parametricTarget - parametricPos) > epsilon){ - valueInvalid = true; - fireEvent(this, GEvent.VALUE_CHANGING); - } - else { - parametricPos = parametricTarget; - fireEvent(this, GEvent.VALUE_STEADY); - } - } - } - - /** - * This should be overridden in child classes so they can perform any class specific - * actions when the value changes. - * Override this in GSlider to change the hotshot poaition. - */ - protected void updateDueToValueChanging(){ - } - - /** - * Used to format the number into a string for display. - * @param number - * @return a string representing the number - */ - protected String getNumericDisplayString(float number){ - String s = ""; - switch(valueType){ - case INTEGER: - s = String.format("%d %s", Math.round(number), unit); - break; - case DECIMAL: - s = String.format("%." + precision + "f %s", number, unit); - break; - case EXPONENT: - s = String.format("%." + precision + "e %s", number, unit); - break; - } - return s.trim(); - } - - - /** - * Sets the range of values to be returned. This method will - * assume that you want to set the valueType to INTEGER - * - * @param start the start value of the range - * @param end the end value of the range - */ - public void setLimits(int start, int end){ - startLimit = start; - endLimit = end; - setEpsilon(); - valueType = INTEGER; - limitsInvalid = true; - bufferInvalid = true; - } - - /** - * Sets the initial value and the range of values to be returned. This - * method will assume that you want to set the valueType to INTEGER. - * - * @param initValue the initial value - * @param start the start value of the range - * @param end the end value of the range - */ - public void setLimits(int initValue, int start, int end){ - startLimit = start; - endLimit = end; - valueType = INTEGER; - setEpsilon(); - limitsInvalid = true; - bufferInvalid = true; - setValue(initValue); - parametricPos = parametricTarget; - updateDueToValueChanging(); - } - - /** - * Sets the range of values to be returned. This method will - * assume that you want to set the valueType to DECIMAL - * - * @param start - * @param end - */ - public void setLimits(float start, float end){ - startLimit = start; - endLimit = end; - if(valueType == INTEGER){ - valueType = DECIMAL; - setPrecision(1); - } - setEpsilon(); - limitsInvalid = true; - bufferInvalid = true; - } - - /** - * Sets the initial value and the range of values to be returned. This - * method will assume that you want to set the valueType to DECIMAL. - * - * @param initValue the initial value - * @param start the start value of the range - * @param end the end value of the range - */ - public void setLimits(float initValue, float start, float end){ - startLimit = start; - endLimit = end; - initValue = PApplet.constrain(initValue, start, end); - if(valueType == INTEGER){ - valueType = DECIMAL; - setPrecision(1); - } - setEpsilon(); - limitsInvalid = true; - bufferInvalid = true; - setValue(initValue); - parametricPos = parametricTarget; - updateDueToValueChanging(); - } - - /** - * Set the value for the slider.
- * The user must ensure that the value is valid for the slider range. - * @param v - */ - public void setValue(float v){ - if(valueType == INTEGER) - v = Math.round(v); - float t = (v - startLimit) / (endLimit - startLimit); - t = PApplet.constrain(t, 0.0f, 1.0f); - if(stickToTicks) - t = findNearestTickValueTo(t); - parametricTarget = t; - } - - /** - * For DECIMAL values this sets the number of decimal places to - * be displayed. - * @param nd must be >= 1 otherwise will use 1 - */ - public void setPrecision(int nd){ - nd = PApplet.constrain(nd, 1, 5); - if(nd < 1) - nd = 1; - if(nd != precision){ - precision = nd; - setEpsilon(); - limitsInvalid = true; - bufferInvalid = true; - } - } - - /** - * Make epsilon to match the value of 1 pixel or the precision which ever is the smaller - */ - protected void setEpsilon(){ - epsilon = (float) Math.min(0.001, Math.pow(10, -precision)); - } - - /** - * The units to be displayed with the current and limit values e.g. - * kg, m, ($), fps etc.
- * Do not use long labels such as 'miles per hour' as these take a - * lot of space and can look messy. - * - * @param units for example kg, m, ($), fps - */ - public void setUnits(String units){ - if(units == null) - units = ""; - if(!unit.equals(units)){ - unit = units; - limitsInvalid = true; - bufferInvalid = true; - } - } - - /** - * Set the numberFormat, precision and units in one go.
- * Valid number formats are INTEGER, DECIMAL, EXPONENT
- * Precision must be >= 1 and is ignored for INTEGER. - * - * @param numberFormat INTEGER, DECIMAL or EXPONENT - * @param precision must be >= 1 - * @param unit for example kg, m, ($), fps - */ - public void setNumberFormat(int numberFormat, int precision, String unit){ - this.unit = (unit == null) ? "" : unit; - setNumberFormat(numberFormat, precision); - } - - /** - * Set the numberFormat and precision in one go.
- * Valid number formats are INTEGER, DECIMAL, EXPONENT
- * Precision must be >= 1 and is ignored for INTEGER. - * - * @param numberFormat G4P.INTEGER, G4P.DECIMAL orG4P. EXPONENT - * @param precision must be >= 1 - */ - public void setNumberFormat(int numberFormat, int precision){ - switch(numberFormat){ - case INTEGER: - case DECIMAL: - case EXPONENT: - this.valueType = numberFormat; - break; - default: - valueType = DECIMAL; - } - setPrecision(precision); - bufferInvalid = true; - } - - /** - * Set the numberFormat and precision in one go.
- * Valid number formats are INTEGER, DECIMAL, EXPONENT
- * Precision must be >= 1 and is ignored for INTEGER. - * - * @param numberFormat G4P.INTEGER, G4P.DECIMAL or G4P.EXPONENT - */ - public void setNumberFormat(int numberFormat){ - switch(numberFormat){ - case INTEGER: - case DECIMAL: - case EXPONENT: - this.valueType = numberFormat; - break; - default: - valueType = DECIMAL; - } - bufferInvalid = true; - } - - /** - * Get the current value as a float - */ - public float getValueF(){ - return startLimit + (endLimit - startLimit) * parametricPos; - } - - /** - * Get the current value as an integer.
- * DECIMAL and EXPONENT value types will be rounded to the nearest integer. - */ - public int getValueI(){ - return Math.round(startLimit + (endLimit - startLimit) * parametricPos); - } - - /** - * If we are using labels then this will get the label text - * associated with the current value.
- * If labels have not been set then return null - */ - public String getValueS(){ - return getNumericDisplayString(getValueF()); - } - - /** - * Get the current value used for easing. - * @return the easing - */ - public float getEasing() { - return easing; - } - - /** - * Set the amount of easing to be used when a value is changing. The default value - * is 1 (no easing) values > 1 will cause the value to rush from its starting value - * and decelerate towards its final values. In other words it smoothes the movement - * of the slider thumb or knob rotation. - * - * @param easeBy the easing to set - */ - public void setEasing(float easeBy) { - easing = (easeBy < 1) ? 1 : easeBy; - } - - /** - * Get the number of tick marks. - * @return the nbrTicks - */ - public int getNbrTicks() { - return nbrTicks; - } - - /** - * The number of ticks must be >= 2 since 2 are required for the slider limits. - * - * @param noOfTicks the nbrTicks to set - */ - public void setNbrTicks(int noOfTicks) { - if(noOfTicks < 2) - noOfTicks = 2; - if(nbrTicks != noOfTicks){ - nbrTicks = noOfTicks; - bufferInvalid = true; - if(stickToTicks){ - wheelDelta = WHEEL_STICK_FACTOR / (nbrTicks - 1); - parametricTarget = findNearestTickValueTo(parametricPos); - } - } - System.out.println("setNbrTicks " + tag + " " + wheelDelta); - } - - /** - * Specify whether the values are to be constrained to the tick marks or not. - * It will automatically display tick marks if set true. - * @param stickToTicks true if you want to constrain the values else false - */ - public void setStickToTicks(boolean stickToTicks) { - this.stickToTicks = stickToTicks; - if(stickToTicks){ - setShowTicks(true); - wheelDelta = WHEEL_STICK_FACTOR / (nbrTicks - 1); - parametricTarget = findNearestTickValueTo(parametricPos); - bufferInvalid = true; - } - else { - wheelDelta = WHEEL_DELTA; - } - System.out.println("setStickToTicks " + tag + " " + wheelDelta); - } - - /** - * Is the value constrained to the tick marks? - * @return the stickToTicks true if values constrained else false - */ - public boolean isStickToTicks() { - return stickToTicks; - } - - - /** - * These are normalised values i.e. between 0.0 and 1.0 inclusive - * @param p - * @return the parametric value of the nearest tick - */ - protected float findNearestTickValueTo(float p){ - float tickSpace = 1.0f / (nbrTicks - 1); - int tn = (int) (p / tickSpace + 0.5f); - return tickSpace * tn; - } - - /** - * Calculate the correct value of the parametticTarget - * - * @param pt the value to correct - * @return the corrected value 0.0 - 1.0 incl - */ - protected float calcParametricTarget(float pt){ - pt = pt < 0 ? 0 : pt > 1 ? 1 : pt; - if(stickToTicks) - pt = findNearestTickValueTo(pt); - return pt; - } - - /** - * Are the tick marks visible? - * @return the showTicks - */ - public boolean isShowTicks() { - return showTicks; - } - - /** - * Set whether the tick marks are to be displayed or not. - * @param showTicks the showTicks to set - */ - public void setShowTicks(boolean showTicks) { - if(this.showTicks != showTicks){ - this.showTicks = showTicks; - bufferInvalid = true; - } - } - - /** - * Are the limit values visible? - * @return the showLimits - */ - public boolean isShowLimits() { - return showLimits; - } - - /** - * Set whether the limits are to be displayed or not. - * @param showLimits the showLimits to set - */ - public void setShowLimits(boolean showLimits) { - this.showLimits = showLimits; - bufferInvalid = true; - } - - /** - * Is the current value to be displayed? - * @return the showValue - */ - public boolean isShowValue() { - return showValue; - } - - /** - * Set whether the current value is to be displayed or not. - * @param showValue the showValue to set - */ - public void setShowValue(boolean showValue) { - this.showValue = showValue; - bufferInvalid = true; - } - - /** - * Convenience method to set what is to be drawn to the screen. - * @param opaque show background - * @param ticks show tick marks - * @param value show current value - * @param limits show min and max values (limits) - */ - public void setShowDecor(boolean opaque, boolean ticks, boolean value, boolean limits){ - setShowValue(value); - bufferInvalid = true; - setOpaque(opaque); - setShowTicks(ticks); - setShowLimits(limits); - } - - /** - * @return the startLimit - */ - public float getStartLimit() { - return startLimit; - } - - /** - * @return the endLimit - */ - public float getEndLimit() { - return endLimit; - } - - /** - * - * @return the valueType - */ - public int getValueType() { - return valueType; - } - - /** - * Precision used with floating point numbers - * @return the precision - */ - public int getPrecision() { - return precision; - } - - /** - * @return the unit - */ - public String getUnit() { - return unit; - } - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GValueControl2D.java b/Processing/libraries/G4P/src/g4p_controls/GValueControl2D.java deleted file mode 100644 index e5f9ccd..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GValueControl2D.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2013 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import processing.core.PApplet; - -/** - * Base class for controls that have 2 variables e.f. GSlider2D - * - * @author Peter Lager - * - */ -public abstract class GValueControl2D extends GAbstractControl { - - static protected int THUMB_SPOT = 1; - static protected int TRACK_SPOT = 2; - - - protected float parametricPosX = 0.5f, parametricTargetX = 0.5f; - protected float parametricPosY = 0.5f, parametricTargetY = 0.5f; - - protected float easing = 1.0f; // must be >= 1.0 - - // Offset to between mouse and thumb centre - protected float offsetH, offsetV; - - protected int valueType = DECIMAL; - protected int precision = 2; - - public GValueControl2D(PApplet theApplet, float p0, float p1, float p2, float p3) { - super(theApplet, p0, p1, p2, p3); - } - - public void pre(){ - if(Math.abs(parametricTargetX - parametricPosX) > epsilon || Math.abs(parametricTargetY - parametricPosY) > epsilon){ - parametricPosX += (parametricTargetX - parametricPosX) / easing; - parametricPosY += (parametricTargetY - parametricPosY) / easing; - updateDueToValueChanging(); - bufferInvalid = true; - if(Math.abs(parametricTargetX - parametricPosX) > epsilon || Math.abs(parametricTargetY - parametricPosY) > epsilon){ - fireEvent(this, GEvent.VALUE_CHANGING); - } - else { - parametricPosX = parametricTargetX; - parametricPosY = parametricTargetY; - fireEvent(this, GEvent.VALUE_STEADY); - } - } - } - - /** - * This should be overridden in child classes so they can perform any class specific - * actions when the value changes. - * Override this in GSlider to change the hotshot poaition. - */ - protected void updateDueToValueChanging(){ - } - - /** - * Make epsilon to match the value of 1 pixel or the precision which ever is the smaller - */ - protected void setEpsilon(){ - epsilon = (float) Math.min(0.001, Math.pow(10, -precision)); - } - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GWinData.java b/Processing/libraries/G4P/src/g4p_controls/GWinData.java deleted file mode 100644 index 5fddfea..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GWinData.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -/** - * This class is used to hold the data associated with a GWindow object. - * - * You should extend this class to provide the data to be processed by - * the window - * - * @author Peter Lager - * - */ -public class GWinData { - - public GWindow owner; - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GWindow.java b/Processing/libraries/G4P/src/g4p_controls/GWindow.java deleted file mode 100644 index f1ac16e..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GWindow.java +++ /dev/null @@ -1,720 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2015 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.lang.reflect.Method; -import java.util.Collections; -import java.util.LinkedList; - -import processing.core.PApplet; -import processing.core.PVector; -import processing.event.KeyEvent; -import processing.event.MouseEvent; - -/** - * Base class for independent windows using JAVA2D, P2D or P3D renderers. These - * can be used to hold G4P GUI components or used for drawing or both combined. - *

- * A number of examples are included in the library and more info can be found - * at www.lagers.org.uk - * - * Updated for Processing V3 - * - * @author Peter Lager - * - */ -public abstract class GWindow extends PApplet implements GConstants, GConstantsInternal { - - /** - * Factory method to create and start a new window. The renderer - * must be JAVA2D, P2D or P3D otherwise this method returns null. - * - * @param title text to appear in frame title bar - * @param px horizontal position of top-left corner - * @param py vertical position of top-left corner - * @param w width of drawing surface - * @param h height of surface - * @param r renderer must be JAVA2D, P3D or P3D - * @return the window created (in case the user wants its. - */ - public static GWindow getWindow(PApplet app, String title, int px, int py, int w, int h, String renderer){ - G4P.registerSketch(app); - GWindow g3w = null; - if(renderer.equals(JAVA2D)) - g3w = new GWindowAWT(title, w, h); - else if(renderer.equals(P2D)) - g3w = new GWindowNEWT(title, w, h, false); - else if(renderer.equals(P3D)){ - g3w = new GWindowNEWT(title, w, h, true); - } - if(g3w != null){ - String spath = "--sketch-path=" + G4P.sketchWindow.sketchPath(); - String loc = "--location=" + px + "," + py; - String className = g3w.getClass().getName(); - String[] args = { spath, loc, className }; - G4P.registerWindow(g3w); - PApplet.runSketch(args, g3w); - } - return g3w; - } - - protected int actionOnClose = KEEP_OPEN; - - /** Used to associated data to a GWindow */ - public GWinData data; - - /** Simple tag that can be used by the user */ - public String tag; - - /** Allows user to specify a number for this component */ - public int tagNo; - - protected final int w, h; - protected final String title; - protected String renderer_type; - protected boolean preparedForClosure = false; - - protected GWindow(String title, int w, int h) { - super(); - this.title = title; - this.w = w; - this.h = h; - registerMethods(); - } - - /** - * Register this window for pre, draw, post, mouseEvent and - * keyEvent methods. - */ - protected void registerMethods(){ - registerMethod("pre", this); - registerMethod("draw", this); - registerMethod("post", this); - registerMethod("mouseEvent", this); - registerMethod("keyEvent", this); - } - - /** - * Unregister this window for pre, draw, post, mouseEvent and - * keyEvent methods. - * This method is called when the window closes. - */ - protected void unregisterMethods(){ - unregisterMethod("pre", this); - unregisterMethod("draw", this); - unregisterMethod("post", this); - unregisterMethod("mouseEvent", this); - unregisterMethod("keyEvent", this); - // bely and braces - preHandlerObject = null; - drawHandlerObject = null; - postHandlerObject = null; - mouseHandlerObject = null; - keyHandlerObject = null; - } - - /** - * To provide a unique fields for this window create a class that inherits - * from GWinData with public access fields. Then use this method to associate - * the data with this window. - * @param data - */ - public void addData(GWinData data){ - this.data = data; - } - - /** - * Add a control to this window, ignoring duplicates. - * - * @param control control to be added - */ - protected void addToWindow(GAbstractControl control){ - // Avoid adding duplicates - if(!toAdd.contains(control) && !windowControls.contains(control)) - toAdd.add(control); - } - - /** - * Remove a control to this window. - * - * @param control control to be removed - */ - protected void removeFromWindow(GAbstractControl control){ - toRemove.add(control); - } - - /** - * Set the colour scheme to be used by all controls on this window. - * @param cs colour scheme e.g. G4P.GREEN_SCHEME - */ - void invalidateBuffers(){ - for(GAbstractControl control : windowControls) - control.bufferInvalid = true; - } - - /** - * Set the colour scheme to be used by all controls on this window. - * @param cs colour scheme e.g. G4P.GREEN_SCHEME - */ - void setColorScheme(int cs){ - for(GAbstractControl control : windowControls) - control.setLocalColorScheme(cs); - } - - /** - * Set the alpha level for all controls on this window.
- * 0 = fully transparent
- * 255 = fully opaque
- * Controls are disabled when alpha gets below G4P.ALPHA_BLOCK (128) - * - * @param alpha 0-255 inclusive - */ - void setAlpha(int alpha){ - for(GAbstractControl control : windowControls) - control.setAlpha(alpha); - } - - /** Set the windows visibility */ - public void setVisible(boolean visible){ - surface.setVisible(visible); - } - - /** Returns the windows visibility */ - public abstract boolean isVisible(); - - /** Set the window title */ - public void setTitle(String title){ - surface.setTitle(title); - } - /** Get the windowTitle */ - public abstract String getTitle(); - - /** Set the windows position */ - public void setLocation(int x, int y){ - surface.setLocation(x, y); - } - - /** - Returns a PVector with the windows top-left coordinates. - */ - public abstract PVector getPosition(PVector pos); - - /** - * Sets whether this window should always be above other windows. If there are - * multiple always-on-top windows, their relative order is unspecified and - * platform dependent. - */ - public void setAlwaysOnTop(boolean ontop) { - surface.setAlwaysOnTop(ontop); - } - - /** - * Execute any draw handler for this window. - */ - public void draw() { - pushMatrix(); - if(drawHandlerObject != null){ - try { - drawHandlerMethod.invoke(drawHandlerObject, new Object[] { this, data }); - } catch (Exception e) { - GMessenger.message(EXCP_IN_HANDLER, - new Object[] {drawHandlerObject, drawHandlerMethodName, e} ); - } - } - popMatrix(); - } - - /** - * Execute any pre handler associated with this window and its controls - */ - public void pre(){ - if(preHandlerObject != null){ - try { - preHandlerMethod.invoke(preHandlerObject, - new Object[] { this, data }); - } catch (Exception e) { - GMessenger.message(EXCP_IN_HANDLER, - new Object[] {preHandlerObject, preHandlerMethodName, e} ); - } - } - if(GAbstractControl.controlToTakeFocus != null && GAbstractControl.controlToTakeFocus.getPApplet() == this){ - GAbstractControl.controlToTakeFocus.setFocus(true); - GAbstractControl.controlToTakeFocus = null; - } - for(GAbstractControl control : windowControls){ - if( (control.registeredMethods & PRE_METHOD) == PRE_METHOD) - control.pre(); - } - } - - /** - * Execute any post handler associated with this window and its controls.
- * Add/remove any controls request by user, this is done here outside the drawing - * phase to prevent crashes. - */ - public void post() { - if(postHandlerObject != null){ - try { - postHandlerMethod.invoke(postHandlerObject, - new Object[] { this, data }); - } catch (Exception e) { - GMessenger.message(EXCP_IN_HANDLER, - new Object[] {postHandlerObject, postHandlerMethodName, e} ); - } - } - if(G4P.cursorChangeEnabled){ - if(GAbstractControl.cursorIsOver != null && GAbstractControl.cursorIsOver.getPApplet() == this) - cursor(GAbstractControl.cursorIsOver.cursorOver); - else - cursor(G4P.mouseOff); - } - for(GAbstractControl control : windowControls){ - if( (control.registeredMethods & POST_METHOD) == POST_METHOD) - control.post(); - } - // ===================================================================================================== - // ===================================================================================================== - // This is where components are removed or added to the window to avoid concurrent access violations - // ===================================================================================================== - // ===================================================================================================== - synchronized (this) { - // Dispose of any unwanted controls - if(!toRemove.isEmpty()){ - for(GAbstractControl control : toRemove){ - // If the control has focus then lose it - if(GAbstractControl.focusIsWith == control) - control.loseFocus(null); - // Clear control resources - control.buffer = null; - if(control.parent != null){ - control.parent.children.remove(control); - control.parent = null; - } - if(control.children != null) - control.children.clear(); - control.palette = null; - control.eventHandlerObject = null; - control.eventHandlerMethod = null; - control.winApp = null; - windowControls.remove(control); - System.gc(); - } - toRemove.clear(); - } - if(!toAdd.isEmpty()){ - for(GAbstractControl control : toAdd) - windowControls.add(control); - toAdd.clear(); - Collections.sort(windowControls, G4P.zorder); - } - } - } - - /** - * Execute any mouse event handler associated with this window and its controls - */ - public void mouseEvent(MouseEvent event) { - if(mouseHandlerObject != null){ - try { - mouseHandlerMethod.invoke(mouseHandlerObject, new Object[] { this, data, event }); - } catch (Exception e) { - GMessenger.message(EXCP_IN_HANDLER, - new Object[] {mouseHandlerObject, mouseHandlerMethodName, e} ); - } - } - for(GAbstractControl control : windowControls){ - if((control.registeredMethods & MOUSE_METHOD) == MOUSE_METHOD) - control.mouseEvent(event); - } - } - - /** - * Execute any key event handler associated with this window and its controls - */ - public void keyEvent(KeyEvent event) { - if(keyHandlerObject != null){ - try { - keyHandlerMethod.invoke(keyHandlerObject, new Object[] { this, data, event }); - } catch (Exception e) { - GMessenger.message(EXCP_IN_HANDLER, - new Object[] {keyHandlerObject, keyHandlerMethodName, e} ); - } - } - for(GAbstractControl control : windowControls){ - if( (control.registeredMethods & KEY_METHOD) == KEY_METHOD) - control.keyEvent(event); - } - } - - /** - * Attempt to add the 'draw' handler method. - * The default event handler is a method that returns void and has two - * parameters PApplet and GWinData - * - * @param obj the object to handle the event - * @param methodName the method to execute in the object handler class - */ - public void addDrawHandler(Object obj, String methodName){ - try{ - drawHandlerMethod = obj.getClass().getMethod(methodName, new Class[] {PApplet.class, GWinData.class } ); - drawHandlerObject = obj; - drawHandlerMethodName = methodName; - } catch (Exception e) { - drawHandlerObject = null; - GMessenger.message(NONEXISTANT, new Object[] {this, methodName, new Class[] { PApplet.class, GWinData.class } } ); - } - } - - /** - * Attempt to add the 'pre' handler method. - * The default event handler is a method that returns void and has two - * parameters GWinApplet and GWinData - * - * @param obj the object to handle the event - * @param methodName the method to execute in the object handler class - */ - public void addPreHandler(Object obj, String methodName){ - try{ - preHandlerMethod = obj.getClass().getMethod(methodName, new Class[] {PApplet.class, GWinData.class } ); - preHandlerObject = obj; - preHandlerMethodName = methodName; - } catch (Exception e) { - preHandlerMethod = null; - GMessenger.message(NONEXISTANT, new Object[] {this, methodName, new Class[] { PApplet.class, GWinData.class } } ); - } - } - - /** - * Attempt to add the 'mouse' handler method. - * The default event handler is a method that returns void and has three - * parameters GWinApplet, GWinData and a MouseEvent - * - * @param obj the object to handle the event - * @param methodName the method to execute in the object handler class - */ - public void addMouseHandler(Object obj, String methodName){ - try{ - mouseHandlerMethod = obj.getClass().getMethod(methodName, - new Class[] {PApplet.class, GWinData.class, MouseEvent.class } ); - mouseHandlerObject = obj; - mouseHandlerMethodName = methodName; - } catch (Exception e) { - mouseHandlerObject = null; - GMessenger.message(NONEXISTANT, new Object[] {this, methodName, new Class[] { PApplet.class, GWinData.class, MouseEvent.class } } ); - } - } - - /** - * Attempt to add the 'key' handler method. - * The default event handler is a method that returns void and has three - * parameters GWinApplet, GWinData and a KeyEvent - * - * @param obj the object to handle the event - * @param methodName the method to execute in the object handler class - */ - public void addKeyHandler(Object obj, String methodName){ - try{ - keyHandlerMethod = obj.getClass().getMethod(methodName, - new Class[] {PApplet.class, GWinData.class, KeyEvent.class } ); - keyHandlerObject = obj; - keyHandlerMethodName = methodName; - } catch (Exception e) { - keyHandlerObject = null; - GMessenger.message(NONEXISTANT, new Object[] {this, methodName, new Class[] { PApplet.class, GWinData.class, KeyEvent.class } } ); - } - } - - /** - * Attempt to add the 'post' handler method. - * The default event handler is a method that returns void and has two - * parameters GWinApplet and GWinData - * - * @param obj the object to handle the event - * @param methodName the method to execute in the object handler class - */ - public void addPostHandler(Object obj, String methodName){ - try{ - postHandlerMethod = obj.getClass().getMethod(methodName, - new Class[] {PApplet.class, GWinData.class } ); - postHandlerObject = obj; - postHandlerMethodName = methodName; - } catch (Exception e) { - postHandlerObject = null; - GMessenger.message(NONEXISTANT, new Object[] {this, methodName, new Class[] { PApplet.class, GWinData.class } } ); - } - } - - /** - * Attempt to create the on-close-window event handler for this GWindow. - * The default event handler is a method that returns void and has a single - * parameter of type GWindow (this will be a reference to the window that is - * closing)
- * - * The handler will not be called if the setActionOnClose flag is set - * to EXIT_APP
- * If the flag is set to CLOSE_WINDOW then the handler is called when the window - * is closed by clicking on the window-close-icon or using either the close or - * forceClose methods.
- * If the flag is set to KEEP_OPEN the window can only be closed using the - * forceClose method. In this case the handler will be called. - * - * - * @param obj the object to handle the on-close-window event - * @param methodName the method to execute in the object handler class - */ - public void addOnCloseHandler(Object obj, String methodName){ - try{ - closeHandlerObject = obj; - closetHandlerMethodName = methodName; - closetHandlerMethod = obj.getClass().getMethod(methodName, new Class[] { PApplet.class, GWinData.class } ); - } catch (Exception e) { - GMessenger.message(NONEXISTANT, new Object[] {this, methodName, new Class[] { PApplet.class, GWinData.class } } ); - closeHandlerObject = null; - closetHandlerMethodName = ""; - } - } - - /** - * This will close the window provided the action-on-close flag is CLOSE_WINDOW - * otherwise the window remains open. - */ - public void close(){ - if(actionOnClose == KEEP_OPEN || actionOnClose == EXIT_APP ) return; - prepareWindowForClosure(); - //G4P.markForWindowClosure(this); - } - - /** - * This will close the window provided the action-on-close flag is CLOSE_WINDOW - * or KEEP_OPEN otherwise the window remains open. - */ - public void forceClose(){ - if(actionOnClose == EXIT_APP) return; - if(actionOnClose == KEEP_OPEN) - setActionOnClose(CLOSE_WINDOW); - prepareWindowForClosure(); - //G4P.markForWindowClosure(this); - } - - /** - * Fire a window closing event - */ - protected abstract void fireCloseWindowEvent(); - - - /** - * Prepare the window for closure by stopping the animation loop, unregistering - * the event handlers and firing a window close event using a new thread. - */ - protected void prepareWindowForClosure(){ - noLoop(); - unregisterMethods(); - G4P.deregisterWindow(this); - (new Thread(new GCloseNotifier(this))).start(); - } - - /** - * This sets what happens when the users attempts to close the window.
- * There are 3 possible actions depending on the value passed.
- * G4P.KEEP_OPEN - ignore attempt to close window (default action),
- * G4P.CLOSE_WINDOW - close this window,
- * G4P.EXIT_APP - exit the app, this will cause all windows to close.
- * @param action the required close action - */ - public abstract void setActionOnClose(int action); - - public void settings() { - size(w, h, renderer_type); - } - - /** - * Set up the 'window' listeners - */ - protected abstract void initListeners(); - - public void setup(){ - surface.setTitle(title); // does not like this in settings - initListeners(); - } - - /** - * This method is executed when the window closes. It will call the user defined - * on-close-handler method set with - */ - public void performCloseAction(){ - if(closeHandlerObject != null){ - try { - closetHandlerMethod.invoke(closeHandlerObject, - new Object[] { this, data }); - } catch (Exception e) { - GMessenger.message(EXCP_IN_HANDLER, - new Object[] {preHandlerObject, preHandlerMethodName, e} ); - } - } - } - - /** - * This class is used to call the fireCloseWindowEvent in the appropriate - * GWindow sub-class. - * @author Peter Lager - * - */ - protected class GCloseNotifier implements Runnable { - - GWindow window = null; - - public GCloseNotifier(GWindow window) { - super(); - this.window = window; - } - - @Override - public void run() { - if(window != null){ - window.fireCloseWindowEvent(); - } - } - - } - - /** - * Window adapter class for the JAVA2D renderer - * - * @author Peter Lager - */ - protected class WindowAdapterAWT extends WindowAdapter { - GWindow window = null; - - public WindowAdapterAWT(GWindow window){ - this.window = window; - } - - public void windowClosing(WindowEvent evt) { - switch(actionOnClose){ - case EXIT_APP: - System.exit(0); - break; - case CLOSE_WINDOW: - performCloseAction(); - G4P.deregisterWindow(window); - dispose(); - break; - } - } - } - - /** - * Window adapter class for the P2D and P3D renderers - * - * @author Peter Lager - */ - protected class WindowAdapterNEWT extends com.jogamp.newt.event.WindowAdapter { - - GWindow window = null; - - public WindowAdapterNEWT(GWindow window){ - this.window = window; - } - public void windowGainedFocus(com.jogamp.newt.event.WindowEvent arg0) { - focused = true; - focusGained(); - } - - public void windowLostFocus(com.jogamp.newt.event.WindowEvent arg0) { - focused = false; - focusLost(); - } - - public void windowDestroyNotify(com.jogamp.newt.event.WindowEvent arg0) { - switch(actionOnClose){ - case EXIT_APP: - // Next two come from processing.opengl PSurfaceJOGL.java - // performCloseAction(); - //dispose(); - exitActual(); - break; - case CLOSE_WINDOW: - performCloseAction(); - G4P.deregisterWindow(window); - // Next one comes from processing.opengl PSurfaceJOGL.java - dispose(); - break; - } - } - - } - - public LinkedList windowControls = new LinkedList(); - // These next two lists are for controls that are to be added or remove since these - // actions must be performed outside the draw cycle to avoid concurrent modification - // exceptions when changing windowControls - public LinkedList toRemove = new LinkedList(); - public LinkedList toAdd = new LinkedList(); - - /** The object to handle the pre event */ - protected Object preHandlerObject = null; - /** The method in preHandlerObject to execute */ - protected Method preHandlerMethod = null; - /** the name of the method to handle the event */ - protected String preHandlerMethodName; - - /** The object to handle the post event */ - protected Object postHandlerObject = null; - /** The method in postHandlerObject to execute */ - protected Method postHandlerMethod = null; - /** the name of the method to handle the event */ - protected String postHandlerMethodName; - - /** The object to handle the draw event */ - protected Object drawHandlerObject = null; - /** The method in drawHandlerObject to execute */ - protected Method drawHandlerMethod = null; - /** the name of the method to handle the event */ - protected String drawHandlerMethodName; - - /** The object to handle the key event */ - protected Object keyHandlerObject = null; - /** The method in keyHandlerObject to execute */ - protected Method keyHandlerMethod = null; - /** the name of the method to handle the event */ - protected String keyHandlerMethodName; - - /** The object to handle the mouse event */ - protected Object mouseHandlerObject = null; - /** The method in mouseHandlerObject to execute */ - protected Method mouseHandlerMethod = null; - /** the name of the method to handle the event */ - protected String mouseHandlerMethodName; - - /** The object to handle the window closing event */ - protected Object closeHandlerObject = null; - /** The method in closeHandlerObject to execute */ - protected Method closetHandlerMethod = null; - /** the name of the method to handle the event */ - protected String closetHandlerMethodName; - - protected boolean is3D; -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GWindowAWT.java b/Processing/libraries/G4P/src/g4p_controls/GWindowAWT.java deleted file mode 100644 index e90b6fc..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GWindowAWT.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2015 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import java.awt.Frame; -import java.awt.Point; -import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; - -import javax.swing.JFrame; - -import processing.core.PVector; - -/** - * Class for independent windows using the JAVA2D renderer. These - * can be used to hold G4P GUI components or used for drawing or both combined. - *

- * A number of examples are included in the library and more info can be found - * at www.lagers.org.uk - * - * Updated for Processing V3 - * - * @author Peter Lager - * - */ -public class GWindowAWT extends GWindow{ - - protected GWindowAWT(String title, int w, int h) { - super(title, w, h); - is3D = false; - renderer_type = JAVA2D; - } - - public void draw() { - super.draw(); - pushMatrix(); - for(GAbstractControl control : windowControls){ - if( (control.registeredMethods & DRAW_METHOD) == DRAW_METHOD ) - control.draw(); - } - popMatrix(); - } - - /** - * Remove all existing window listeners and add our own custom listener. - */ - protected void initListeners(){ - Frame awtCanvas = getCanvas(); - for(WindowListener l : awtCanvas.getWindowListeners()) - awtCanvas.removeWindowListener(l); - awtCanvas.addWindowListener(new WindowAdapterAWT(this)); - } - - /** - * This sets what happens when the users attempts to close the window.
- * There are 3 possible actions depending on the value passed.
- * G4P.KEEP_OPEN - ignore attempt to close window (default action),
- * G4P.CLOSE_WINDOW - close this window,
- * G4P.EXIT_APP - exit the app, this will cause all windows to close.
- * @param action the required close action - */ - public void setActionOnClose(int action){ - JFrame awtCanvas = getCanvas(); - if(action == KEEP_OPEN) - awtCanvas.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); - else - awtCanvas.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - actionOnClose = action; - } - - private JFrame getCanvas(){ - return (JFrame) ((processing.awt.PSurfaceAWT.SmoothCanvas) surface.getNative()).getFrame(); - } - - /** - * Fire a window closing event. This method will be called from a new THread, do not call directly - */ - protected void fireCloseWindowEvent(){ - Frame awtCanvas = getCanvas(); - awtCanvas.getToolkit().getSystemEventQueue().postEvent(new WindowEvent(awtCanvas, WindowEvent.WINDOW_CLOSING)); - } - - /** - * Returns true if the window is visible else false - */ - public boolean isVisible(){ - return getCanvas().isVisible(); - } - - /** - * Get the window title - */ - public String getTitle() { - return getCanvas().getTitle(); - } - - /** - * Get the window position - */ - public PVector getPosition(PVector pos) { - if(pos == null) - pos = new PVector(); - Point p = getCanvas().getLocation(); - pos.x = p.x; - pos.y = p.y; - return pos; - } - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GWindowImpl.java b/Processing/libraries/G4P/src/g4p_controls/GWindowImpl.java deleted file mode 100644 index dcc34c1..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GWindowImpl.java +++ /dev/null @@ -1,195 +0,0 @@ -package g4p_controls; - -import java.util.Collections; -import java.util.LinkedList; - -import processing.core.PApplet; -import processing.core.PMatrix; -import processing.core.PMatrix3D; -import processing.event.KeyEvent; -import processing.event.MouseEvent; - -/** - * This class calls the appropriate methods for G4P controls for the main applet window. - * - * This will be created when the first control is added to the main window. - * - * @author Peter Lager - * - */ -public class GWindowImpl implements GConstants, GConstantsInternal { - - public LinkedList windowControls = new LinkedList(); - // These next two lists are for controls that are to be added or remove since these - // actions must be performed outside the draw cycle to avoid concurrent modification - // exceptions when changing windowControls - public LinkedList toRemove = new LinkedList(); - public LinkedList toAdd = new LinkedList(); - - - PApplet app; - PMatrix orgMatrix = null; - - public GWindowImpl(PApplet app){ - this.app = app; - PMatrix mat = app.getMatrix(); - if(mat instanceof PMatrix3D) - orgMatrix = mat; - registerMethods(); - } - - protected void registerMethods(){ - app.registerMethod("pre", this); - app.registerMethod("draw", this); - app.registerMethod("post", this); - app.registerMethod("mouseEvent", this); - app.registerMethod("keyEvent", this); - } - - protected void unregisterMethods(){ - app.unregisterMethod("pre", this); - app.unregisterMethod("draw", this); - app.unregisterMethod("post", this); - app.unregisterMethod("mouseEvent", this); - app.unregisterMethod("keyEvent", this); - } - - protected void addToWindow(GAbstractControl control){ - // Avoid adding duplicates - if(!toAdd.contains(control) && !windowControls.contains(control)){ - toAdd.add(control); - } - } - - protected void removeFromWindow(GAbstractControl control){ - toRemove.add(control); - } - - /** - * Set the colour scheme to be used by all controls on this window. - * @param cs colour scheme e.g. G4P.GREEN_SCHEME - */ - void invalidateBuffers(){ - for(GAbstractControl control : windowControls) - control.bufferInvalid = true; - } - - /** - * Set the colour scheme to be used by all controls on this window. - * @param cs colour scheme e.g. G4P.GREEN_SCHEME - */ - void setColorScheme(int cs){ - for(GAbstractControl control : windowControls) - control.setLocalColorScheme(cs); - } - - /** - * Set the alpha level for all controls on this window.
- * 0 = fully transparent
- * 255 = fully opaque
- * Controls are disabled when alpha gets below G4P.ALPHA_BLOCK (128) - * - * @param alpha 0-255 inclusive - */ - void setAlpha(int alpha){ - for(GAbstractControl control : windowControls) - control.setAlpha(alpha); - } - - public void draw() { - app.pushMatrix(); - if(orgMatrix != null) - app.setMatrix(orgMatrix); - for(GAbstractControl control : windowControls){ - if( (control.registeredMethods & DRAW_METHOD) == DRAW_METHOD ) - control.draw(); - } - app.popMatrix(); - } - - /** - * The mouse method registered with Processing - * - * @param event - */ - public void mouseEvent(MouseEvent event){ - for(GAbstractControl control : windowControls){ - if((control.registeredMethods & MOUSE_METHOD) == MOUSE_METHOD) - control.mouseEvent(event); - } - } - - /** - * The key method registered with Processing - */ - public void keyEvent(KeyEvent event) { - for(GAbstractControl control : windowControls){ - if( (control.registeredMethods & KEY_METHOD) == KEY_METHOD) - control.keyEvent(event); - } - } - - /** - * The pre method registered with Processing - */ - public void pre(){ - if(GAbstractControl.controlToTakeFocus != null && GAbstractControl.controlToTakeFocus.getPApplet() == app){ - GAbstractControl.controlToTakeFocus.setFocus(true); - GAbstractControl.controlToTakeFocus = null; - } - for(GAbstractControl control : windowControls){ - if( (control.registeredMethods & PRE_METHOD) == PRE_METHOD) - control.pre(); - } - } - - public void post() { - //System.out.println("POST"); - if(G4P.cursorChangeEnabled){ - if(GAbstractControl.cursorIsOver != null && GAbstractControl.cursorIsOver.getPApplet() == app) - app.cursor(GAbstractControl.cursorIsOver.cursorOver); - else - app.cursor(G4P.mouseOff); - } - for(GAbstractControl control : windowControls){ - if( (control.registeredMethods & POST_METHOD) == POST_METHOD) - control.post(); - } - // ===================================================================================================== - // ===================================================================================================== - // This is where components are removed or added to the window to avoid concurrent access violations - // ===================================================================================================== - // ===================================================================================================== - synchronized (this) { - // Dispose of any unwanted controls - if(!toRemove.isEmpty()){ - for(GAbstractControl control : toRemove){ - // If the control has focus then lose it - if(GAbstractControl.focusIsWith == control) - control.loseFocus(null); - // Clear control resources - control.buffer = null; - if(control.parent != null){ - control.parent.children.remove(control); - control.parent = null; - } - if(control.children != null) - control.children.clear(); - control.palette = null; - control.eventHandlerObject = null; - control.eventHandlerMethod = null; - control.winApp = null; - windowControls.remove(control); - System.gc(); - } - toRemove.clear(); - } - if(!toAdd.isEmpty()){ - for(GAbstractControl control : toAdd) - windowControls.add(control); - toAdd.clear(); - Collections.sort(windowControls, G4P.zorder); - } - } - } -} diff --git a/Processing/libraries/G4P/src/g4p_controls/GWindowNEWT.java b/Processing/libraries/G4P/src/g4p_controls/GWindowNEWT.java deleted file mode 100644 index 8929324..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/GWindowNEWT.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2015 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import processing.core.PMatrix; -import processing.core.PVector; - -/** - * Class for independent windows using P2D or P3D renderers. These - * can be used to hold G4P GUI components or used for drawing or both combined. - *

- * A number of examples are included in the library and more info can be found - * at www.lagers.org.uk - * - * Updated for Processing V3 - * - * @author Peter Lager - * - */ -public class GWindowNEWT extends GWindow { - - private PMatrix orgMatrix = null; - - protected GWindowNEWT(String title, int w, int h, boolean is3D) { - super(title, w, h); - this.is3D = is3D; - renderer_type = is3D ? P3D : P2D; - } - - public void setup(){ - super.setup(); - orgMatrix = getMatrix(); - } - - public void draw() { - super.draw(); - pushMatrix(); - if(is3D) { - hint(DISABLE_DEPTH_TEST); - setMatrix(orgMatrix); - } - for(GAbstractControl control : windowControls){ - if( (control.registeredMethods & DRAW_METHOD) == DRAW_METHOD ) - control.draw(); - } - if(is3D) hint(ENABLE_DEPTH_TEST); - popMatrix(); - } - - /** - * Remove all existing window listeners added by Processing and add our own custom listener. - */ - protected void initListeners(){ - //com.jogamp.newt.opengl.GLWindow newtCanvas = (com.jogamp.newt.opengl.GLWindow) surface.getNative(); - com.jogamp.newt.opengl.GLWindow newtCanvas = getCanvas(); - for(com.jogamp.newt.event.WindowListener l : newtCanvas.getWindowListeners()) - if(l.getClass().getName().startsWith("processing")) - newtCanvas.removeWindowListener(l); - newtCanvas.addWindowListener(new WindowAdapterNEWT(this)); - } - - /** - * This sets what happens when the users attempts to close the window.
- * There are 3 possible actions depending on the value passed.
- * G4P.KEEP_OPEN - ignore attempt to close window (default action),
- * G4P.CLOSE_WINDOW - close this window,
- * G4P.EXIT_APP - exit the app, this will cause all windows to close.
- * @param action the required close action - */ - public void setActionOnClose(int action){ - com.jogamp.newt.opengl.GLWindow newtCanvas = getCanvas(); - if(action == KEEP_OPEN) - newtCanvas.setDefaultCloseOperation(com.jogamp.nativewindow.WindowClosingProtocol.WindowClosingMode.DO_NOTHING_ON_CLOSE); - else - newtCanvas.setDefaultCloseOperation(com.jogamp.nativewindow.WindowClosingProtocol.WindowClosingMode.DISPOSE_ON_CLOSE); - actionOnClose = action; - } - - private com.jogamp.newt.opengl.GLWindow getCanvas(){ - return (com.jogamp.newt.opengl.GLWindow) surface.getNative(); - } - - /** - * Fire a window closing event - */ - protected void fireCloseWindowEvent() { - getCanvas().destroy(); - } - - /** - * Returns true if the window is visible else false - */ - public boolean isVisible(){ - return getCanvas().isVisible(); - } - - /** - * Get the window title - */ - public String getTitle() { - return getCanvas().getTitle(); - } - - /** - * Get the window position. - */ - public PVector getPosition(PVector pos) { - if(pos == null) - pos = new PVector(); - pos.x = getCanvas().getX(); - pos.y = getCanvas().getY(); - return pos; - } - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/HotSpot.java b/Processing/libraries/G4P/src/g4p_controls/HotSpot.java deleted file mode 100644 index 4d7bedb..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/HotSpot.java +++ /dev/null @@ -1,246 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import processing.core.PApplet; -import processing.core.PImage; - -/** - * Base class for different types of hot spot. - * - * @author Peter Lager - * - */ -abstract class HotSpot implements GConstants, Comparable { - - public final Integer id; - public float x, y; - - abstract public boolean contains(float px, float py); - - protected HotSpot(int id){ - this.id = Math.abs(id); - } - - public void adjust(Object ... arguments){} - - public int compareTo(HotSpot spoto) { - return id.compareTo(spoto.id); - } - - /** - * Hit is based on being inside a rectangle. - * - * @author Peter Lager - */ - static class HSrect extends HotSpot { - public float w, h; - - public HSrect(int id, float x, float y, float w, float h) { - super(id); - this.x = x; - this.y = y; - this.w = w; - this.h = h; - } - - @Override - public boolean contains(float px, float py) { - return (px >= x && py >= y && px <= x + w && py <= y + h); - } - } - - /** - * Hit based on an arc (pie slice) - * - * @author Peter Lager - * - */ - static class HSarc extends HotSpot { - - public float sa, ea, r, r2; - - public HSarc(int id, float x, float y, float r, float sa, float ea) { - super(id); - this.x = x; - this.y = y; - this.r = r; - this.r2 = r * r; - this.sa = sa; - this.ea = ea; - } - - - @Override - public boolean contains(float px, float py) { - if((px-x)*(px-x) + (py-y)*(py-y) > r2) - return false; - // Now check angle - float a = (float) Math.toDegrees(Math.atan2(py-y, px-x)); - if(a < 0) a += 360; - if(a < sa) a += 360; - return (a >= sa && a <= ea); - } - } - - /** - * Hit is based on being inside a rectangle. - * - * @author Peter Lager - */ - static class HScircle extends HotSpot { - public float r, r2; - - public HScircle(int id, float x, float y, float r) { - super(id); - this.x = x; - this.y = y; - this.r = r; - this.r2 = r * r; - } - - @Override - public boolean contains(float px, float py) { - return ((px-x)*(px-x) + (py-y)*(py-y) <= r2); - } - - /** - * If used the parameters must be in the order x, y then r.
- * - */ - @SuppressWarnings(value={"fallthrough"}) - public void adjust(Object ... arguments){ - switch(arguments.length){ - case 3: - r = Float.valueOf(arguments[2].toString()); - r2 = r * r; - case 2: - y = Float.valueOf(arguments[1].toString()); - case 1: - x = Float.valueOf(arguments[0].toString()); - } - } - - - public String toString(){ - return "HS circle ["+x+", "+y+"] radius = "+r; - } - } - - /** - * Hit depends on the mask image. non-transparent areas are black and - * transparent areas are white.
- * - * It is better this way because scaling the image can change the - * colour white to very nearly white but black is unchanged so is - * easier to test. - * - * @author Peter Lager - * - */ - static class HSmask extends HotSpot { - - private PImage mask = null; - - protected HSmask(int id, PImage mask) { - super(id); - this.mask = mask; - } - - @Override - public boolean contains(float px, float py) { - if(mask != null){ - int pixel = mask.get((int)px, (int)py); - float alpha = (pixel >> 24) & 0xff; - // A > 0 and RGB = 0 is transparent - if(alpha > 0 && (pixel & 0x00ffffff) == 0){ - return true; - } - } - return false; - } - - public String toString(){ - return "HS mask ["+x+", "+y+"]"; - } - - } - - /** - * Hit is determined by the alpha channel value. - * @author Peter - * - */ - static class HSalpha extends HotSpot { - - private PImage image = null; - - private int offX, offY; - - protected HSalpha(int id, float x, float y, PImage image, int imageMode) { - super(id); - this.image = image; - this.x = x; - this.y = y; - if(imageMode == PApplet.CENTER){ - offX = -image.width/2; - offY = -image.height/2; - } - else - offX = offY = 0; - } - - /** - * If used the parameters must be in the order x, y then image.
- */ - @SuppressWarnings(value={"fallthrough"}) - public void adjust(Object ... arguments){ - switch(arguments.length){ - case 3: - image = (PImage) arguments[2]; - case 2: - y = Float.valueOf(arguments[1].toString()); - case 1: - x = Float.valueOf(arguments[0].toString()); - } - } - - @Override - public boolean contains(float px, float py) { - if(image != null){ - int imgX = Math.round(px - x) - offX; - int imgY = Math.round(py - y) - offY; - float alpha = (image.get(imgX, imgY) >> 24) & 0xff; - if(alpha > ALPHA_PICK) - return true; - } - return false; - } - - public String toString(){ - return "HS alpha ["+x+", "+y+"]"; - } - - } -} diff --git a/Processing/libraries/G4P/src/g4p_controls/ImageManager.java b/Processing/libraries/G4P/src/g4p_controls/ImageManager.java deleted file mode 100644 index f82647d..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/ImageManager.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2012 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import java.util.HashMap; - -import processing.core.PApplet; -import processing.core.PImage; - -/** - * This class is used to load bitmap files and create images.
- * - * Although there maybe multiple requests for a particular bitmap file only - * one PImage is created for each file. - * - * @author Peter Lager - * - */ -public class ImageManager { - - private static HashMap textures = new HashMap(); - - /** - * Load a single bitmap file return a reference to the PImage created. - * - * @param app - * @param filename - * @return null if the file does not exist else the PImage object - */ - public static PImage loadImage(PApplet app, String filename){ - if(textures.containsKey(filename)){ - return textures.get(filename); - } - PImage image = app.loadImage(filename); - if(image != null){ - textures.put(filename, image); - } - else - PApplet.println("Unable to load image from file '" + filename+"'"); - return image; - } - - /** - * Load images from multiple files - * @param app - * @param filename an array of filenames - * @return an array of images - */ - public static PImage[] loadImage(PApplet app, String[] filename){ - PImage[] images = new PImage[filename.length]; - for(int i = 0; i < images.length; i++) - images[i] = loadImage(app, filename[i]); - return images; - } - - - - /** - * Make multiple images from a given image. This method creates - * a 2D array (size [nCols, nRows] ) of PImage objects. - * - * @param app - * @param img the tiled image - * @param nCols number of tiles across - * @param nRows number of tiles down - * @return a 2D array of images (tiles) - */ - public static PImage[][] makeTiles2D(PApplet app, PImage img, int nCols, int nRows){ - PImage[][] imageTiles = new PImage[nCols][nRows]; - int tileW = img.width / nCols; - int tileH = img.height / nRows; - for(int y = 0; y < nRows; y++){ - for(int x = 0; x < nCols; x++){ - imageTiles[x][y] = app.createImage(tileW, tileH, PApplet.ARGB); - imageTiles[x][y].copy(img, x * tileW, y * tileH, tileW, tileH, 0, 0, tileW, tileH); - } - } - return imageTiles; - } - - /** - * Make multiple images from a given image. This method creates - * a 1D array of PImage objects. The order is left-right and top-down. - * - * @param app - * @param img the tiled image - * @param nCols number of tiles across - * @param nRows number of tiles down - * @return a 1D array of images (tiles) - */ - public static PImage[] makeTiles1D(PApplet app, PImage img, int nCols, int nRows){ - PImage[] imageTiles = new PImage[nCols * nRows]; - int tileW = img.width / nCols; - int tileH = img.height / nRows; - int tileNo = 0; - for(int y = 0; y < nRows; y++){ - for(int x = 0; x < nCols; x++){ - imageTiles[tileNo] = app.createImage(tileW, tileH, PApplet.ARGB); - imageTiles[tileNo].copy(img, x * tileW, y * tileH, tileW, tileH, 0, 0, tileW, tileH); - tileNo++; - } - } - return imageTiles; - } - - - -} diff --git a/Processing/libraries/G4P/src/g4p_controls/StyledString.java b/Processing/libraries/G4P/src/g4p_controls/StyledString.java deleted file mode 100644 index e1ccfb0..0000000 --- a/Processing/libraries/G4P/src/g4p_controls/StyledString.java +++ /dev/null @@ -1,1360 +0,0 @@ -/* - Part of the G4P library for Processing - http://www.lagers.org.uk/g4p/index.html - http://sourceforge.net/projects/g4p/files/?source=navbar - - Copyright (c) 2013 Peter Lager - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package g4p_controls; - -import java.awt.Color; -import java.awt.Font; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Point; -import java.awt.font.FontRenderContext; -import java.awt.font.GraphicAttribute; -import java.awt.font.ImageGraphicAttribute; -import java.awt.font.LineBreakMeasurer; -import java.awt.font.TextAttribute; -import java.awt.font.TextHitInfo; -import java.awt.font.TextLayout; -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.io.InputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.OutputStream; -import java.io.Serializable; -import java.text.AttributedCharacterIterator; -import java.text.AttributedCharacterIterator.Attribute; -import java.text.AttributedString; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.ListIterator; - -import processing.core.PApplet; - -/** - * This class is used to represent text with attributes.
- * It means that you don't have to have the same style of font - * or even the same font face over the whole length of the text.
- * - * Most font features can be modified all except the text background - * which is transparent. There is a feature to highlight part of the string - * by having a different background colour but this is used for highlighting - * selected text in GTextField and GTextArea components.
- * - * It is also used for all controls that use text. - * @author Peter Lager - * - */ -public final class StyledString implements GConstantsInternal, Serializable { - - private static final long serialVersionUID = -8272976313009558508L; - - transient private AttributedString styledText = null; - transient private ImageGraphicAttribute spacer = null; - transient private LineBreakMeasurer lineMeasurer = null; - transient private LinkedList linesInfo = new LinkedList(); - transient private Font font = null; - - private static final char EOL = '\n'; - - // The plain text to be styled - private String plainText = ""; - // List of attribute runs to match font - private LinkedList baseStyle = new LinkedList(); - // List of attribute runs to be applied over the base style - private LinkedList atrun = new LinkedList(); - - // The width to break a line - private int wrapWidth = Integer.MAX_VALUE; - // Flag to determine whether the text layouts need recalculating - private boolean invalidLayout = true; - // Flag to determine whether the actual character string have changed - private boolean invalidText = true; - - // Base justification - private boolean justify = false; - private float justifyRatio = 0.7f; - - // Stats - private float textHeight = 0; - private float maxLineLength = 0; - private float maxLineHeight = 0; - private int nbrLines; - - // These are only used by GTextField and GTextArea to store the start and end positions - // for selected text when the string is to be saved. - int startIdx = -1; - int endIdx = -1; - - /** - * This is assumed to be a single line of text (i.e. no wrap). - * EOL characters will be stripped from the text before use. - * - * @param startText - */ - public StyledString(String startText){ - plainText = removeSingleSpacingFromPlainText(startText); - spacer = getParagraghSpacer(1); // safety - // Get rid of any EOLs - styledText = new AttributedString(plainText); - clearAttributes(); - applyAttributes(); - invalidText = true; - invalidLayout = true; - } - - /** - * Supports multiple lines of text wrapped on word boundaries.
- * - * @param startText the text to use - * @param wrapWidth the wrap width - */ - public StyledString(String startText, int wrapWidth){ - if(wrapWidth > 0 && wrapWidth < Integer.MAX_VALUE) - this.wrapWidth = wrapWidth; - plainText = (wrapWidth == Integer.MAX_VALUE) ? removeSingleSpacingFromPlainText(startText) : removeDoubleSpacingFromPlainText(startText); - spacer = getParagraghSpacer(this.wrapWidth); - styledText = new AttributedString(plainText); - styledText = insertParagraphMarkers(plainText, styledText); - clearAttributes(); - applyAttributes(); - invalidText = true; - invalidLayout = true; - } - - /** - * Change the text for single line styled string - * @param text the text to use - */ - public void setText(String text){ - setText(text, Integer.MAX_VALUE); - } - - /** - * Change the text for single line styled string - * @param text the text to use - * @param wrapWidth the wrap width - */ - public void setText(String text, int wrapWidth){ - setWrapWidth(wrapWidth); - if(text != null && !text.equals(plainText)){ - plainText = text; - if(this.wrapWidth == Integer.MAX_VALUE){ - removeSingleSpacingFromPlainText(plainText); - spacer = getParagraghSpacer(1); - styledText = new AttributedString(plainText); - } - else { - removeDoubleSpacingFromPlainText(plainText); - spacer = getParagraghSpacer(this.wrapWidth); - styledText = new AttributedString(plainText); - styledText = insertParagraphMarkers(plainText, styledText); - } - clearAttributes(); - applyAttributes(); - invalidText = true; - invalidLayout = true; - } - } - - /** - * Converts this StyledString from multi-line to single-line by replacing all EOL - * characters with the space character - * for paragraphs - * @param ptext - * @param as - * @return the converted string - */ - StyledString convertToSingleLineText(){ - // Make sure we have something to work with. - if(styledText == null || plainText == null){ - plainText = ""; - styledText = new AttributedString(plainText); - } - else { - // Scan through plain text and for each EOL replace the paragraph spacer from - // the attributed string (styledText). - int fromIndex = plainText.indexOf('\n', 0); - if(fromIndex >= 0){ - while(fromIndex >= 0){ - try { // if text == "\n" then an exception is thrown - styledText.addAttribute(TextAttribute.CHAR_REPLACEMENT, ' ', fromIndex, fromIndex + 1); - fromIndex = plainText.indexOf('\n', fromIndex + 1); - } - catch(Exception excp){ - break; - } - } - // Finally replace all EOL in the plainText - plainText = plainText.replace('\n', ' '); - } - } - wrapWidth = Integer.MAX_VALUE; - return this; - } - - /** - * Get the plain text as a String. Any line breaks will kept and will - * be represented by the character 'backslash n'
- * @return the associated plain text - */ - public String getPlainText(){ - return plainText; - } - - /** - * Get the plain text as a String. Any line breaks will kept and will - * be represented by the character 'backslash n'
- * - * @param beginIdx the beginning index inclusive - * @param endIdx the ending index exclusive - * @return the substring starting at beginIdx to endIdx-1 - */ - public String getPlainText(int beginIdx, int endIdx){ - if(beginIdx < 0) beginIdx = 0; - if(endIdx > plainText.length()) endIdx = plainText.length(); - return plainText.substring(beginIdx, endIdx); - } - - /** - * Get a line of text from the plain text. Lines are separated by - * End-of-line (EOL) characters. - * - * @param lineNo the line number we want the text for - * @return the line of text or an empty string if the line number is invalid. - */ - public String getPlainText(int lineNo){ - Point loc = getPlainTextLinePosImpl(lineNo, null); - return (loc == null) ? "" : plainText.substring(loc.x, loc.y); - } - - - private Point getPlainTextLinePosImpl(int lineNo, Point loc){ - if(lineNo < 0) - return null; - int pos = 0, p0 = 0, count = lineNo; - // Find start of line - while(count > 0 && pos < plainText.length()){ - if(plainText.charAt(pos) == EOL) - count--; - pos++; - } - // If we haven't found start of line then return empty string - if(count > 0) - return null; - p0 = pos; - while(pos < plainText.length() && plainText.charAt(pos) != EOL) - pos++; - if(loc == null) - loc = new Point(); - else { - loc.x = p0; - loc.y = pos; - } - return loc; - } - - /** - * Get the plain text as a String array. (splitting on line breaks) - * @return the associated plain text as a String array split on line breaks - */ - public String[] getPlainTextAsArray(){ - return plainText.split("\n"); - } - - /** - * Get the number of characters in this styled string - */ - public int length(){ - return plainText.length(); - } - - /** - * Text can be either left or fully justified. - * @param justify true for full justification - */ - public void setJustify(boolean justify){ - if(this.justify != justify){ - this.justify = justify; - invalidLayout = true; - } - } - - /** - * Justify only if the line has sufficient text to do so. - * - * @param jRatio ratio of text length to visibleWidth - */ - public void setJustifyRatio(float jRatio){ - if(justifyRatio != jRatio){ - justifyRatio = jRatio; - if(justify) - invalidLayout = true; - } - } - - /** - * This class uses transparent images to simulate end/starting positions - * for paragraphs - * @param ptext - * @param as - * @return the styled string with paragraph marker images embedded - */ - private AttributedString insertParagraphMarkers(String ptext, AttributedString as ){ - if(ptext != null && ptext.length() > 0) - plainText = ptext; - int fromIndex = ptext.indexOf('\n', 0); - while(fromIndex >= 0){ - try { // if text == "\n" then an exception is thrown - as.addAttribute(TextAttribute.CHAR_REPLACEMENT, spacer, fromIndex, fromIndex + 1); - fromIndex = ptext.indexOf('\n', fromIndex + 1); - } - catch(Exception excp){ - break; - } - } - return as; - } - - /** - * If the text attribute is BACKGROUND or FOREGROUND then if we pass - * an integer (e.g. from Processing sketch) then convert it. - * - * @param ta the text attribute - * @param value the value to use with this text attribute - */ - private Object validateTextAttributeColor(TextAttribute ta, Object value){ - if((ta == TextAttribute.BACKGROUND || ta == TextAttribute.FOREGROUND) && !(value instanceof Color)) - return new Color((Integer) value); - else - return value; - } - - /** - * Add an attribute that affects the whole length of the string. - * - * @param type attribute type - * @param value attribute value - */ - public void addAttribute(Attribute type, Object value){ - addAttribute(type, value, Integer.MIN_VALUE, Integer.MAX_VALUE); - } - - /** - * Add a text attribute (style) to the specifies range of characters - * - * @param type attribute type - * @param value attribute value - * @param lineNo the line of test affected - * @param charStart the first character affected - * @param charEnd the character position after the last character affected. - */ - public void addAttribute(Attribute type, Object value, int lineNo, int charStart, int charEnd){ - if(lineNo >= 0 && lineNo < linesInfo.size()){ - TextLayoutInfo tli = linesInfo.get(lineNo); - int lineStartsAt = tli.startCharIndex; - charEnd = Math.min(charEnd, tli.nbrChars); - addAttribute(type, value, lineStartsAt + charStart, lineStartsAt + charEnd); - } - } - - /** - * Add a text attribute (style) to an entire display line - * - * @param type attribute type - * @param value attribute value - * @param lineNo the line of test affected - */ - public void addAttribute(Attribute type, Object value, int lineNo){ - if(lineNo >= 0 && lineNo < linesInfo.size()){ - TextLayoutInfo tli = linesInfo.get(lineNo); - addAttribute(type, value, tli.startCharIndex, tli.startCharIndex + tli.nbrChars); - } - } - - /** - * Set the attribute to be applied to a range of characters starting at - * beginIdx and ending with endIdx-1. - * - * @param type attribute type - * @param value attribute value - * @param beginIdx the index of the first character (inclusive) - * @param endIdx the index of the last character (exclusive) - */ - public void addAttribute(Attribute type, Object value, int beginIdx, int endIdx){ - value = validateTextAttributeColor((TextAttribute) type, value); - AttributeRun ar = new AttributeRun(type, value, beginIdx, endIdx); - // If we already have attributes try and rationalize the number by merging - // runs if possible and removing runs that no longer have a visible effect. - if(atrun.size() > 0){ - ListIterator iter = atrun.listIterator(atrun.size()); - while(iter.hasPrevious()){ - AttributeRun a = iter.previous(); - int action = ar.intersectionWith(a); - int intersect = action & I_MODES; - int combiMode = action & COMBI_MODES; - if(combiMode == MERGE_RUNS){ - switch(intersect){ - case I_TL: - case I_CL: - ar.start = a.start; - iter.remove(); - break; - case I_TR: - case I_CR: - ar.end = a.end; - iter.remove(); - break; - } - } - else if(combiMode == CLIP_RUN){ - switch(intersect){ - case I_CL: - a.end = ar.start; - break; - case I_CR: - a.start = ar.end; - break; - } - } - switch(intersect){ - case I_INSIDE: - iter.remove(); - break; - case I_COVERED: - ar = null; - break; - } - } - } - // If the run is still effective then add it - if(ar != null) - atrun.addLast(ar); - applyAttributes(); - invalidLayout = true; - } - - /** - * Remove text attributes (style) to the specified line and range of characters. - * - * @param lineNo the line of test affected - * @param beginIdx the index of the first character (inclusive) - * @param endIdx the index of the last character (exclusive) - */ - public void clearAttributes(int lineNo, int beginIdx, int endIdx){ - if(lineNo >= 0 && lineNo < linesInfo.size()){ - TextLayoutInfo tli = linesInfo.get(lineNo); - int lineStartsAt = tli.startCharIndex; - endIdx = Math.min(endIdx, tli.nbrChars); - clearAttributes(lineStartsAt + beginIdx, lineStartsAt + endIdx); - } - } - - /** - * - * @param lineNo - */ - public void clearAttributes(int lineNo){ - if(lineNo >= 0 && lineNo < linesInfo.size()){ - TextLayoutInfo tli = linesInfo.get(lineNo); - clearAttributes(tli.startCharIndex, tli.startCharIndex + tli.nbrChars); - } - } - - /** - * Remove text attributes (style) to the specified range of characters. - * - * @param beginIdx the index of the first character (inclusive) - * @param endIdx the index of the last character (exclusive) - */ - public void clearAttributes(int beginIdx, int endIdx){ - ListIterator iter = atrun.listIterator(); - AttributeRun ar; - while(iter.hasNext()){ - ar = iter.next(); - // Make sure we have intersection - if( !(beginIdx >= ar.end && endIdx >= ar.start )){ - // Find the limits to clear - int s = Math.max(beginIdx, ar.start); - int e = Math.min(endIdx, ar.end); - if(ar.start == s && ar.end == e) - iter.remove(); - else if(ar.start == s) // clear style from beginning - ar.start = e; - else if(ar.end == e) // clear style from end - ar.end = s; - else { // Split attribute run - AttributeRun ar2 = new AttributeRun(ar.atype, ar.value, e, ar.end); - iter.add(ar2); - ar.end = s; - } - } - } - invalidText = true; - } - - /** - * Removes all styling from the string. - * - */ - public void clearAttributes(){ - atrun.clear(); - invalidText = true; - } - - /** - * Must call this method to apply - */ - private void applyAttributes(){ - if(plainText.length() > 0){ - for(AttributeRun bsar : baseStyle) - styledText.addAttribute(bsar.atype, bsar.value); - Iterator iter = atrun.iterator(); - AttributeRun ar; - - while(iter.hasNext()){ - ar = iter.next(); - if(ar.end == Integer.MAX_VALUE) - styledText.addAttribute(ar.atype, ar.value); - else { - // If an attribute run fails do not try and fix it - dump it - try { - styledText.addAttribute(ar.atype, ar.value, ar.start, ar.end); - } - catch(Exception excp){ - System.out.println("Dumping " + ar); - excp.printStackTrace(); - iter.remove(); - } - } - } - } - invalidLayout = true; - } - - /** - * Insert some text into the position indicated.
- * - * @param lineNo a valid line number - * @param charStart the position in the line >= 0 - * @param chars the characters to insert - * @param startNewLine prefix the chars with a EOL - * @param endNewLine postfix the chars with a EOL - * @return the number of characters inserted - */ - public int insertCharacters(String chars, int lineNo, int charStart, boolean startNewLine, boolean endNewLine){ - if(lineNo >= 0 && lineNo < linesInfo.size()){ - TextLayoutInfo tli = linesInfo.get(lineNo); - int insertPos = tli.startCharIndex + Math.min(charStart, tli.nbrChars); - return insertCharactersImpl(insertPos, chars, startNewLine, endNewLine); - } - return 0; - } - - /** - * Insert 1 or more characters into the string. The inserted text will first be made - * safe by removing any inappropriate EOL characters.
- * Do not use this method to insert EOL characters, use the
insertEOL(int)
- * method instead. - * - * @param insertPos position in string to insert characters - * @param chars the characters to insert - * @return the number of characters inserted - */ - public int insertCharacters(String chars, int insertPos){ - return insertCharactersImpl(insertPos, chars, false, false); - } - - /** - * Insert 1 or more characters into the string. The inserted text will first be made - * safe by removing any inappropriate EOL characters.
- * Do not use this method to insert EOL characters, use the
insertEOL(int)
- * method instead. - * - * @param insertPos position in string to insert characters - * @param chars the characters to insert - * @param startNewLine if true insert onto a new line - * @return the number of characters inserted - */ - public int insertCharacters(String chars, int insertPos, boolean startNewLine, boolean endNewLine){ - return insertCharactersImpl(insertPos, chars, startNewLine, endNewLine); - } - - /** - * Implementation for inserting characters into the plain text. - * - * @param insertPos the position to insert the text - * @param chars the characters to insert - * @param startNewLine inserted text to start on new line - * @param endNewLine text after inserted text to start on new line - * @return the number of characters inserted including EOLs - */ - private int insertCharactersImpl(int insertPos, String chars, boolean startNewLine, boolean endNewLine){ - chars = makeStringSafeForInsert(chars); - int nbrChars = chars.length(); - int nbrCharsInserted = nbrChars; - if(nbrChars > 0){ - plainText = plainText.substring(0, insertPos) + chars + plainText.substring(insertPos); - if(endNewLine && plainText.charAt(insertPos + nbrChars) != '\n') - nbrCharsInserted += insertEOL(insertPos + nbrChars) ? 1 : 0; - if(startNewLine && insertPos > 0) - nbrCharsInserted += insertEOL(insertPos) ? 1 : 0; - insertParagraphMarkers(plainText, styledText); - for(AttributeRun ar : atrun){ - if(ar.end < Integer.MAX_VALUE){ - if(ar.end >= insertPos){ - ar.end += nbrChars; - if(ar.start >= insertPos) - ar.start += nbrChars; - } - } - } - invalidText = true; - } - return nbrCharsInserted; - } - - /** - * This is ONLY used when multiple characters are to be inserted.
- * If it is single line text i.e. no wrapping then it removes all EOLs - * If it is multiple line spacing it will reduce all double EOLs to single - * EOLs and remove any EOLs at the start or end of the string. - * - * @param chars - * @return a string that is safe for inserting - */ - private String makeStringSafeForInsert(String chars){ - // Get rid of single / double line spacing - if(chars.length() > 0){ - if(wrapWidth == Integer.MAX_VALUE) // no wrapping remove all - chars = removeSingleSpacingFromPlainText(chars); - else { - chars = removeDoubleSpacingFromPlainText(chars); // wrapping remove double spacing - // no remove EOL at ends of string - while(chars.length() > 0 && chars.charAt(0) == '\n') - chars = chars.substring(1); - while(chars.length() > 0 && chars.charAt(chars.length() - 1) == '\n') - chars = chars.substring(0, chars.length() - 1); - } - } - return chars; - } - - /** - * Use this method to insert an EOL character. - * @param insertPos index position to insert EOL - * @return true if an EOL was inserted into the string - */ - public boolean insertEOL(int insertPos){ - if(wrapWidth != Integer.MAX_VALUE){ - if(insertPos == 0) - return false; - if(insertPos > 0 && plainText.charAt(insertPos-1) == '\n') - return false; - if(insertPos < plainText.length()-1 && plainText.charAt(insertPos+1) == '\n'){ - return false; - } - plainText = plainText.substring(0, insertPos) + "\n" + plainText.substring(insertPos); - insertParagraphMarkers(plainText, styledText); - for(AttributeRun ar : atrun){ - if(ar.end < Integer.MAX_VALUE){ - if(ar.end >= insertPos){ - ar.end += 1; - if(ar.start >= insertPos) - ar.start += 1; - } - } - } - invalidText = true; - return true; - } - return false; - } - - - /** - * Remove a number of characters from the string - * - * @param nbrToRemove number of characters to remove - * @param fromPos start location for removal - * @return true if the deletion was successful else false - */ - public boolean deleteCharacters(int fromPos, int nbrToRemove){ - if(fromPos < 0 || fromPos + nbrToRemove > plainText.length()) - return false; - /* - * If the character preceding the selection and the character immediately after the selection - * are both EOLs then increment the number of characters to be deleted - */ - if(wrapWidth != Integer.MAX_VALUE){ - if(fromPos > 0 && fromPos + nbrToRemove < plainText.length() - 1){ - if(plainText.charAt(fromPos) == '\n' && plainText.charAt(fromPos + nbrToRemove) == '\n'){ - nbrToRemove++; - } - } - } - if(fromPos != 0) - plainText = plainText.substring(0, fromPos) + plainText.substring(fromPos + nbrToRemove); - else - plainText = plainText.substring(fromPos + nbrToRemove); - // For wrappable text make sure we have not created - if(plainText.length() == 0){ - atrun.clear(); - styledText = null; - } - else { - ListIterator iter = atrun.listIterator(atrun.size()); - AttributeRun ar; - while(iter.hasPrevious()){ - ar = iter.previous(); - if(ar.end < Integer.MAX_VALUE){ - // Only need to worry about this if the run ends after the deletion point - if(ar.end >= fromPos){ - int lastPos = fromPos + nbrToRemove; - // Deletion removes entire run - if(fromPos <= ar.start && lastPos >= ar.end){ - iter.remove(); - continue; - } - // Deletion fits entirely within the run - if(fromPos > ar.start && lastPos < ar.end){ - ar.end -= nbrToRemove; - continue; - } - // Now we have overlap either at one end of the run - // Overlap at start of run? - if(fromPos <= ar.start){ - ar.start = fromPos; - ar.end -= nbrToRemove; - continue; - } - // Overlap at end of run? - if(lastPos >= ar.end){ - ar.end = fromPos; - continue; - } - System.out.println("This run was not modified"); - System.out.println("Run from " + ar.start + " to " + ar.end); - System.out.println("Delete from " + fromPos + " To " + lastPos + " (" + nbrToRemove + " to remove)"); - } - } - } - } - invalidText = true; - return true; - } - - private void setFont(Font a_font){ - if(a_font != null && a_font != font){ - font = a_font; - baseStyle.clear(); - baseStyle.add(new AttributeRun(TextAttribute.FAMILY, font.getFamily())); - baseStyle.add(new AttributeRun(TextAttribute.SIZE, font.getSize())); - baseStyle.add(new AttributeRun(TextAttribute.WIDTH, TextAttribute.WIDTH_REGULAR)); - if(font.isBold()) - baseStyle.add(new AttributeRun(TextAttribute.WEIGHT, TextAttribute.WEIGHT_REGULAR)); - else - baseStyle.add(new AttributeRun(TextAttribute.WEIGHT, TextAttribute.WEIGHT_REGULAR)); - if(font.isItalic()) - baseStyle.add(new AttributeRun(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE)); - else - baseStyle.add(new AttributeRun(TextAttribute.POSTURE, TextAttribute.POSTURE_REGULAR)); - invalidText = true; - } - } - - public void invalidateText(){ - invalidText = true; - } - - /** - * Get the text layouts for display if the string has changed since last call - * to this method regenerate them. - * - * @param g2d Graphics2D display context - * @return a list of text layouts for rendering - */ - public LinkedList getLines(Graphics2D g2d){ - if(font != g2d.getFont()){ - setFont(g2d.getFont()); - invalidText = true; - } - if(invalidText){ - styledText = new AttributedString(plainText); - styledText = insertParagraphMarkers(plainText, styledText); - setFont(font); - applyAttributes(); - invalidText = false; - invalidLayout = true; - } - if(invalidLayout){ - linesInfo.clear(); - if(plainText.length() > 0){ - textHeight = 0; - maxLineLength = 0; - maxLineHeight = 0; - nbrLines = 0; - AttributedCharacterIterator paragraph = styledText.getIterator(null, 0, plainText.length()); - FontRenderContext frc = g2d.getFontRenderContext(); - lineMeasurer = new LineBreakMeasurer(paragraph, frc); - float yposinpara = 0; - int charssofar = 0; - while (lineMeasurer.getPosition() < plainText.length()) { - TextLayout layout = lineMeasurer.nextLayout(wrapWidth); - float advance = layout.getVisibleAdvance(); - if(justify){ - if(justify && advance > justifyRatio * wrapWidth){ - // If advance > breakWidth then we have a line break - float jw = (advance > wrapWidth) ? advance - wrapWidth : wrapWidth; - layout = layout.getJustifiedLayout(jw); - } - } - // Remember the longest and tallest value for a layout so far. - float lh = getHeight(layout); - if(lh > maxLineHeight) - maxLineHeight = lh; - textHeight += lh; - if(advance <= wrapWidth && advance > maxLineLength) - maxLineLength = advance; - - // Store layout and line info - linesInfo.add(new TextLayoutInfo(nbrLines, layout, charssofar, layout.getCharacterCount(), yposinpara)); - charssofar += layout.getCharacterCount(); - yposinpara += lh; - nbrLines++; - } - } - invalidLayout = false; - } - return linesInfo; - } - - /** - * Get the number of lines in the layout - */ - public int getNbrLines(){ - return nbrLines; - } - - /** - * Return the height of the text line(s) - */ - public float getTextAreaHeight(){ - return textHeight; - } - - /** - * Return the length of the longest line. - */ - public float getMaxLineLength(){ - return maxLineLength; - } - - /** - * Get the height of the tallest line - */ - public float getMaxLineHeight(){ - return maxLineHeight; - } - - /** - * Get the height of the given TextLayout - * @param layout - * @return the height of a given text layout - */ - private float getHeight(TextLayout layout){ - return layout.getAscent() +layout.getDescent() + layout.getLeading(); - } - - /** - * Get the break width used to create the lines. - */ - public int getWrapWidth(){ - return wrapWidth; - } - - /** - * Set the maximum width of a line. - * @param wrapWidth - */ - public void setWrapWidth(int wrapWidth){ - if(this.wrapWidth != wrapWidth){ - this.wrapWidth = wrapWidth; - invalidLayout = true; - } - } - - /** - * Calculate the TLHI for a given pixel position - * @param g2d - * @param px - * @param py - * @return - */ - TextLayoutHitInfo calculateFromXY(Graphics2D g2d, float px, float py){ - TextHitInfo thi = null; - TextLayoutInfo tli = null; - TextLayoutHitInfo tlhi = null; - if(invalidLayout) - getLines(g2d); - if(px < 0) px = 0; - if(py < 0) py = 0; - tli = getTLIforYpos(py); - // Correct py to match layout's upper-left bounds - py -= tli.yPosInPara; - // get hit - thi = tli.layout.hitTestChar(px,py); - tlhi = new TextLayoutHitInfo(tli, thi); - return tlhi; - } - - /** - * Get a layout based on line number - * @param ln line number - * @return text layout info for the line ln - */ - TextLayoutInfo getTLIforLineNo(int ln){ - if(ln >= 0 || ln < linesInfo.size()) - return linesInfo.get(ln); - else - return null; - } - - /** - * This will always return a layout provide there is some text. - * @param y Must be >= 0 - * @return the first layout where y is above the upper layout bounds - */ - TextLayoutInfo getTLIforYpos(float y){ - TextLayoutInfo tli = null; - if(!linesInfo.isEmpty()){ - for(int i = linesInfo.size()-1; i >= 0; i--){ - tli = linesInfo.get(i); - if(tli.yPosInPara <= y) - break; - } - } - return tli; - } - - /** - * This will always return a layout provided charNo >= 0.
- * - * If charNo > than the index of the last character in the plain text then this - * should be corrected to the last character in the layout by the caller. - * - * @param charNo the character position in text (must be >= 0) - * @return the first layout where c is greater that the layout's start char index. - */ - TextLayoutInfo getTLIforCharNo(int charNo){ - TextLayoutInfo tli = null; - if(!linesInfo.isEmpty()){ - for(int i = linesInfo.size()-1; i >= 0; i--){ - tli = linesInfo.get(i); - if(tli.startCharIndex < charNo) - break; - } - } - return tli; - } - - /** - * For a given line number and character position get the - * corresponding TextLayoutHitInfo object - * @param lineNo line number - * @param charNo position in line - * @return the corresponding TextLayoutHitInfo object - */ - TextLayoutHitInfo getTLHIforCharPosition(int lineNo, int charNo){ - TextLayoutHitInfo tlhi = null; - TextHitInfo thi = null; - TextLayoutInfo tli = getTLIforLineNo(lineNo); - if(tli != null){ - charNo = PApplet.constrain(charNo, 0, tli.nbrChars-2); - thi = tli.layout.getNextRightHit(charNo); - if(thi != null) - tlhi = new TextLayoutHitInfo(tli, thi); - } - return tlhi; - } - - /** - * For a given position in the plain text get the - * corresponding TextLayoutHitInfo object. - * - * @param pos position in the plaintext - * @return the corresponding TextLayoutHitInfo object - */ - TextLayoutHitInfo getTLHIforCharPosition(int pos){ - if(pos < 0 || pos >= plainText.length()) - return null; - int lineNo = 0, posInLine = pos; - for(lineNo = linesInfo.size()-1; lineNo >= 0; lineNo--){ - TextLayoutInfo tli = getTLIforLineNo(lineNo); - posInLine = pos - tli.startCharIndex; - if(tli.startCharIndex <= pos) - break; - } - return getTLHIforCharPosition(lineNo, posInLine); - } - - /** - * Get the character position in the plain text that is associated - * with the given line and character number. - * - * @param lineNo the line number (starts with 0) - * @param charNo the character position in the line (starts with 0) - * @return the position in plain text or -1 if an invalid lineNo - */ - int getPos(int lineNo, int charNo){ - TextLayoutInfo tli = getTLIforLineNo(lineNo); - if(tli != null) - return tli.startCharIndex + charNo; - else - return -1; - } - - /** - * Ensure we do not have blank lines by replacing double EOL characters by - * single EOL until there are only single EOLs.
- * Using replaceAll on its own will not work because EOL/EOL/EOL would - * become EOL/EOL not the single EOL required. - * - */ - private String removeDoubleSpacingFromPlainText(String chars){ - while(chars.indexOf("\n\n") >= 0){ - invalidText = true; - chars = chars.replaceAll("\n\n", "\n"); - } - return chars; - } - - /** - * Remove all EOL characters from the string. This is necessary if the string - * is for a single line component. - * @param chars the string to use - * @return the string with all EOLs removed - */ - private String removeSingleSpacingFromPlainText(String chars){ - while(chars.indexOf("\n") >= 0){ - invalidText = true; - chars = chars.replaceAll("\n", ""); - } - return chars; - } - - /** - * Create a graphic image character to simulate paragraph breaks - * - * @param ww - * @return a blank image to manage paragraph ends. - */ - private ImageGraphicAttribute getParagraghSpacer(int ww){ - if(ww == Integer.MAX_VALUE) - ww = 1; - BufferedImage img = new BufferedImage(ww, 10, BufferedImage.TYPE_INT_ARGB); - Graphics g = img.getGraphics(); - g.setColor(new Color(255, 255, 255, 0)); - g.fillRect(0,0,img.getWidth(), img.getHeight()); - return new ImageGraphicAttribute(img, GraphicAttribute.TOP_ALIGNMENT); - } - - - /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - * Serialisation routines to save/restore the StyledString to disc. - */ - - /** - * Save the named StyleString in the named file. - * - * @param papp - * @param ss the styled string - * @param fname - */ - public static void save(PApplet papp, StyledString ss, String fname){ - OutputStream os; - ObjectOutputStream oos; - try { - os = papp.createOutput(fname); - oos = new ObjectOutputStream(os); - oos.writeObject(ss); - os.close(); - oos.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * Load and return a StyledString object from the given file. - * - * @param papp - * @param fname the filename of the StyledString - */ - public static StyledString load(PApplet papp, String fname){ - StyledString ss = null; - InputStream is; - ObjectInputStream ios; - try { - is = papp.createInput(fname); - ios = new ObjectInputStream(is); - ss = (StyledString) ios.readObject(); - is.close(); - ios.close(); - } catch (IOException e) { - e.printStackTrace(); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - return ss; - } - - - private void readObject(ObjectInputStream ois) - throws ClassNotFoundException, IOException { - ois.defaultReadObject(); - // Recreate transient elements - spacer = getParagraghSpacer(wrapWidth); - styledText = new AttributedString(plainText); - styledText = insertParagraphMarkers(plainText, styledText); - linesInfo = new LinkedList(); - applyAttributes(); - } - - /** - * For multi-line text, the TextHitInfo class is not enough. We also need - * information about the layout so that the caret(s) can be drawn. - * - * @author Peter Lager - * - */ - static public class TextLayoutHitInfo implements Comparable{ - public TextLayoutInfo tli; - public TextHitInfo thi; - - - public TextLayoutHitInfo() { - this.tli = null; - this.thi = null; - } - - /** - * @param tli - */ - public TextLayoutHitInfo(TextLayoutInfo tli) { - this.tli = tli; - this.thi = null; - } - - /** - * @param tli - * @param thi - */ - public TextLayoutHitInfo(TextLayoutInfo tli, TextHitInfo thi) { - this.tli = tli; - this.thi = thi; - } - - /** - * Copy constructor - * @param tlhi - */ - public TextLayoutHitInfo(TextLayoutHitInfo tlhi){ - tli = tlhi.tli; - thi = tlhi.thi; - } - - public void copyFrom(TextLayoutHitInfo other){ - this.tli = other.tli; - this.thi = other.thi; - } - - public void setInfo(TextLayoutInfo tli, TextHitInfo thi) { - this.tli = tli; - this.thi = thi; - } - - public int compareTo(TextLayoutHitInfo other) { - if(tli == null || other.tli == null) - return 0; - int layoutComparison = tli.compareTo(other.tli); - if(layoutComparison != 0) - return layoutComparison; // Different layouts so return comparison - - // Same layout SO test hit info - if(thi == null || other.thi == null || thi.equals(other.thi)) - return 0; - // if(thi.equals(other.thi)) - // return 0; - // Same layout different hit info SO test char index - if(thi.getCharIndex() != other.thi.getCharIndex()){ - // Different current chars so order on position - return (thi.getCharIndex() < other.thi.getCharIndex() ? -1 : 1); - } - // Same layout same char different edge hit SO test on edge hit - return (thi.isLeadingEdge() ? -1 : 1); - } - - public String toString(){ - StringBuilder s = new StringBuilder(tli.toString()); - s.append(" Hit char = " + thi.getCharIndex()); - return new String(s); - } - } - - /** - * Class to hold information about a text layout. This class helps simplify the - * algorithms needed for multi-line text. - * - * @author Peter Lager - * - */ - static public class TextLayoutInfo implements Comparable { - public TextLayout layout; // The matching layout - public int lineNo; // The line number - public int startCharIndex; // Position of the first char in text - public int nbrChars; // Number of chars in this layout - public float yPosInPara; // Top-left corner of bounds - - /** - * @param startCharIndex - * @param nbrChars - * @param yPosInPara - */ - public TextLayoutInfo(int lineNo, TextLayout layout, int startCharIndex, int nbrChars, float yPosInPara) { - this.lineNo = lineNo; - this.layout = layout; - this.startCharIndex = startCharIndex; - this.nbrChars = nbrChars; - this.yPosInPara = yPosInPara; - } - - public int compareTo(TextLayoutInfo other) { - if(lineNo == other.lineNo) - return 0; - return (startCharIndex < other.startCharIndex) ? -1 : 1; - } - - public String toString(){ - StringBuilder s = new StringBuilder("{ Line no = " + lineNo + " starts @ char pos " + startCharIndex); - s.append(" last index " + (startCharIndex+nbrChars+1)); - s.append(" (" + nbrChars +") "); - return new String(s); - } - } - - /** - * Since most of the Java classes associated with AttributedString - * are immutable with virtually no public methods this class represents - * an attribute to be applied.
- * - * This class is only used from within StyledString. - * - * @author Peter Lager - * - */ - private class AttributeRun implements Serializable { - - private static final long serialVersionUID = -8401062069478890163L; - - public Attribute atype; - public Object value; - public Integer start; - public Integer end; - - - /** - * The attribute and value to be applied over the whole string - * @param atype - * @param value - */ - public AttributeRun(Attribute atype, Object value) { - this.atype = atype; - this.value = value; - this.start = Integer.MIN_VALUE; - this.end = Integer.MAX_VALUE; - } - - /** - * The attribute and value to be applied over the given range - * @param atype - * @param value - * @param start - * @param end - */ - public AttributeRun(Attribute atype, Object value, int start, int end) { - this.atype = atype; - this.value = value; - this.start = start; - this.end = end; - } - - /** - * If possible merge the two runs or crop the prevRun run. - * - * If both runs have the same attribute type and the represent - * the same location and size in the text then the intersection - * mode will be MM_SURROUNDS rather than MM_SURROUNDED because - * 'this' is the attribute being added. - * @param m - * @param s - * @return - */ - private int intersectionWith(AttributeRun ar){ - // Different attribute types? - if(atype != ar.atype) - return I_NONE; - // Check for combination mode - int combi_mode = (value.equals(ar.value)) ? MERGE_RUNS : CLIP_RUN; - int sdx = 4, edx = 0; - // Start index - if(ar.start < start) - sdx = 0; - else if(ar.start == start) - sdx = 1; - else if (ar.start < end) - sdx = 2; - else if(ar.start == end) - sdx = 3; - if(sdx < 4){ - if(ar.end > end) - edx = 4; - else if(ar.end == end) - edx = 3; - else if(ar.end > start) - edx = 2; - else if(ar.end == start) - edx = 1; - } - combi_mode |= grid[sdx][edx]; - return combi_mode; - } - - public String toString(){ - String s = atype.toString() + " value = " + value.toString() + " from " + start + " to " + end; - return s; - } - - } // End of AttributeRun class - -} diff --git a/Processing/libraries/controlP5/examples/controllers/ControlP5accordion/ControlP5accordion.pde b/Processing/libraries/controlP5/examples/controllers/ControlP5accordion/ControlP5accordion.pde deleted file mode 100644 index 81d395d..0000000 --- a/Processing/libraries/controlP5/examples/controllers/ControlP5accordion/ControlP5accordion.pde +++ /dev/null @@ -1,286 +0,0 @@ -/** - * ControlP5 Accordion - * arrange controller groups in an accordion like style. - * - * find a list of public methods available for the Accordion Controller - * at the bottom of this sketch. In the example below 3 groups with controllers - * are created and added to an accordion controller. Furthermore several key - * combinations are mapped to control individual settings of the accordion. - * An accordion comes in 2 modes, Accordion.SINGLE and Accordion.MULTI where the - * latter allows to open multiple groups of an accordion and the SINGLE mode only - * allows 1 group to be opened at a time. - * - * by Andreas Schlegel, 2012 - * www.sojamo.de/libraries/controlp5 - * - */ - -import controlP5.*; - -ControlP5 cp5; - -Accordion accordion; - -color c = color(0, 160, 100); - -void setup() { - size(400, 600); - noStroke(); - smooth(); - gui(); -} - -void gui() { - - cp5 = new ControlP5(this); - - // group number 1, contains 2 bangs - Group g1 = cp5.addGroup("myGroup1") - .setBackgroundColor(color(0, 64)) - .setBackgroundHeight(150) - ; - - cp5.addBang("bang") - .setPosition(10,20) - .setSize(100,100) - .moveTo(g1) - .plugTo(this,"shuffle"); - ; - - // group number 2, contains a radiobutton - Group g2 = cp5.addGroup("myGroup2") - .setBackgroundColor(color(0, 64)) - .setBackgroundHeight(150) - ; - - cp5.addRadioButton("radio") - .setPosition(10,20) - .setItemWidth(20) - .setItemHeight(20) - .addItem("black", 0) - .addItem("red", 1) - .addItem("green", 2) - .addItem("blue", 3) - .addItem("grey", 4) - .setColorLabel(color(255)) - .activate(2) - .moveTo(g2) - ; - - // group number 3, contains a bang and a slider - Group g3 = cp5.addGroup("myGroup3") - .setBackgroundColor(color(0, 64)) - .setBackgroundHeight(150) - ; - - cp5.addBang("shuffle") - .setPosition(10,20) - .setSize(40,50) - .moveTo(g3) - ; - - cp5.addSlider("hello") - .setPosition(60,20) - .setSize(100,20) - .setRange(100,500) - .setValue(100) - .moveTo(g3) - ; - - cp5.addSlider("world") - .setPosition(60,50) - .setSize(100,20) - .setRange(100,500) - .setValue(200) - .moveTo(g3) - ; - - // create a new accordion - // add g1, g2, and g3 to the accordion. - accordion = cp5.addAccordion("acc") - .setPosition(40,40) - .setWidth(200) - .addItem(g1) - .addItem(g2) - .addItem(g3) - ; - - cp5.mapKeyFor(new ControlKey() {public void keyEvent() {accordion.open(0,1,2);}}, 'o'); - cp5.mapKeyFor(new ControlKey() {public void keyEvent() {accordion.close(0,1,2);}}, 'c'); - cp5.mapKeyFor(new ControlKey() {public void keyEvent() {accordion.setWidth(300);}}, '1'); - cp5.mapKeyFor(new ControlKey() {public void keyEvent() {accordion.setPosition(0,0);accordion.setItemHeight(190);}}, '2'); - cp5.mapKeyFor(new ControlKey() {public void keyEvent() {accordion.setCollapseMode(ControlP5.ALL);}}, '3'); - cp5.mapKeyFor(new ControlKey() {public void keyEvent() {accordion.setCollapseMode(ControlP5.SINGLE);}}, '4'); - cp5.mapKeyFor(new ControlKey() {public void keyEvent() {cp5.remove("myGroup1");}}, '0'); - - accordion.open(0,1,2); - - // use Accordion.MULTI to allow multiple group - // to be open at a time. - accordion.setCollapseMode(Accordion.MULTI); - - // when in SINGLE mode, only 1 accordion - // group can be open at a time. - // accordion.setCollapseMode(Accordion.SINGLE); -} - - -void radio(int theC) { - switch(theC) { - case(0):c=color(0,200);break; - case(1):c=color(255,0,0,200);break; - case(2):c=color(0, 200, 140,200);break; - case(3):c=color(0, 128, 255,200);break; - case(4):c=color(50,128);break; - } -} - - -void shuffle() { - c = color(random(255),random(255),random(255),random(128,255)); -} - - -void draw() { - background(220); - - fill(c); - - float s1 = cp5.getController("hello").getValue(); - ellipse(200,400,s1,s1); - - float s2 = cp5.getController("world").getValue(); - ellipse(300,100,s2,s2); -} - - - - - -/* -a list of all methods available for the Accordion Controller -use ControlP5.printPublicMethodsFor(Accordion.class); -to print the following list into the console. - -You can find further details about class Accordion in the javadoc. - -Format: -ClassName : returnType methodName(parameter type) - - -controlP5.Accordion : Accordion addItem(ControlGroup) -controlP5.Accordion : Accordion close() -controlP5.Accordion : Accordion open() -controlP5.Accordion : Accordion remove(ControllerInterface) -controlP5.Accordion : Accordion removeItem(ControlGroup) -controlP5.Accordion : Accordion setCollapseMode(int) -controlP5.Accordion : Accordion setItemHeight(int) -controlP5.Accordion : Accordion setMinItemHeight(int) -controlP5.Accordion : Accordion setWidth(int) -controlP5.Accordion : Accordion updateItems() -controlP5.Accordion : int getItemHeight() -controlP5.Accordion : int getMinItemHeight() -controlP5.ControlGroup : Accordion activateEvent(boolean) -controlP5.ControlGroup : Accordion addListener(ControlListener) -controlP5.ControlGroup : Accordion removeListener(ControlListener) -controlP5.ControlGroup : Accordion setBackgroundColor(int) -controlP5.ControlGroup : Accordion setBackgroundHeight(int) -controlP5.ControlGroup : Accordion setBarHeight(int) -controlP5.ControlGroup : Accordion setSize(int, int) -controlP5.ControlGroup : Accordion updateInternalEvents(PApplet) -controlP5.ControlGroup : String getInfo() -controlP5.ControlGroup : String toString() -controlP5.ControlGroup : int getBackgroundHeight() -controlP5.ControlGroup : int getBarHeight() -controlP5.ControlGroup : int listenerSize() -controlP5.ControllerGroup : Accordion add(ControllerInterface) -controlP5.ControllerGroup : Accordion addListener(ControlListener) -controlP5.ControllerGroup : Accordion bringToFront() -controlP5.ControllerGroup : Accordion bringToFront(ControllerInterface) -controlP5.ControllerGroup : Accordion close() -controlP5.ControllerGroup : Accordion disableCollapse() -controlP5.ControllerGroup : Accordion enableCollapse() -controlP5.ControllerGroup : Accordion hide() -controlP5.ControllerGroup : Accordion hideArrow() -controlP5.ControllerGroup : Accordion hideBar() -controlP5.ControllerGroup : Accordion moveTo(ControlWindow) -controlP5.ControllerGroup : Accordion moveTo(PApplet) -controlP5.ControllerGroup : Accordion open() -controlP5.ControllerGroup : Accordion registerProperty(String) -controlP5.ControllerGroup : Accordion registerProperty(String, String) -controlP5.ControllerGroup : Accordion remove(CDrawable) -controlP5.ControllerGroup : Accordion remove(ControllerInterface) -controlP5.ControllerGroup : Accordion removeCanvas(Canvas) -controlP5.ControllerGroup : Accordion removeListener(ControlListener) -controlP5.ControllerGroup : Accordion removeProperty(String) -controlP5.ControllerGroup : Accordion removeProperty(String, String) -controlP5.ControllerGroup : Accordion setAddress(String) -controlP5.ControllerGroup : Accordion setArrayValue(float[]) -controlP5.ControllerGroup : Accordion setArrayValue(int, float) -controlP5.ControllerGroup : Accordion setCaptionLabel(String) -controlP5.ControllerGroup : Accordion setColor(CColor) -controlP5.ControllerGroup : Accordion setColorActive(int) -controlP5.ControllerGroup : Accordion setColorBackground(int) -controlP5.ControllerGroup : Accordion setColorForeground(int) -controlP5.ControllerGroup : Accordion setColorLabel(int) -controlP5.ControllerGroup : Accordion setColorValue(int) -controlP5.ControllerGroup : Accordion setHeight(int) -controlP5.ControllerGroup : Accordion setId(int) -controlP5.ControllerGroup : Accordion setLabel(String) -controlP5.ControllerGroup : Accordion setMouseOver(boolean) -controlP5.ControllerGroup : Accordion setMoveable(boolean) -controlP5.ControllerGroup : Accordion setOpen(boolean) -controlP5.ControllerGroup : Accordion setPosition(float, float) -controlP5.ControllerGroup : Accordion setPosition(float[]) -controlP5.ControllerGroup : Accordion setSize(int, int) -controlP5.ControllerGroup : Accordion setStringValue(String) -controlP5.ControllerGroup : Accordion setTitle(String) -controlP5.ControllerGroup : Accordion setUpdate(boolean) -controlP5.ControllerGroup : Accordion setValue(float) -controlP5.ControllerGroup : Accordion setVisible(boolean) -controlP5.ControllerGroup : Accordion setWidth(int) -controlP5.ControllerGroup : Accordion show() -controlP5.ControllerGroup : Accordion showArrow() -controlP5.ControllerGroup : Accordion showBar() -controlP5.ControllerGroup : Accordion update() -controlP5.ControllerGroup : Accordion updateAbsolutePosition() -controlP5.ControllerGroup : CColor getColor() -controlP5.ControllerGroup : Canvas addCanvas(Canvas) -controlP5.ControllerGroup : ControlWindow getWindow() -controlP5.ControllerGroup : Controller getController(String) -controlP5.ControllerGroup : ControllerProperty getProperty(String) -controlP5.ControllerGroup : ControllerProperty getProperty(String, String) -controlP5.ControllerGroup : Label getCaptionLabel() -controlP5.ControllerGroup : Label getValueLabel() -controlP5.ControllerGroup : String getAddress() -controlP5.ControllerGroup : String getInfo() -controlP5.ControllerGroup : String getName() -controlP5.ControllerGroup : String getStringValue() -controlP5.ControllerGroup : String toString() -controlP5.ControllerGroup : Tab getTab() -controlP5.ControllerGroup : boolean isBarVisible() -controlP5.ControllerGroup : boolean isCollapse() -controlP5.ControllerGroup : boolean isMouseOver() -controlP5.ControllerGroup : boolean isMoveable() -controlP5.ControllerGroup : boolean isOpen() -controlP5.ControllerGroup : boolean isUpdate() -controlP5.ControllerGroup : boolean isVisible() -controlP5.ControllerGroup : boolean setMousePressed(boolean) -controlP5.ControllerGroup : float getArrayValue(int) -controlP5.ControllerGroup : float getValue() -controlP5.ControllerGroup : float[] getArrayValue() -controlP5.ControllerGroup : float[] getPosition() -controlP5.ControllerGroup : int getHeight() -controlP5.ControllerGroup : int getId() -controlP5.ControllerGroup : int getWidth() -controlP5.ControllerGroup : int listenerSize() -controlP5.ControllerGroup : void controlEvent(ControlEvent) -controlP5.ControllerGroup : void remove() -java.lang.Object : String toString() -java.lang.Object : boolean equals(Object) - -created: 2015/03/24 12:25:32 - -*/ - - diff --git a/Processing/libraries/controlP5/examples/controllers/ControlP5background/ControlP5background.pde b/Processing/libraries/controlP5/examples/controllers/ControlP5background/ControlP5background.pde deleted file mode 100644 index 11a974c..0000000 --- a/Processing/libraries/controlP5/examples/controllers/ControlP5background/ControlP5background.pde +++ /dev/null @@ -1,188 +0,0 @@ -/** -* ControlP5 Background -* -* -* find a list of public methods available for the Group Controller -* at the bottom of this sketch. -* -* by Andreas Schlegel, 2014 -* www.sojamo.de/libraries/controlp5 -* -*/ - -import controlP5.*; - -ControlP5 cp5; -int v1; -boolean lines = true; - -void setup() { - size(800, 400); - noStroke(); - cp5 = new ControlP5(this); - - cp5.begin(cp5.addBackground("abc")); - - cp5.addSlider("v1") - .setPosition(10, 20) - .setSize(200, 20) - .setRange(100, 300) - .setValue(250) - ; - - cp5.addToggle("lines") - .setPosition(10,50) - .setSize(80,20) - .setMode(Toggle.SWITCH) - ; - - cp5.end(); - -} - -void draw() { - background(200, 200, 200); - - pushMatrix(); - - pushMatrix(); - fill(255, 255, 0); - rect(v1, 100, 60, 200); - fill(0, 255, 110); - rect(40, v1, 320, 40); - translate(200, 200); - rotate(map(v1, 100, 300, -PI, PI)); - fill(255, 0, 128); - rect(0, 0, 100, 100); - popMatrix(); - - if(lines) { - translate(600, 100); - for (int i=0; i<20; i++) { - pushMatrix(); - fill(255); - translate(0, i*10); - rotate(map(v1+i, 0, 300, -PI, PI)); - rect(-150, 0, 300, 4); - popMatrix(); - } - } - - popMatrix(); -} - -/* -a list of all methods available for the Background Controller -use ControlP5.printPublicMethodsFor(Background.class); -to print the following list into the console. - -You can find further details about class Background in the javadoc. - -Format: -ClassName : returnType methodName(parameter type) - - -controlP5.ControlGroup : Background activateEvent(boolean) -controlP5.ControlGroup : Background addListener(ControlListener) -controlP5.ControlGroup : Background removeListener(ControlListener) -controlP5.ControlGroup : Background setBackgroundColor(int) -controlP5.ControlGroup : Background setBackgroundHeight(int) -controlP5.ControlGroup : Background setBarHeight(int) -controlP5.ControlGroup : Background setSize(int, int) -controlP5.ControlGroup : Background updateInternalEvents(PApplet) -controlP5.ControlGroup : String getInfo() -controlP5.ControlGroup : String toString() -controlP5.ControlGroup : int getBackgroundHeight() -controlP5.ControlGroup : int getBarHeight() -controlP5.ControlGroup : int listenerSize() -controlP5.ControllerGroup : Background add(ControllerInterface) -controlP5.ControllerGroup : Background addListener(ControlListener) -controlP5.ControllerGroup : Background bringToFront() -controlP5.ControllerGroup : Background bringToFront(ControllerInterface) -controlP5.ControllerGroup : Background close() -controlP5.ControllerGroup : Background disableCollapse() -controlP5.ControllerGroup : Background enableCollapse() -controlP5.ControllerGroup : Background hide() -controlP5.ControllerGroup : Background hideArrow() -controlP5.ControllerGroup : Background hideBar() -controlP5.ControllerGroup : Background moveTo(ControlWindow) -controlP5.ControllerGroup : Background moveTo(PApplet) -controlP5.ControllerGroup : Background open() -controlP5.ControllerGroup : Background registerProperty(String) -controlP5.ControllerGroup : Background registerProperty(String, String) -controlP5.ControllerGroup : Background remove(CDrawable) -controlP5.ControllerGroup : Background remove(ControllerInterface) -controlP5.ControllerGroup : Background removeCanvas(Canvas) -controlP5.ControllerGroup : Background removeListener(ControlListener) -controlP5.ControllerGroup : Background removeProperty(String) -controlP5.ControllerGroup : Background removeProperty(String, String) -controlP5.ControllerGroup : Background setAddress(String) -controlP5.ControllerGroup : Background setArrayValue(float[]) -controlP5.ControllerGroup : Background setArrayValue(int, float) -controlP5.ControllerGroup : Background setCaptionLabel(String) -controlP5.ControllerGroup : Background setColor(CColor) -controlP5.ControllerGroup : Background setColorActive(int) -controlP5.ControllerGroup : Background setColorBackground(int) -controlP5.ControllerGroup : Background setColorForeground(int) -controlP5.ControllerGroup : Background setColorLabel(int) -controlP5.ControllerGroup : Background setColorValue(int) -controlP5.ControllerGroup : Background setHeight(int) -controlP5.ControllerGroup : Background setId(int) -controlP5.ControllerGroup : Background setLabel(String) -controlP5.ControllerGroup : Background setMouseOver(boolean) -controlP5.ControllerGroup : Background setMoveable(boolean) -controlP5.ControllerGroup : Background setOpen(boolean) -controlP5.ControllerGroup : Background setPosition(float, float) -controlP5.ControllerGroup : Background setPosition(float[]) -controlP5.ControllerGroup : Background setSize(int, int) -controlP5.ControllerGroup : Background setStringValue(String) -controlP5.ControllerGroup : Background setTitle(String) -controlP5.ControllerGroup : Background setUpdate(boolean) -controlP5.ControllerGroup : Background setValue(float) -controlP5.ControllerGroup : Background setVisible(boolean) -controlP5.ControllerGroup : Background setWidth(int) -controlP5.ControllerGroup : Background show() -controlP5.ControllerGroup : Background showArrow() -controlP5.ControllerGroup : Background showBar() -controlP5.ControllerGroup : Background update() -controlP5.ControllerGroup : Background updateAbsolutePosition() -controlP5.ControllerGroup : CColor getColor() -controlP5.ControllerGroup : Canvas addCanvas(Canvas) -controlP5.ControllerGroup : ControlWindow getWindow() -controlP5.ControllerGroup : Controller getController(String) -controlP5.ControllerGroup : ControllerProperty getProperty(String) -controlP5.ControllerGroup : ControllerProperty getProperty(String, String) -controlP5.ControllerGroup : Label getCaptionLabel() -controlP5.ControllerGroup : Label getValueLabel() -controlP5.ControllerGroup : String getAddress() -controlP5.ControllerGroup : String getInfo() -controlP5.ControllerGroup : String getName() -controlP5.ControllerGroup : String getStringValue() -controlP5.ControllerGroup : String toString() -controlP5.ControllerGroup : Tab getTab() -controlP5.ControllerGroup : boolean isBarVisible() -controlP5.ControllerGroup : boolean isCollapse() -controlP5.ControllerGroup : boolean isMouseOver() -controlP5.ControllerGroup : boolean isMoveable() -controlP5.ControllerGroup : boolean isOpen() -controlP5.ControllerGroup : boolean isUpdate() -controlP5.ControllerGroup : boolean isVisible() -controlP5.ControllerGroup : boolean setMousePressed(boolean) -controlP5.ControllerGroup : float getArrayValue(int) -controlP5.ControllerGroup : float getValue() -controlP5.ControllerGroup : float[] getArrayValue() -controlP5.ControllerGroup : float[] getPosition() -controlP5.ControllerGroup : int getHeight() -controlP5.ControllerGroup : int getId() -controlP5.ControllerGroup : int getWidth() -controlP5.ControllerGroup : int listenerSize() -controlP5.ControllerGroup : void controlEvent(ControlEvent) -controlP5.ControllerGroup : void remove() -java.lang.Object : String toString() -java.lang.Object : boolean equals(Object) - -created: 2015/03/24 12:25:35 - -*/ - - diff --git a/Processing/libraries/controlP5/examples/controllers/ControlP5background/sketch.properties b/Processing/libraries/controlP5/examples/controllers/ControlP5background/sketch.properties deleted file mode 100644 index 8630fa2..0000000 --- a/Processing/libraries/controlP5/examples/controllers/ControlP5background/sketch.properties +++ /dev/null @@ -1,2 +0,0 @@ -mode.id=processing.mode.java.JavaMode -mode=Java diff --git a/Processing/libraries/controlP5/examples/controllers/ControlP5bang/ControlP5bang.pde b/Processing/libraries/controlP5/examples/controllers/ControlP5bang/ControlP5bang.pde deleted file mode 100644 index c84e786..0000000 --- a/Processing/libraries/controlP5/examples/controllers/ControlP5bang/ControlP5bang.pde +++ /dev/null @@ -1,231 +0,0 @@ -/** - * ControlP5 Bang - * A bang triggers an event that can be received by a function named after the bang. - * By default a bang is triggered when pressed, this can be changed to 'release' - * using theBang.setTriggerEvent(Bang.RELEASE). - * - * find a list of public methods available for the Bang Controller - * at the bottom of this sketch. - * - * by Andreas Schlegel, 2012 - * www.sojamo.de/libraries/controlp5 - * - */ - -import controlP5.*; - -ControlP5 cp5; - -int myColorBackground = color(0, 0, 0); - -color[] col = new color[] { - color(100), color(150), color(200), color(250) -}; - - -void setup() { - size(400, 600); - noStroke(); - cp5 = new ControlP5(this); - for (int i=0;i presets = new ArrayList(); - int currentPreset = 0; - Thread update; - - CustomMatrix(ControlP5 cp5, String theName) { - super(cp5, theName); - stop(); // stop the default sequencer and - // create our custom sequencer thread. Here we - // check if the sequencer has reached the end and if so - // we updated to the next preset. - update = new Thread(theName) { - public void run( ) { - while ( true ) { - cnt++; - cnt %= _myCellX; - if (cnt==0) { - // we reached the end and go back to start and - // update the preset - next(); - } - trigger(cnt); - try { - sleep( _myInterval ); - } - catch ( InterruptedException e ) { - } - } - } - }; - update.start(); - } - - - void next() { - currentPreset++; - currentPreset %= presets.size(); - setCells(presets.get(currentPreset)); - } - - // initialize some random presets. - void initPresets() { - for (int i=0;i<4;i++) { - presets.add(createPreset(_myCellX, _myCellY)); - } - setCells(presets.get(0)); - } - - // create a random preset - int[][] createPreset(int theX, int theY) { - int[][] preset = new int[theX][theY]; - for (int x=0;x0.5 ? 1:0; - } - } - return preset; - } - -} - diff --git a/Processing/libraries/controlP5/examples/experimental/ControlP5MenuList/ControlP5MenuList.pde b/Processing/libraries/controlP5/examples/experimental/ControlP5MenuList/ControlP5MenuList.pde deleted file mode 100644 index 651c1e2..0000000 --- a/Processing/libraries/controlP5/examples/experimental/ControlP5MenuList/ControlP5MenuList.pde +++ /dev/null @@ -1,187 +0,0 @@ - -/** - * ControlP5 MenuList - * - * A custom Controller, a scrollable Menu List, using a PGraphics buffer. - * Allows custom designs for List Item. - * - * by Andreas Schlegel, 2013 - * www.sojamo.de/libraries/controlp5 - * - */ - -import controlP5.*; -import static controlP5.ControlP5.*; -import java.util.*; -import java.util.Map.Entry; - - -ControlP5 cp5; - -PFont f1, f2; -void setup() { - size(800, 500, P3D ); - f1 = createFont("Helvetica", 20); - f2 = createFont("Helvetica", 12); - - cp5 = new ControlP5( this ); - - - /* create a custom MenuList with name menu, notice that function - * menu will be called when a menu item has been clicked. - */ - MenuList m = new MenuList( cp5, "menu", 200, 368 ); - - m.setPosition(40, 40); - // add some items to our menuList - for (int i=0;i<100;i++) { - m.addItem(makeItem("headline-"+i, "subline", "some copy lorem ipsum ", createImage(50, 50, RGB))); - } -} - -/* a convenience function to build a map that contains our key-value pairs which we will - * then use to render each item of the menuList. - */ -Map makeItem(String theHeadline, String theSubline, String theCopy, PImage theImage) { - Map m = new HashMap(); - m.put("headline", theHeadline); - m.put("subline", theSubline); - m.put("copy", theCopy); - m.put("image", theImage); - return m; -} - -void menu(int i) { - println("got some menu event from item with index "+i); -} - -public void controlEvent(ControlEvent theEvent) { - if(theEvent.isFrom("menu")){ - Map m = ((MenuList)theEvent.getController()).getItem(int(theEvent.getValue())); - println("got a menu event from item : "+m); - } -} - -void draw() { - background( 40 ); -} - - -/* A custom Controller that implements a scrollable menuList. Here the controller - * uses a PGraphics element to render customizable list items. The menuList can be scrolled - * using the scroll-wheel, touchpad, or mouse-drag. Items are triggered by a click. clicking - * the scrollbar to the right makes the list scroll to the item correspoinding to the - * click-location. - */ -class MenuList extends Controller { - - float pos, npos; - int itemHeight = 100; - int scrollerLength = 40; - List< Map> items = new ArrayList< Map>(); - PGraphics menu; - boolean updateMenu; - - MenuList(ControlP5 c, String theName, int theWidth, int theHeight) { - super( c, theName, 0, 0, theWidth, theHeight ); - c.register( this ); - menu = createGraphics(getWidth(), getHeight() ); - - setView(new ControllerView() { - - public void display(PGraphics pg, MenuList t ) { - if (updateMenu) { - updateMenu(); - } - if (inside() ) { - menu.beginDraw(); - int len = -(itemHeight * items.size()) + getHeight(); - int ty = int(map(pos, len, 0, getHeight() - scrollerLength - 2, 2 ) ); - menu.fill(255 ); - menu.rect(getWidth()-4, ty, 4, scrollerLength ); - menu.endDraw(); - } - pg.image(menu, 0, 0); - } - } - ); - updateMenu(); - } - - /* only update the image buffer when necessary - to save some resources */ - void updateMenu() { - int len = -(itemHeight * items.size()) + getHeight(); - npos = constrain(npos, len, 0); - pos += (npos - pos) * 0.1; - menu.beginDraw(); - menu.noStroke(); - menu.background(255, 64 ); - menu.textFont(cp5.getFont().getFont()); - menu.pushMatrix(); - menu.translate( 0, pos ); - menu.pushMatrix(); - - int i0 = PApplet.max( 0, int(map(-pos, 0, itemHeight * items.size(), 0, items.size()))); - int range = ceil((float(getHeight())/float(itemHeight))+1); - int i1 = PApplet.min( items.size(), i0 + range ); - - menu.translate(0, i0*itemHeight); - - for (int i=i0;i0.01 ? true:false; - } - - /* when detecting a click, check if the click happend to the far right, if yes, scroll to that position, - * otherwise do whatever this item of the list is supposed to do. - */ - public void onClick() { - if (getPointer().x()>getWidth()-10) { - npos= -map(getPointer().y(), 0, getHeight(), 0, items.size()*itemHeight); - updateMenu = true; - } - else { - int len = itemHeight * items.size(); - int index = int( map( getPointer().y() - pos, 0, len, 0, items.size() ) ) ; - setValue(index); - } - } - - public void onMove() { - } - - public void onDrag() { - npos += getPointer().dy() * 2; - updateMenu = true; - } - - public void onScroll(int n) { - npos += ( n * 4 ); - updateMenu = true; - } - - void addItem(Map m) { - items.add(m); - updateMenu = true; - } - - Map getItem(int theIndex) { - return items.get(theIndex); - } -} - diff --git a/Processing/libraries/controlP5/examples/experimental/ControlP5SliderList/ControlP5SliderList.pde b/Processing/libraries/controlP5/examples/experimental/ControlP5SliderList/ControlP5SliderList.pde deleted file mode 100644 index 88b7536..0000000 --- a/Processing/libraries/controlP5/examples/experimental/ControlP5SliderList/ControlP5SliderList.pde +++ /dev/null @@ -1,257 +0,0 @@ - -/** - * ControlP5 SilderList - * - * A custom Controller, a scrollable Menu List, using a PGraphics buffer. - * Allows custom designs for List Item. - * - * you will need a controlP5 version >= 2.1.5 - * you can download a copy from - * http://sojamo.de/files/archive/controlP5-2.1.5.zip - * - * by Andreas Schlegel, 2013 - * www.sojamo.de/libraries/controlp5 - * - */ - -import controlP5.*; -import java.util.*; - - -ControlP5 cp5; - -PFont f1; -int NUM = 100; -float[] rotation = new float[NUM]; - - -void setup() { - size(800, 400 ,P3D); - f1 = createFont("Helvetica", 12); - - cp5 = new ControlP5( this ); - - - // create a custom SilderList with name menu, notice that function - // menu will be called when a menu item has been clicked. - - SilderList m = new SilderList( cp5, "menu", 250, 350 ); - - m.setPosition(40, 20); - // add some items to our SilderList - for (int i=0;i makeItem(String theLabel, float theValue, float theMin, float theMax) { - Map m = new HashMap(); - m.put("label", theLabel); - m.put("sliderValue", theValue); - m.put("sliderValueMin", theMin); - m.put("sliderValueMax", theMax); - return m; -} - -void menu(int i) { - println("got some slider-list event from item with index "+i); -} - -public void controlEvent(ControlEvent theEvent) { - if (theEvent.isFrom("menu")) { - int index = int(theEvent.getValue()); - Map m = ((SilderList)theEvent.getController()).getItem(index); - println("got a slider event from item : "+m); - rotation[index] = f(m.get("sliderValue")); - } -} - -void draw() { - background( 220 ); - fill(0, 128, 255); - noStroke(); - pushMatrix(); - translate(width/2, 30 ); - for (int i=0;i { - - float pos, npos; - int itemHeight = 60; - int scrollerLength = 40; - int sliderWidth = 150; - int sliderHeight = 15; - int sliderX = 10; - int sliderY = 25; - - int dragMode = 0; - int dragIndex = -1; - - List< Map> items = new ArrayList< Map>(); - PGraphics menu; - boolean updateMenu; - - SilderList(ControlP5 c, String theName, int theWidth, int theHeight) { - super( c, theName, 0, 0, theWidth, theHeight ); - c.register( this ); - menu = createGraphics(getWidth(), getHeight()); - - setView(new ControllerView() { - - public void display(PGraphics pg, SilderList t ) { - if (updateMenu) { - updateMenu(); - } - if (inside() ) { // draw scrollbar - menu.beginDraw(); - int len = -(itemHeight * items.size()) + getHeight(); - int ty = int(map(pos, len, 0, getHeight() - scrollerLength - 2, 2 ) ); - menu.fill( 128 ); - menu.rect(getWidth()-6, ty, 4, scrollerLength ); - menu.endDraw(); - } - pg.image(menu, 0, 0); - } - } - ); - updateMenu(); - } - - // only update the image buffer when necessary - to save some resources - void updateMenu() { - int len = -(itemHeight * items.size()) + getHeight(); - npos = constrain(npos, len, 0); - pos += (npos - pos) * 0.1; - - /// draw the SliderList - menu.beginDraw(); - menu.noStroke(); - menu.background(240); - menu.textFont(cp5.getFont().getFont()); - menu.pushMatrix(); - menu.translate( 0, int(pos) ); - menu.pushMatrix(); - - int i0 = PApplet.max( 0, int(map(-pos, 0, itemHeight * items.size(), 0, items.size()))); - int range = ceil((float(getHeight())/float(itemHeight))+1); - int i1 = PApplet.min( items.size(), i0 + range ); - - menu.translate(0, i0*itemHeight); - - for (int i=i0;i0.01 ? true:false; - } - - // when detecting a click, check if the click happend to the far right, - // if yes, scroll to that position, otherwise do whatever this item of - // the list is supposed to do. - public void onClick() { - if (getPointer().x()>getWidth()-10) { - npos= -map(getPointer().y(), 0, getHeight(), 0, items.size()*itemHeight); - updateMenu = true; - } - } - - - public void onPress() { - int x = getPointer().x(); - int y = (int)(getPointer().y()-pos)%itemHeight; - boolean withinSlider = within(x, y, sliderX, sliderY, sliderWidth, sliderHeight); - dragMode = withinSlider ? 2:1; - if (dragMode==2) { - dragIndex = getIndex(); - float min = f(items.get(dragIndex).get("sliderValueMin")); - float max = f(items.get(dragIndex).get("sliderValueMax")); - float val = constrain(map(getPointer().x()-sliderX, 0, sliderWidth, min, max), min, max); - items.get(dragIndex).put("sliderValue", val); - setValue(dragIndex); - } - updateMenu = true; - } - - public void onDrag() { - switch(dragMode) { - case(1): // drag and scroll the list - npos += getPointer().dy() * 2; - updateMenu = true; - break; - case(2): // drag slider - float min = f(items.get(dragIndex).get("sliderValueMin")); - float max = f(items.get(dragIndex).get("sliderValueMax")); - float val = constrain(map(getPointer().x()-sliderX, 0, sliderWidth, min, max), min, max); - items.get(dragIndex).put("sliderValue", val); - setValue(dragIndex); - updateMenu = true; - break; - } - } - - public void onScroll(int n) { - npos += ( n * 4 ); - updateMenu = true; - } - - void addItem(Map m) { - items.add(m); - updateMenu = true; - } - - Map getItem(int theIndex) { - return items.get(theIndex); - } - - private int getIndex() { - int len = itemHeight * items.size(); - int index = int( map( getPointer().y() - pos, 0, len, 0, items.size() ) ) ; - return index; - } -} - -public static float f( Object o ) { - return ( o instanceof Number ) ? ( ( Number ) o ).floatValue( ) : Float.MIN_VALUE; -} - -public static boolean within(int theX, int theY, int theX1, int theY1, int theW1, int theH1) { - return (theX>theX1 && theXtheY1 && theY midimapper = new HashMap(); - -void setup() { - - size( 600, 400 ); - - cp5 = new ControlP5( this ); - - cp5.begin(cp5.addTab("a")); - cp5.addSlider("a-1").setPosition(20, 120).setSize(200, 20); - cp5.addSlider("a-2").setPosition(20, 160).setSize(200, 20); - cp5.addSlider("a-3").setPosition(20, 200).setSize(200, 20); - cp5.addToggle("a-4").setPosition(280, 120).setSize(100, 20); - cp5.addButton("a-5").setPosition(280, 160).setSize(100, 20); - cp5.addBang("a-6").setPosition(280, 200).setSize(100, 20); - cp5.end(); - - cp5.begin(cp5.addTab("b")); - cp5.addSlider("b-1").setPosition(20, 120).setSize(200, 20); - cp5.addSlider("b-2").setPosition(20, 160).setSize(200, 20); - cp5.addSlider("b-3").setPosition(20, 200).setSize(200, 20); - cp5.end(); - - final String device = "SLIDER/KNOB"; - - //midimapper.clear(); - - midimapper.put( ref( device, 0 ), "a-1" ); - midimapper.put( ref( device, 1 ), "a-2" ); - midimapper.put( ref( device, 2 ), "a-3" ); - midimapper.put( ref( device, 32 ), "a-4" ); - midimapper.put( ref( device, 48 ), "a-5" ); - midimapper.put( ref( device, 64 ), "a-6" ); - - midimapper.put( ref( device, 16 ), "b-1" ); - midimapper.put( ref( device, 17 ), "b-2" ); - midimapper.put( ref( device, 18 ), "b-3" ); - - boolean DEBUG = false; - - if (DEBUG) { - new MidiSimple( device ); - } - else { - new MidiSimple( device , new Receiver() { - - @Override public void send( MidiMessage msg, long timeStamp ) { - - byte[] b = msg.getMessage(); - - if ( b[ 0 ] != -48 ) { - - Object index = ( midimapper.get( ref( device , b[ 1 ] ) ) ); - - if ( index != null ) { - - Controller c = cp5.getController(index.toString()); - if (c instanceof Slider ) { - float min = c.getMin(); - float max = c.getMax(); - c.setValue(map(b[ 2 ], 0, 127, min, max) ); - } else if ( c instanceof Button ) { - if ( b[ 2 ] > 0 ) { - c.setValue( c.getValue( ) ); - c.setColorBackground( 0xff08a2cf ); - } else { - c.setColorBackground( 0xff003652 ); - } - } else if ( c instanceof Bang ) { - if ( b[ 2 ] > 0 ) { - c.setValue( c.getValue( ) ); - c.setColorForeground( 0xff08a2cf ); - } else { - c.setColorForeground( 0xff00698c ); - } - } else if ( c instanceof Toggle ) { - if ( b[ 2 ] > 0 ) { - ( ( Toggle ) c ).toggle( ); - } - } - } - } - } - - @Override public void close( ) { - } - } - ); - } -} - - -String ref(String theDevice, int theIndex) { - return theDevice+"-"+theIndex; -} - - -void draw() { - background( 0 ); -} - - diff --git a/Processing/libraries/controlP5/examples/experimental/MidiMapper/MidiSimple.java b/Processing/libraries/controlP5/examples/experimental/MidiMapper/MidiSimple.java deleted file mode 100644 index f23252f..0000000 --- a/Processing/libraries/controlP5/examples/experimental/MidiMapper/MidiSimple.java +++ /dev/null @@ -1,107 +0,0 @@ -import java.util.HashMap; -import java.util.Map; - -import javax.sound.midi.MidiDevice; -import javax.sound.midi.MidiMessage; -import javax.sound.midi.MidiSystem; -import javax.sound.midi.MidiUnavailableException; -import javax.sound.midi.Receiver; -import javax.sound.midi.Transmitter; - -public class MidiSimple { - - public MidiSimple( String theDeviceName , Receiver theReceiver ) { - - MidiDevice.Info[] aInfos = MidiSystem.getMidiDeviceInfo(); - for ( int i = 0; i < aInfos.length; i++ ) { - try { - MidiDevice device = MidiSystem.getMidiDevice( aInfos[ i ] ); - boolean bAllowsInput = ( device.getMaxTransmitters() != 0 ); - boolean bAllowsOutput = ( device.getMaxReceivers() != 0 ); - System.out.println( "" + i + " " + ( bAllowsInput ? "IN " : " " ) + ( bAllowsOutput ? "OUT " : " " ) + aInfos[ i ].getName() + ", " + aInfos[ i ].getVendor() + ", " - + aInfos[ i ].getVersion() + ", " + aInfos[ i ].getDescription() ); - } - catch ( MidiUnavailableException e ) { - // device is obviously not available... - // out(e); - } - } - - try { - MidiDevice device; - device = MidiSystem.getMidiDevice( getMidiDeviceInfo( theDeviceName, false ) ); - device.open(); - Transmitter conTrans = device.getTransmitter(); - conTrans.setReceiver( theReceiver ); - } - catch ( MidiUnavailableException e ) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (NullPointerException e) { - System.out.println("No Midi device ( "+theDeviceName+" ) is available."); - } - - } - - public MidiSimple( String theDeviceName ) { - new MidiSimple(theDeviceName , new MidiInputReceiver( theDeviceName ) ); - } - - - public MidiDevice.Info getMidiDeviceInfo( String strDeviceName, boolean bForOutput ) { - MidiDevice.Info[] aInfos = MidiSystem.getMidiDeviceInfo(); - for ( int i = 0; i < aInfos.length; i++ ) { - if ( aInfos[ i ].getName().equals( strDeviceName ) ) { - try { - MidiDevice device = MidiSystem.getMidiDevice( aInfos[ i ] ); - boolean bAllowsInput = ( device.getMaxTransmitters() != 0 ); - boolean bAllowsOutput = ( device.getMaxReceivers() != 0 ); - if ( ( bAllowsOutput && bForOutput ) || ( bAllowsInput && !bForOutput ) ) { - return aInfos[ i ]; - } - } - catch ( MidiUnavailableException e ) { - // TODO: - } - } - } - return null; - } - - class MidiInputReceiver implements Receiver { - public String name; - Map< Byte, String > commandMap = new HashMap< Byte, String >(); - - public MidiInputReceiver( String name ) { - this.name = name; - commandMap.put( ( byte ) -112, "Note On" ); - commandMap.put( ( byte ) -128, "Note Off" ); - commandMap.put( ( byte ) -48, "Channel Pressure" ); - commandMap.put( ( byte ) -80, "Continuous Controller" ); - } - - public void send( MidiMessage msg, long timeStamp ) { - System.out.println( "midi received (" + name + ")" ); - System.out.println( "Timestamp: " + timeStamp ); - byte[] b = msg.getMessage(); - - if ( b[ 0 ] != -48 ) { - // System.out.println("Message length: " + msg.getLength()); - System.out.println( "Note command: " + commandMap.get( b[ 0 ] ) ); - System.out.println( "Which note: " + b[ 1 ] ); - System.out.println( "Note pressure: " + b[ 2 ] ); - System.out.println( "---------------------" ); - } - else { - // System.out.println("Message length: " + msg.getLength()); - System.out.println( "Note command: " + commandMap.get( b[ 0 ] ) ); - System.out.println( "Note Pressure: " + b[ 1 ] ); - System.out.println( "---------------------" ); - } - } - - public void close( ) { - } - } -} - diff --git a/Processing/libraries/controlP5/examples/extra/ControlP5AutoDetectFields/ControlP5AutoDetectFields.pde b/Processing/libraries/controlP5/examples/extra/ControlP5AutoDetectFields/ControlP5AutoDetectFields.pde deleted file mode 100644 index bd405bb..0000000 --- a/Processing/libraries/controlP5/examples/extra/ControlP5AutoDetectFields/ControlP5AutoDetectFields.pde +++ /dev/null @@ -1,58 +0,0 @@ -/** - * ControlP5 Autodetect Fields - * - * test sketch, controller values will automatically be set - * to its corresponding sketch fields. - * - * by Andreas Schlegel, 2011 - * www.sojamo.de/libraries/controlp5 - * - */ - - -import controlP5.*; - -int s1 = 50; -int s2 = 50; - -int nb1 = 50; -int nb2 = 50; - -int k1 = 50; -int k2 = 50; - -boolean t1 = false; -boolean t2 = false; - -int r1 = 20; -int r2 = 50; - -void setup() { - size(400,400); - ControlP5 cp5 = new ControlP5(this); - cp5.addSlider("s1",10,150,10,10,100,15).setLabel("50"); - cp5.addSlider("s2",10,150,20,150,10,100,15).setLabel("20"); - - cp5.addNumberbox("nb1",10,50,100,15).setLabel("50"); - cp5.addNumberbox("nb2",20,150,50,100,15).setLabel("20"); - - cp5.addKnob("k1",10,150,10,150,50).setLabel("50"); - cp5.addKnob("k2",10,150,20,150,150,50).setLabel("20"); - - cp5.addToggle("t1",10,240,100,15).setLabel("false"); - cp5.addToggle("t2",true,150,240,100,15).setLabel("true"); - - cp5.addButton("b1",50,10,280,100,15).setLabel("50"); - cp5.addButton("b2",20,150,280,100,15).setLabel("20"); - - cp5.addRange("r1",10,150,r1,r2,10,320,100,15).setLabel("50"); - -} - -void draw() { - background(0); -} - -void controlEvent(ControlEvent c) { - println(c.getValue()); -} diff --git a/Processing/libraries/controlP5/examples/extra/ControlP5ControllerInsideClass/ControlP5ControllerInsideClass.pde b/Processing/libraries/controlP5/examples/extra/ControlP5ControllerInsideClass/ControlP5ControllerInsideClass.pde deleted file mode 100644 index 8590f82..0000000 --- a/Processing/libraries/controlP5/examples/extra/ControlP5ControllerInsideClass/ControlP5ControllerInsideClass.pde +++ /dev/null @@ -1,33 +0,0 @@ -import controlP5.*; - -ControlP5 cp5; -Test t; -void setup() { - size(400,400); - cp5 = new ControlP5( this ); - t = new Test( "test" ); -} - -void draw() { - background(20); - println( t.value ); -} - -class Test { - - int value; - - Test( String thePrefix ) { - cp5.addSlider( "value-"+thePrefix ) - .setRange( 0, 255 ) - .plugTo( this, "setValue" ) - .setValue( 127 ) - .setLabel("value") - ; - } - - void setValue(int theValue) { - value = theValue; - } -} - diff --git a/Processing/libraries/controlP5/examples/extra/ControlP5canvasDrawIntoCanvas/ControlP5canvasDrawIntoCanvas.pde b/Processing/libraries/controlP5/examples/extra/ControlP5canvasDrawIntoCanvas/ControlP5canvasDrawIntoCanvas.pde deleted file mode 100644 index 5b9f962..0000000 --- a/Processing/libraries/controlP5/examples/extra/ControlP5canvasDrawIntoCanvas/ControlP5canvasDrawIntoCanvas.pde +++ /dev/null @@ -1,72 +0,0 @@ -/** - * ControlP5 DrawIntoCanvas - * - * this example demonstrates how to draw into a Canvas. - * Click and drag the mouse to show and draw into the Canvas. - * - * by Andreas Schlegel, 2011 - * www.sojamo.de/libraries/controlp5 - * - */ - -import controlP5.*; - -ControlP5 cp5; - -Canvas cc; - -// your controlWindowCanvas class -class MyCanvas extends Canvas { - - boolean mousePressed; - int mouseX, mouseY; - public void update(PApplet theApplet) { - mousePressed = theApplet.mousePressed; - mouseX = theApplet.mouseX; - mouseY = theApplet.mouseY; - } - - public void draw(PGraphics theApplet) { - theApplet.background(255); - // a rectangle will be drawn if the mouse has been - // pressed inside the main sketch window. - // mousePressed here refers to the mousePressed - // variable of your main sketch - if(mousePressed) { - theApplet.fill(255,0,0); - theApplet.rect(10,10,100,100); - theApplet.fill(0); - theApplet.ellipse(mouseX,mouseY,20,20); - } - // will draw a rectangle into the controlWindow - // if the mouse has been pressed inside the controlWindow itself. - // theApplet.mousePressed here refers to the - // mousePressed variable of the controlWindow. - if(mousePressed) { - theApplet.fill(0); - theApplet.rect(10,10,100,100); - theApplet.fill(255,0,0); - theApplet.ellipse(mouseX,mouseY,20,20); - } - - } - -} - - -void setup() { - size(400,400); - frameRate(30); - cp5 = new ControlP5(this); - - cc = new MyCanvas(); - cc.pre(); - cp5.addCanvas(cc); - -} - -void draw(){ - background(0); -} - - diff --git a/Processing/libraries/controlP5/examples/extra/ControlP5chartsCombined/ControlP5chartsCombined.pde b/Processing/libraries/controlP5/examples/extra/ControlP5chartsCombined/ControlP5chartsCombined.pde deleted file mode 100644 index d8a0e79..0000000 --- a/Processing/libraries/controlP5/examples/extra/ControlP5chartsCombined/ControlP5chartsCombined.pde +++ /dev/null @@ -1,252 +0,0 @@ -/** -* ControlP5 ControlP5chartsCombined -* -* find a list of public methods available for the Chart Controller -* at the bottom of this sketch. -* -* by Andreas Schlegel, 2012 -* www.sojamo.de/libraries/controlp5 -* -*/ - - -import controlP5.*; - -ControlP5 cp5; - -Chart myChart; - -void setup() { - size(400, 700); - smooth(); - cp5 = new ControlP5(this); - cp5.printPublicMethodsFor(Chart.class); - myChart = cp5.addChart("hello") - .setPosition(50, 50) - .setSize(200, 200) - .setRange(-20, 20) - .setView(Chart.BAR) // use Chart.LINE, Chart.PIE, Chart.AREA, Chart.BAR_CENTERED - ; - - myChart.getColor().setBackground(color(255, 100)); - - - myChart.addDataSet("world"); - myChart.setColors("world", color(255,0,255),color(255,0,0)); - myChart.setData("world", new float[4]); - - myChart.setStrokeWeight(1.5); - - myChart.addDataSet("earth"); - myChart.setColors("earth", color(255), color(0, 255, 0)); - myChart.updateData("earth", 1, 2, 10, 3); - -} - - -void draw() { - background(0); - // unshift: add data from left to right (first in) - myChart.unshift("world", (sin(frameCount*0.01)*10)); - - // push: add data from right to left (last in) - myChart.push("earth", (sin(frameCount*0.1)*10)); -} - - - - - - - -/* -a list of all methods available for the Chart Controller -use ControlP5.printPublicMethodsFor(Chart.class); -to print the following list into the console. - -You can find further details about class Chart in the javadoc. - -Format: -ClassName : returnType methodName(parameter type) - - -controlP5.Chart : Chart addData(ChartData) -controlP5.Chart : Chart addData(ChartDataSet, float) -controlP5.Chart : Chart addData(String, ChartData) -controlP5.Chart : Chart addData(String, float) -controlP5.Chart : Chart addData(float) -controlP5.Chart : Chart addDataSet(String) -controlP5.Chart : Chart addFirst(String, float) -controlP5.Chart : Chart addFirst(float) -controlP5.Chart : Chart addLast(String, float) -controlP5.Chart : Chart addLast(float) -controlP5.Chart : Chart push(String, float) -controlP5.Chart : Chart push(float) -controlP5.Chart : Chart removeData(ChartData) -controlP5.Chart : Chart removeData(String, ChartData) -controlP5.Chart : Chart removeData(String, int) -controlP5.Chart : Chart removeData(int) -controlP5.Chart : Chart removeDataSet(String) -controlP5.Chart : Chart removeFirst() -controlP5.Chart : Chart removeFirst(String) -controlP5.Chart : Chart removeLast() -controlP5.Chart : Chart removeLast(String) -controlP5.Chart : Chart setData(String, int, ChartData) -controlP5.Chart : Chart setData(int, ChartData) -controlP5.Chart : Chart setDataSet(ChartDataSet) -controlP5.Chart : Chart setDataSet(String, ChartDataSet) -controlP5.Chart : Chart setRange(float, float) -controlP5.Chart : Chart setResolution(int) -controlP5.Chart : Chart setStrokeWeight(float) -controlP5.Chart : Chart setValue(float) -controlP5.Chart : Chart setView(int) -controlP5.Chart : Chart unshift(String, float) -controlP5.Chart : Chart unshift(float) -controlP5.Chart : ChartData getData(String, int) -controlP5.Chart : ChartDataSet getDataSet(String) -controlP5.Chart : LinkedHashMap getDataSet() -controlP5.Chart : String getInfo() -controlP5.Chart : String toString() -controlP5.Chart : float getStrokeWeight() -controlP5.Chart : float[] getValuesFrom(String) -controlP5.Chart : int getResolution() -controlP5.Chart : int size() -controlP5.Chart : void onEnter() -controlP5.Chart : void onLeave() -controlP5.Controller : CColor getColor() -controlP5.Controller : Chart addCallback(CallbackListener) -controlP5.Controller : Chart addListener(ControlListener) -controlP5.Controller : Chart addListenerFor(int, CallbackListener) -controlP5.Controller : Chart align(int, int, int, int) -controlP5.Controller : Chart bringToFront() -controlP5.Controller : Chart bringToFront(ControllerInterface) -controlP5.Controller : Chart hide() -controlP5.Controller : Chart linebreak() -controlP5.Controller : Chart listen(boolean) -controlP5.Controller : Chart lock() -controlP5.Controller : Chart onChange(CallbackListener) -controlP5.Controller : Chart onClick(CallbackListener) -controlP5.Controller : Chart onDoublePress(CallbackListener) -controlP5.Controller : Chart onDrag(CallbackListener) -controlP5.Controller : Chart onDraw(ControllerView) -controlP5.Controller : Chart onEndDrag(CallbackListener) -controlP5.Controller : Chart onEnter(CallbackListener) -controlP5.Controller : Chart onLeave(CallbackListener) -controlP5.Controller : Chart onMove(CallbackListener) -controlP5.Controller : Chart onPress(CallbackListener) -controlP5.Controller : Chart onRelease(CallbackListener) -controlP5.Controller : Chart onReleaseOutside(CallbackListener) -controlP5.Controller : Chart onStartDrag(CallbackListener) -controlP5.Controller : Chart onWheel(CallbackListener) -controlP5.Controller : Chart plugTo(Object) -controlP5.Controller : Chart plugTo(Object, String) -controlP5.Controller : Chart plugTo(Object[]) -controlP5.Controller : Chart plugTo(Object[], String) -controlP5.Controller : Chart registerProperty(String) -controlP5.Controller : Chart registerProperty(String, String) -controlP5.Controller : Chart registerTooltip(String) -controlP5.Controller : Chart removeBehavior() -controlP5.Controller : Chart removeCallback() -controlP5.Controller : Chart removeCallback(CallbackListener) -controlP5.Controller : Chart removeListener(ControlListener) -controlP5.Controller : Chart removeListenerFor(int, CallbackListener) -controlP5.Controller : Chart removeListenersFor(int) -controlP5.Controller : Chart removeProperty(String) -controlP5.Controller : Chart removeProperty(String, String) -controlP5.Controller : Chart setArrayValue(float[]) -controlP5.Controller : Chart setArrayValue(int, float) -controlP5.Controller : Chart setBehavior(ControlBehavior) -controlP5.Controller : Chart setBroadcast(boolean) -controlP5.Controller : Chart setCaptionLabel(String) -controlP5.Controller : Chart setColor(CColor) -controlP5.Controller : Chart setColorActive(int) -controlP5.Controller : Chart setColorBackground(int) -controlP5.Controller : Chart setColorCaptionLabel(int) -controlP5.Controller : Chart setColorForeground(int) -controlP5.Controller : Chart setColorLabel(int) -controlP5.Controller : Chart setColorValue(int) -controlP5.Controller : Chart setColorValueLabel(int) -controlP5.Controller : Chart setDecimalPrecision(int) -controlP5.Controller : Chart setDefaultValue(float) -controlP5.Controller : Chart setHeight(int) -controlP5.Controller : Chart setId(int) -controlP5.Controller : Chart setImage(PImage) -controlP5.Controller : Chart setImage(PImage, int) -controlP5.Controller : Chart setImages(PImage, PImage, PImage) -controlP5.Controller : Chart setImages(PImage, PImage, PImage, PImage) -controlP5.Controller : Chart setLabel(String) -controlP5.Controller : Chart setLabelVisible(boolean) -controlP5.Controller : Chart setLock(boolean) -controlP5.Controller : Chart setMax(float) -controlP5.Controller : Chart setMin(float) -controlP5.Controller : Chart setMouseOver(boolean) -controlP5.Controller : Chart setMoveable(boolean) -controlP5.Controller : Chart setPosition(float, float) -controlP5.Controller : Chart setPosition(float[]) -controlP5.Controller : Chart setSize(PImage) -controlP5.Controller : Chart setSize(int, int) -controlP5.Controller : Chart setStringValue(String) -controlP5.Controller : Chart setUpdate(boolean) -controlP5.Controller : Chart setValue(float) -controlP5.Controller : Chart setValueLabel(String) -controlP5.Controller : Chart setValueSelf(float) -controlP5.Controller : Chart setView(ControllerView) -controlP5.Controller : Chart setVisible(boolean) -controlP5.Controller : Chart setWidth(int) -controlP5.Controller : Chart show() -controlP5.Controller : Chart unlock() -controlP5.Controller : Chart unplugFrom(Object) -controlP5.Controller : Chart unplugFrom(Object[]) -controlP5.Controller : Chart unregisterTooltip() -controlP5.Controller : Chart update() -controlP5.Controller : Chart updateSize() -controlP5.Controller : ControlBehavior getBehavior() -controlP5.Controller : ControlWindow getControlWindow() -controlP5.Controller : ControlWindow getWindow() -controlP5.Controller : ControllerProperty getProperty(String) -controlP5.Controller : ControllerProperty getProperty(String, String) -controlP5.Controller : ControllerView getView() -controlP5.Controller : Label getCaptionLabel() -controlP5.Controller : Label getValueLabel() -controlP5.Controller : List getControllerPlugList() -controlP5.Controller : Pointer getPointer() -controlP5.Controller : String getAddress() -controlP5.Controller : String getInfo() -controlP5.Controller : String getName() -controlP5.Controller : String getStringValue() -controlP5.Controller : String toString() -controlP5.Controller : Tab getTab() -controlP5.Controller : boolean isActive() -controlP5.Controller : boolean isBroadcast() -controlP5.Controller : boolean isInside() -controlP5.Controller : boolean isLabelVisible() -controlP5.Controller : boolean isListening() -controlP5.Controller : boolean isLock() -controlP5.Controller : boolean isMouseOver() -controlP5.Controller : boolean isMousePressed() -controlP5.Controller : boolean isMoveable() -controlP5.Controller : boolean isUpdate() -controlP5.Controller : boolean isVisible() -controlP5.Controller : float getArrayValue(int) -controlP5.Controller : float getDefaultValue() -controlP5.Controller : float getMax() -controlP5.Controller : float getMin() -controlP5.Controller : float getValue() -controlP5.Controller : float[] getAbsolutePosition() -controlP5.Controller : float[] getArrayValue() -controlP5.Controller : float[] getPosition() -controlP5.Controller : int getDecimalPrecision() -controlP5.Controller : int getHeight() -controlP5.Controller : int getId() -controlP5.Controller : int getWidth() -controlP5.Controller : int listenerSize() -controlP5.Controller : void remove() -controlP5.Controller : void setView(ControllerView, int) -java.lang.Object : String toString() -java.lang.Object : boolean equals(Object) - -created: 2014/08/16 19:11:34 - -*/ - - diff --git a/Processing/libraries/controlP5/examples/extra/ControlP5console/ControlP5console.pde b/Processing/libraries/controlP5/examples/extra/ControlP5console/ControlP5console.pde deleted file mode 100644 index c5b5f38..0000000 --- a/Processing/libraries/controlP5/examples/extra/ControlP5console/ControlP5console.pde +++ /dev/null @@ -1,71 +0,0 @@ -/** - * ControlP5 Println - * - * - * a console like textarea which captures the output from the System.out stream - * - * by Andreas Schlegel, 2012 - * www.sojamo.de/libraries/controlp5 - * - */ - -import controlP5.*; - -ControlP5 cp5; - -Textarea myTextarea; - -int c = 0; - -Println console; - -void setup() { - size(700, 400); - cp5 = new ControlP5(this); - cp5.enableShortcuts(); - frameRate(50); - myTextarea = cp5.addTextarea("txt") - .setPosition(100, 100) - .setSize(200, 200) - .setFont(createFont("", 10)) - .setLineHeight(14) - .setColor(color(200)) - .setColorBackground(color(0, 100)) - .setColorForeground(color(255, 100)); - ; - - console = cp5.addConsole(myTextarea);// -} - - -void draw() { - background(128); - noStroke(); - ellipseMode(CENTER); - float n = sin(frameCount*0.01)*300; - fill(110, 255,220); - ellipse(width/2, height/2, n , n); - - println(frameCount+"\t"+String.format("%.2f", frameRate)+"\t"+String.format("%.2f", n)); -} - -void keyPressed() { - switch(key) { - case('1'): - console.pause(); - break; - case('2'): - console.play(); - break; - case('3'): - console.setMax(8); - break; - case('4'): - console.setMax(-1); - break; - case('5'): - console.clear(); - break; - } -} - diff --git a/Processing/libraries/controlP5/examples/extra/ControlP5controllerOnTop3D/ControlP5controllerOnTop3D.pde b/Processing/libraries/controlP5/examples/extra/ControlP5controllerOnTop3D/ControlP5controllerOnTop3D.pde deleted file mode 100644 index cd28d9d..0000000 --- a/Processing/libraries/controlP5/examples/extra/ControlP5controllerOnTop3D/ControlP5controllerOnTop3D.pde +++ /dev/null @@ -1,148 +0,0 @@ -/** - * ControlP5 Controller on top of 3D - * demonstrates how to use controlP5 controllers on top of a - * OpenGL 3D scene. - * - * by Andreas Schlegel, 2011 - * www.sojamo.de/libraries/controlP5 - * - */ - - - -import controlP5.*; -import processing.opengl.*; - -ControlP5 cp5; -ControlGroup messageBox; -int messageBoxResult = -1; -String messageBoxString = ""; -float t; - -void setup() { - size(640,480,P3D); - cp5 = new ControlP5(this); - noStroke(); - createMessageBox(); - Button b = cp5.addButton("toggleBox",1,20,20,100,20); - b.setLabel("Toggle Box"); - textFont(createFont("",30)); -} - - -void draw() { - hint(ENABLE_DEPTH_TEST); - pushMatrix(); - if(messageBox.isVisible()) { - background(128); - } else { - background(0); - fill(255); - text(messageBoxString,20,height-40); - } - - translate(width/2,height/2,mouseX); - rotateY(t+=0.1); - fill(255); - rect(-50,-50,100,100); - popMatrix(); - hint(DISABLE_DEPTH_TEST); - // in case yo uare using the camera or you have - // changed the default camera setting, reset the camera - // to default by uncommenting the following line. - // camera(); -} - - - -void toggleBox(int theValue) { - if(messageBox.isVisible()) { - messageBox.hide(); - } else { - messageBox.show(); - } -} - - -void createMessageBox() { - // create a group to store the messageBox elements - messageBox = cp5.addGroup("messageBox",width/2 - 150,100,300); - messageBox.setBackgroundHeight(120); - messageBox.setBackgroundColor(color(0,100)); - messageBox.hideBar(); - - // add a TextLabel to the messageBox. - Textlabel l = cp5.addTextlabel("messageBoxLabel","Some MessageBox text goes here.",20,20); - l.moveTo(messageBox); - - // add a textfield-controller with named-id inputbox - // this controller will be linked to function inputbox() below. - Textfield f = cp5.addTextfield("inputbox",20,36,260,20); - f.getCaptionLabel().setVisible(false); - f.moveTo(messageBox); - f.setColorForeground(color(20)); - f.setColorBackground(color(20)); - f.setColorActive(color(100)); - // add the OK button to the messageBox. - // the name of the button corresponds to function buttonOK - // below and will be triggered when pressing the button. - Button b1 = cp5.addButton("buttonOK",0,65,80,80,24); - b1.moveTo(messageBox); - b1.setColorBackground(color(40)); - b1.setColorActive(color(20)); - // by default setValue would trigger function buttonOK, - // therefore we disable the broadcasting before setting - // the value and enable broadcasting again afterwards. - // same applies to the cancel button below. - b1.setBroadcast(false); - b1.setValue(1); - b1.setBroadcast(true); - b1.setCaptionLabel("OK"); - // centering of a label needs to be done manually - // with marginTop and marginLeft - //b1.captionLabel().style().marginTop = -2; - //b1.captionLabel().style().marginLeft = 26; - - // add the Cancel button to the messageBox. - // the name of the button corresponds to function buttonCancel - // below and will be triggered when pressing the button. - Button b2 = cp5.addButton("buttonCancel",0,155,80,80,24); - b2.moveTo(messageBox); - b2.setBroadcast(false); - b2.setValue(0); - b2.setBroadcast(true); - b2.setCaptionLabel("Cancel"); - b2.setColorBackground(color(40)); - b2.setColorActive(color(20)); - //b2.captionLabel().toUpperCase(false); - // centering of a label needs to be done manually - // with marginTop and marginLeft - //b2.captionLabel().style().marginTop = -2; - //b2.captionLabel().style().marginLeft = 16; -} - -// function buttonOK will be triggered when pressing -// the OK button of the messageBox. -void buttonOK(int theValue) { - println("a button event from button OK."); - messageBoxString = ((Textfield)cp5.getController("inputbox")).getText(); - messageBoxResult = theValue; - messageBox.hide(); -} - - -// function buttonCancel will be triggered when pressing -// the Cancel button of the messageBox. -void buttonCancel(int theValue) { - println("a button event from button Cancel."); - messageBoxResult = theValue; - messageBox.hide(); -} - -// inputbox is called whenever RETURN has been pressed -// in textfield-controller inputbox -void inputbox(String theString) { - println("got something from the inputbox : "+theString); - messageBoxString = theString; - messageBox.hide(); -} diff --git a/Processing/libraries/controlP5/examples/extra/ControlP5frame/ControlP5frame.pde b/Processing/libraries/controlP5/examples/extra/ControlP5frame/ControlP5frame.pde deleted file mode 100644 index 4bc9a82..0000000 --- a/Processing/libraries/controlP5/examples/extra/ControlP5frame/ControlP5frame.pde +++ /dev/null @@ -1,112 +0,0 @@ -/** - * ControlP5 Controlframe - * - * this example shows you how to create separate window to - * display and use controllers with processing 3 - * - * by Andreas Schlegel, 2016 - * www.sojamo.de/libraries/controlp5 - * - */ - -import controlP5.*; - -ControlFrame cf; - -float speed; -float pos; -float c0, c1, c2, c3; -boolean auto; - -void settings() { - size(400, 400, P3D); -} - -void setup() { - cf = new ControlFrame(this, 400, 800, "Controls"); - surface.setLocation(420, 10); - noStroke(); -} - -void draw() { - if (auto) pos += speed; - background(0); - translate(width/2, height/2); - rotateY(pos); - lights(); - fill(c0, c1, c2, c3); - box(100); -} - - - - -class ControlFrame extends PApplet { - - int w, h; - PApplet parent; - ControlP5 cp5; - - public ControlFrame(PApplet _parent, int _w, int _h, String _name) { - super(); - parent = _parent; - w=_w; - h=_h; - PApplet.runSketch(new String[]{this.getClass().getName()}, this); - } - - public void settings() { - size(w, h); - } - - public void setup() { - surface.setLocation(10, 10); - cp5 = new ControlP5(this); - - cp5.addToggle("auto") - .plugTo(parent, "auto") - .setPosition(10, 70) - .setSize(50, 50) - .setValue(true); - - cp5.addKnob("blend") - .plugTo(parent, "c3") - .setPosition(100, 300) - .setSize(200, 200) - .setRange(0, 255) - .setValue(200); - - cp5.addNumberbox("color-red") - .plugTo(parent, "c0") - .setRange(0, 255) - .setValue(255) - .setPosition(100, 10) - .setSize(100, 20); - - cp5.addNumberbox("color-green") - .plugTo(parent, "c1") - .setRange(0, 255) - .setValue(128) - .setPosition(100, 70) - .setSize(100, 20); - - cp5.addNumberbox("color-blue") - .plugTo(parent, "c2") - .setRange(0, 255) - .setValue(0) - .setPosition(100, 130) - .setSize(100, 20); - - cp5.addSlider("speed") - .plugTo(parent, "speed") - .setRange(0, 0.1) - .setValue(0.01) - .setPosition(100, 240) - .setSize(200, 30); - - } - - void draw() { - background(190); - } -} \ No newline at end of file diff --git a/Processing/libraries/controlP5/examples/extra/ControlP5frameRate/ControlP5frameRate.pde b/Processing/libraries/controlP5/examples/extra/ControlP5frameRate/ControlP5frameRate.pde deleted file mode 100644 index 85aed00..0000000 --- a/Processing/libraries/controlP5/examples/extra/ControlP5frameRate/ControlP5frameRate.pde +++ /dev/null @@ -1,199 +0,0 @@ -/** - * ControlP5 FrameRate - * - * - * uses a textlabel to display the current or average - * framerate of the sketch. - * - * by Andreas Schlegel, 2012 - * www.sojamo.de/libraries/controlp5 - * - */ - - -import controlP5.*; - -ControlP5 cp5; - -void setup() { - size(400,500); - frameRate(60); - cp5 = new ControlP5(this); - cp5.addFrameRate().setInterval(10).setPosition(0,height - 10); - -} - -void draw() { - background(129); -} - -/* -a list of all methods available for the FrameRate Controller -use ControlP5.printPublicMethodsFor(FrameRate.class); -to print the following list into the console. - -You can find further details about class FrameRate in the javadoc. - -Format: -ClassName : returnType methodName(parameter type) - - -controlP5.Controller : CColor getColor() -controlP5.Controller : ControlBehavior getBehavior() -controlP5.Controller : ControlWindow getControlWindow() -controlP5.Controller : ControlWindow getWindow() -controlP5.Controller : ControllerProperty getProperty(String) -controlP5.Controller : ControllerProperty getProperty(String, String) -controlP5.Controller : ControllerView getView() -controlP5.Controller : FrameRate addCallback(CallbackListener) -controlP5.Controller : FrameRate addListener(ControlListener) -controlP5.Controller : FrameRate addListenerFor(int, CallbackListener) -controlP5.Controller : FrameRate align(int, int, int, int) -controlP5.Controller : FrameRate bringToFront() -controlP5.Controller : FrameRate bringToFront(ControllerInterface) -controlP5.Controller : FrameRate hide() -controlP5.Controller : FrameRate linebreak() -controlP5.Controller : FrameRate listen(boolean) -controlP5.Controller : FrameRate lock() -controlP5.Controller : FrameRate onChange(CallbackListener) -controlP5.Controller : FrameRate onClick(CallbackListener) -controlP5.Controller : FrameRate onDoublePress(CallbackListener) -controlP5.Controller : FrameRate onDrag(CallbackListener) -controlP5.Controller : FrameRate onDraw(ControllerView) -controlP5.Controller : FrameRate onEndDrag(CallbackListener) -controlP5.Controller : FrameRate onEnter(CallbackListener) -controlP5.Controller : FrameRate onLeave(CallbackListener) -controlP5.Controller : FrameRate onMove(CallbackListener) -controlP5.Controller : FrameRate onPress(CallbackListener) -controlP5.Controller : FrameRate onRelease(CallbackListener) -controlP5.Controller : FrameRate onReleaseOutside(CallbackListener) -controlP5.Controller : FrameRate onStartDrag(CallbackListener) -controlP5.Controller : FrameRate onWheel(CallbackListener) -controlP5.Controller : FrameRate plugTo(Object) -controlP5.Controller : FrameRate plugTo(Object, String) -controlP5.Controller : FrameRate plugTo(Object[]) -controlP5.Controller : FrameRate plugTo(Object[], String) -controlP5.Controller : FrameRate registerProperty(String) -controlP5.Controller : FrameRate registerProperty(String, String) -controlP5.Controller : FrameRate registerTooltip(String) -controlP5.Controller : FrameRate removeBehavior() -controlP5.Controller : FrameRate removeCallback() -controlP5.Controller : FrameRate removeCallback(CallbackListener) -controlP5.Controller : FrameRate removeListener(ControlListener) -controlP5.Controller : FrameRate removeListenerFor(int, CallbackListener) -controlP5.Controller : FrameRate removeListenersFor(int) -controlP5.Controller : FrameRate removeProperty(String) -controlP5.Controller : FrameRate removeProperty(String, String) -controlP5.Controller : FrameRate setArrayValue(float[]) -controlP5.Controller : FrameRate setArrayValue(int, float) -controlP5.Controller : FrameRate setBehavior(ControlBehavior) -controlP5.Controller : FrameRate setBroadcast(boolean) -controlP5.Controller : FrameRate setCaptionLabel(String) -controlP5.Controller : FrameRate setColor(CColor) -controlP5.Controller : FrameRate setColorActive(int) -controlP5.Controller : FrameRate setColorBackground(int) -controlP5.Controller : FrameRate setColorCaptionLabel(int) -controlP5.Controller : FrameRate setColorForeground(int) -controlP5.Controller : FrameRate setColorLabel(int) -controlP5.Controller : FrameRate setColorValue(int) -controlP5.Controller : FrameRate setColorValueLabel(int) -controlP5.Controller : FrameRate setDecimalPrecision(int) -controlP5.Controller : FrameRate setDefaultValue(float) -controlP5.Controller : FrameRate setHeight(int) -controlP5.Controller : FrameRate setId(int) -controlP5.Controller : FrameRate setImage(PImage) -controlP5.Controller : FrameRate setImage(PImage, int) -controlP5.Controller : FrameRate setImages(PImage, PImage, PImage) -controlP5.Controller : FrameRate setImages(PImage, PImage, PImage, PImage) -controlP5.Controller : FrameRate setLabel(String) -controlP5.Controller : FrameRate setLabelVisible(boolean) -controlP5.Controller : FrameRate setLock(boolean) -controlP5.Controller : FrameRate setMax(float) -controlP5.Controller : FrameRate setMin(float) -controlP5.Controller : FrameRate setMouseOver(boolean) -controlP5.Controller : FrameRate setMoveable(boolean) -controlP5.Controller : FrameRate setPosition(float, float) -controlP5.Controller : FrameRate setPosition(float[]) -controlP5.Controller : FrameRate setSize(PImage) -controlP5.Controller : FrameRate setSize(int, int) -controlP5.Controller : FrameRate setStringValue(String) -controlP5.Controller : FrameRate setUpdate(boolean) -controlP5.Controller : FrameRate setValue(float) -controlP5.Controller : FrameRate setValueLabel(String) -controlP5.Controller : FrameRate setValueSelf(float) -controlP5.Controller : FrameRate setView(ControllerView) -controlP5.Controller : FrameRate setVisible(boolean) -controlP5.Controller : FrameRate setWidth(int) -controlP5.Controller : FrameRate show() -controlP5.Controller : FrameRate unlock() -controlP5.Controller : FrameRate unplugFrom(Object) -controlP5.Controller : FrameRate unplugFrom(Object[]) -controlP5.Controller : FrameRate unregisterTooltip() -controlP5.Controller : FrameRate update() -controlP5.Controller : FrameRate updateSize() -controlP5.Controller : Label getCaptionLabel() -controlP5.Controller : Label getValueLabel() -controlP5.Controller : List getControllerPlugList() -controlP5.Controller : Pointer getPointer() -controlP5.Controller : String getAddress() -controlP5.Controller : String getInfo() -controlP5.Controller : String getName() -controlP5.Controller : String getStringValue() -controlP5.Controller : String toString() -controlP5.Controller : Tab getTab() -controlP5.Controller : boolean isActive() -controlP5.Controller : boolean isBroadcast() -controlP5.Controller : boolean isInside() -controlP5.Controller : boolean isLabelVisible() -controlP5.Controller : boolean isListening() -controlP5.Controller : boolean isLock() -controlP5.Controller : boolean isMouseOver() -controlP5.Controller : boolean isMousePressed() -controlP5.Controller : boolean isMoveable() -controlP5.Controller : boolean isUpdate() -controlP5.Controller : boolean isVisible() -controlP5.Controller : float getArrayValue(int) -controlP5.Controller : float getDefaultValue() -controlP5.Controller : float getMax() -controlP5.Controller : float getMin() -controlP5.Controller : float getValue() -controlP5.Controller : float[] getAbsolutePosition() -controlP5.Controller : float[] getArrayValue() -controlP5.Controller : float[] getPosition() -controlP5.Controller : int getDecimalPrecision() -controlP5.Controller : int getHeight() -controlP5.Controller : int getId() -controlP5.Controller : int getWidth() -controlP5.Controller : int listenerSize() -controlP5.Controller : void remove() -controlP5.Controller : void setView(ControllerView, int) -controlP5.FrameRate : FrameRate setInterval(int) -controlP5.FrameRate : void draw(PGraphics) -controlP5.Textlabel : ControllerStyle getStyle() -controlP5.Textlabel : Label get() -controlP5.Textlabel : Textlabel append(String, int) -controlP5.Textlabel : Textlabel setColor(int) -controlP5.Textlabel : Textlabel setFont(ControlFont) -controlP5.Textlabel : Textlabel setFont(PFont) -controlP5.Textlabel : Textlabel setHeight(int) -controlP5.Textlabel : Textlabel setLetterSpacing(int) -controlP5.Textlabel : Textlabel setLineHeight(int) -controlP5.Textlabel : Textlabel setMultiline(boolean) -controlP5.Textlabel : Textlabel setStringValue(String) -controlP5.Textlabel : Textlabel setText(String) -controlP5.Textlabel : Textlabel setValue(String) -controlP5.Textlabel : Textlabel setValue(float) -controlP5.Textlabel : Textlabel setWidth(int) -controlP5.Textlabel : int getLineHeight() -controlP5.Textlabel : void draw() -controlP5.Textlabel : void draw(PApplet) -controlP5.Textlabel : void draw(PGraphics) -controlP5.Textlabel : void draw(int, int) -java.lang.Object : String toString() -java.lang.Object : boolean equals(Object) - -created: 2015/03/24 12:22:02 - -*/ - - diff --git a/Processing/libraries/controlP5/examples/extra/ControlP5frames/ControlP5frames.pde b/Processing/libraries/controlP5/examples/extra/ControlP5frames/ControlP5frames.pde deleted file mode 100644 index 1c1979d..0000000 --- a/Processing/libraries/controlP5/examples/extra/ControlP5frames/ControlP5frames.pde +++ /dev/null @@ -1,134 +0,0 @@ - -import java.awt.*; -import java.awt.event.*; -import controlP5.*; - -private ControlP5 cp5; - -ControlFrame cf1, cf2; - -int bgColor; - -void setup() { - size(400, 400 ,P3D ); - /* add a controlP5 instance for the main sketch window (not required for other ControlFrames to work) */ - cp5 = new ControlP5( this ); - cp5.addSlider( "s2" ); - - - /* Add a controlframe */ - - cf1 = addControlFrame( "hello", 200, 200, 20, 20, color( 100 ) ); - - // add a slider with an EventListener. When dragging the slider, - // variable bgColor will change accordingly. - cf1.control().addSlider( "s1" ).setRange( 0, 255 ).addListener( new ControlListener() { - public void controlEvent( ControlEvent ev ) { - bgColor = color( ev.getValue() ); - } - } - ); - - - /* Add a second controlframe */ - - cf2 = addControlFrame( "world", 200, 200, 20, 240, color( 100 ) ); - - // add a button with an EventListener. When releasing the button, - // variable bgColor will change to color( 255 ); - cf2.control().addButton( "b1" ).addListener( new ControlListener() { - public void controlEvent( ControlEvent ev ) { - bgColor = color( 255 ); - } - } - ); - - cf2.control().addButton( "b2" ).addListener( new ControlListener() { - public void controlEvent(ControlEvent ev) { - bgColor = color( random( 255 ), random( 255 ), random( 255 ) ); - } - } - ); -} - -void draw() { - background( bgColor ); -} - - -/* no changes required below */ - - -ControlFrame addControlFrame(String theName, int theWidth, int theHeight) { - return addControlFrame(theName, theWidth, theHeight, 100, 100, color( 0 ) ); -} - -ControlFrame addControlFrame(String theName, int theWidth, int theHeight, int theX, int theY, int theColor ) { - final Frame f = new Frame( theName ); - final ControlFrame p = new ControlFrame( this, theWidth, theHeight, theColor ); - - f.add( p ); - p.init(); - f.setTitle(theName); - f.setSize( p.w, p.h ); - f.setLocation( theX, theY ); - f.addWindowListener( new WindowAdapter() { - @Override - public void windowClosing(WindowEvent we) { - p.dispose(); - f.dispose(); - } - } - ); - f.setResizable( false ); - f.setVisible( true ); - // sleep a little bit to allow p to call setup. - // otherwise a nullpointerexception might be caused. - try { - Thread.sleep( 100 ); - } - catch(Exception e) { - } - return p; -} - - -// the ControlFrame class extends PApplet, so we -// are creating a new processing applet inside a -// new frame with a controlP5 object loaded -public class ControlFrame extends PApplet { - - int w, h; - - int bg; - - public void setup() { - size(w, h); - frameRate(25); - cp5 = new ControlP5( this ); - } - - public void draw() { - background( bg ); - } - - private ControlFrame() { - } - - public ControlFrame(Object theParent, int theWidth, int theHeight, int theColor) { - parent = theParent; - w = theWidth; - h = theHeight; - bg = theColor; - } - - - public ControlP5 control() { - return this.cp5; - } - - ControlP5 cp5; - - Object parent; -} - diff --git a/Processing/libraries/controlP5/examples/extra/ControlP5groupCanvas/ControlP5groupCanvas.pde b/Processing/libraries/controlP5/examples/extra/ControlP5groupCanvas/ControlP5groupCanvas.pde deleted file mode 100644 index 73c2bb7..0000000 --- a/Processing/libraries/controlP5/examples/extra/ControlP5groupCanvas/ControlP5groupCanvas.pde +++ /dev/null @@ -1,51 +0,0 @@ -/** - * ControlP5 Canvas - * - * by andreas schlegel, 2011 - * www.sojamo.de/libraries/controlp5 - * - */ - -import controlP5.*; - -ControlP5 cp5; - -void setup() { - size(400,600); - smooth(); - - cp5 = new ControlP5(this); - cp5.addGroup("myGroup") - .setLabel("Testing Canvas") - .setPosition(100,200) - .setWidth(200) - .addCanvas(new TestCanvas()) - ; -} - -void draw() { - background(0); -} - - -class TestCanvas extends Canvas { - - float n; - float a; - - public void setup(PGraphics pg) { - println("starting a test canvas."); - n = 1; - } - public void draw(PGraphics pg) { - n += 0.01; - pg.ellipseMode(CENTER); - pg.fill(lerpColor(color(0,100,200),color(0,200,100),map(sin(n),-1,1,0,1))); - pg.rect(0,0,200,200); - pg.fill(255,150); - a+=0.01; - ellipse(100,100,abs(sin(a)*150),abs(sin(a)*150)); - ellipse(40,40,abs(sin(a+0.5)*50),abs(sin(a+0.5)*50)); - ellipse(60,140,abs(cos(a)*80),abs(cos(a)*80)); - } -} diff --git a/Processing/libraries/controlP5/examples/extra/ControlP5imageButton/ControlP5imageButton.pde b/Processing/libraries/controlP5/examples/extra/ControlP5imageButton/ControlP5imageButton.pde deleted file mode 100644 index 309ea21..0000000 --- a/Processing/libraries/controlP5/examples/extra/ControlP5imageButton/ControlP5imageButton.pde +++ /dev/null @@ -1,38 +0,0 @@ -import controlP5.*; - -ControlP5 cp5; - -int myColor = color(0); - - -void setup() { - size(400,600); - cp5 = new ControlP5(this); - - // replace the default controlP5 button with an image. - // button.setImages(defaultImage, rolloverImage, pressedImage); - // use button.updateSize() to adjust the size of the button and - // resize to the dimensions of the defaultImage - - cp5.addButton("buttonA") - .setPosition(175,275) - .setImages(loadImage("Arrow-Left.png"), loadImage("Arrow-Right.png"), loadImage("Refresh.png")) - .updateSize(); -} - -void draw() { - background(myColor); -} - -public void controlEvent(ControlEvent theEvent) { - println(theEvent.getController().getName()); - -} - -// function buttonA will receive changes from -// controller with name buttonA -public void buttonA(int theValue) { - println("a button event from buttonA: "+theValue); - myColor = color(128); -} - diff --git a/Processing/libraries/controlP5/examples/extra/ControlP5imageButton/data/Arrow-Left.png b/Processing/libraries/controlP5/examples/extra/ControlP5imageButton/data/Arrow-Left.png deleted file mode 100644 index 33ab6ee..0000000 Binary files a/Processing/libraries/controlP5/examples/extra/ControlP5imageButton/data/Arrow-Left.png and /dev/null differ diff --git a/Processing/libraries/controlP5/examples/extra/ControlP5imageButton/data/Arrow-Right.png b/Processing/libraries/controlP5/examples/extra/ControlP5imageButton/data/Arrow-Right.png deleted file mode 100644 index 5afff9b..0000000 Binary files a/Processing/libraries/controlP5/examples/extra/ControlP5imageButton/data/Arrow-Right.png and /dev/null differ diff --git a/Processing/libraries/controlP5/examples/extra/ControlP5imageButton/data/Refresh.png b/Processing/libraries/controlP5/examples/extra/ControlP5imageButton/data/Refresh.png deleted file mode 100644 index 6582a31..0000000 Binary files a/Processing/libraries/controlP5/examples/extra/ControlP5imageButton/data/Refresh.png and /dev/null differ diff --git a/Processing/libraries/controlP5/examples/extra/ControlP5key/ControlP5key.pde b/Processing/libraries/controlP5/examples/extra/ControlP5key/ControlP5key.pde deleted file mode 100644 index 095b7e4..0000000 --- a/Processing/libraries/controlP5/examples/extra/ControlP5key/ControlP5key.pde +++ /dev/null @@ -1,50 +0,0 @@ -/** - * ControlP5 ControlKey - * use ControlKeys to map key combinations to particular events. - * multi-keypress supported. - * - * by Andreas Schlegel, 2012 - * www.sojamo.de/libraries/controlp5 - * - */ - -import controlP5.*; - -ControlP5 cp5; - -int col; -int colEllipse; -boolean visible; - -void setup() { - size(400, 600); - smooth(); - noStroke(); - col = color(0); - colEllipse = color(0,255,90); - cp5 = new ControlP5(this); - - // press key 1 to change background to white - cp5.mapKeyFor(new ControlKey() {public void keyEvent() {col = color(255);}}, '1'); - - // press key 2 to change background to black - cp5.mapKeyFor(new ControlKey() {public void keyEvent() {col = color(0);}}, '2'); - - // press key 1 and ALT to make circles visible - cp5.mapKeyFor(new ControlKey() {public void keyEvent() {visible = true;}}, ALT,'1'); - - // press key 2 and ALT to hide circles - cp5.mapKeyFor(new ControlKey() {public void keyEvent() {visible = false;}}, ALT,'2'); - - // press key 1 and ALT and SHIFT to change the color of circles - cp5.mapKeyFor(new ControlKey() {public void keyEvent() {colEllipse = color(random(255));}}, ALT,'1',SHIFT); -} - -void draw() { - background(col); - if(visible) { - fill(colEllipse); - ellipse(100,100,50,50); - ellipse(150,400,200,200); - } -} diff --git a/Processing/libraries/controlP5/examples/extra/ControlP5listBoxClear/ControlP5listBoxClear.pde b/Processing/libraries/controlP5/examples/extra/ControlP5listBoxClear/ControlP5listBoxClear.pde deleted file mode 100644 index 177d019..0000000 --- a/Processing/libraries/controlP5/examples/extra/ControlP5listBoxClear/ControlP5listBoxClear.pde +++ /dev/null @@ -1,74 +0,0 @@ -import controlP5.*; - -String[][] s = new String[3][]; -ControlP5 controlP5; -ListBox l; - -void setup() { - size(400,400); - controlP5 = new ControlP5(this); - l = controlP5.addListBox("myList",100,100,120,150); - // l.actAsPulldownMenu(true); - l.setItemHeight(23); - - - s[0] = new String[] { - "a","b","c","d" - }; - s[1] = new String[] { - "a","b","c","d","e","f","g","h","i","j","k","l","m","n" - }; - s[2] = new String[] { - "l","m","n" - }; - - for(int i=0;i "+theEvent.getGroup().getValue()); - int n = int(theEvent.getGroup().getValue()); - println("\t\t group:"+(n >> 8 & 0xff)+", item:"+(n >> 0 & 0xff)); - } -} diff --git a/Processing/libraries/controlP5/examples/extra/ControlP5mouseWheel/ControlP5mouseWheel.pde b/Processing/libraries/controlP5/examples/extra/ControlP5mouseWheel/ControlP5mouseWheel.pde deleted file mode 100644 index 74904e8..0000000 --- a/Processing/libraries/controlP5/examples/extra/ControlP5mouseWheel/ControlP5mouseWheel.pde +++ /dev/null @@ -1,94 +0,0 @@ -/** - * ControlP5 KeyEventAndWheel - * - * with controlP5 2.0 all java.awt dependencies have been removed - * as a consequence the option to use the MouseWheel for some controllers - * has been removed. But the following example shows how to manually add - * the mouseWheel support. - * - * With early versions of the processing 2.0 beta releases the keyEvent forwarding - * does not work as expected and needs to be forwarded manually. - * - * by Andreas Schlegel, 2012 - * www.sojamo.de/libraries/controlp5 - * - */ - - -import controlP5.*; -import java.util.*; - -ControlP5 cp5; - -void setup() { - size(700, 300); - cp5 = new ControlP5(this); - - - cp5.addNumberbox("numberbox") - .setPosition(20, 20) - .setSize(100, 20) - ; - - cp5.addSlider("slider") - .setPosition(20, 70) - .setSize(200, 20) - ; - - cp5.addKnob("knob") - .setPosition(20, 120) - .setRadius(50) - ; - - List drops = new ArrayList(); - for(int i=0;i<100;i++) { - drops.add("item "+i); - } - - cp5.addDropdownList("drop") - .setPosition(300, 30) - .setWidth(200) - .addItems(drops) - ; - - cp5.addListBox("list") - .setPosition(520, 30) - .setSize(150,200) - .addItems(drops) - ; - - cp5.addTextarea("area") - .setPosition(300, 150) - .setSize(200,100) - .setLineHeight(10) - .setText("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam feugiat porttitor tempus. Donec hendrerit aliquam mauris, a interdum ante pellentesque et. In dui erat, condimentum et sodales eget, scelerisque quis libero. Nam non nibh vitae enim auctor fringilla sit amet quis magna. Quisque ultricies mi at arcu vulputate imperdiet tristique purus adipiscing. Maecenas pretium odio ac leo aliquam id commodo nulla eleifend. Aenean in pharetra mauris. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla suscipit, nisl vitae eleifend tincidunt, dolor justo sollicitudin nunc, sit amet rhoncus odio purus eu purus. Cras bibendum placerat elementum. Donec in lorem libero. Praesent auctor, felis quis volutpat facilisis, neque turpis tempor nisi, interdum viverra enim purus vel mi. Nam faucibus accumsan lorem, convallis consectetur elit vulputate ut."); - ; - // add mousewheel support, now hover the slide with your mouse - // and use the mousewheel (or trackpad on a macbook) to change the - // value of the slider. - addMouseWheelListener(); -} - - -void draw() { - background(0); -} - - -void controlEvent(ControlEvent event) { - println(event); -} - -// When working in desktop mode, you can add mousewheel support for -// controlP5 by using java.awt.event.MouseWheelListener and -// java.awt.event.MouseWheelEvent - -void addMouseWheelListener() { - frame.addMouseWheelListener(new java.awt.event.MouseWheelListener() { - public void mouseWheelMoved(java.awt.event.MouseWheelEvent e) { - cp5.setMouseWheelRotation(e.getWheelRotation()); - } - } - ); -} - diff --git a/Processing/libraries/controlP5/examples/extra/ControlP5pointer/ControlP5pointer.pde b/Processing/libraries/controlP5/examples/extra/ControlP5pointer/ControlP5pointer.pde deleted file mode 100644 index a278691..0000000 --- a/Processing/libraries/controlP5/examples/extra/ControlP5pointer/ControlP5pointer.pde +++ /dev/null @@ -1,75 +0,0 @@ -/** -* ControlP5 Pointer -* -* Default mouse actions use the Pointer class to trigger events. -* you can manipulate the x and y fields of the Pointer class -* for customizing input events for example when using a -* different input than the mouse. -* Here in this example the mouse coordiates are reveresed. -* -* by Andreas Schlegel, 2012 -* www.sojamo.de/libraries/controlp5 -* -*/ - -import controlP5.*; - -ControlP5 cp5; - -void setup() { - size(400, 600); - - cp5 = new ControlP5(this); - // disable outodraw because we want to draw our - // custom cursor on to of controlP5 - cp5.setAutoDraw(false); - - cp5.addSlider("hello", 0, 100, 50, 40, 40, 100, 20); - - // enable the pointer (and disable the mouse as input) - cp5.getPointer().enable(); - cp5.getPointer().set(width/2, height/2); -} - - -void draw() { - background(cp5.get("hello").getValue()); - // first draw controlP5 - cp5.draw(); - - // the draw our pointer - cp5.getPointer().set(width - mouseX, height - mouseY); - pushMatrix(); - translate(cp5.getPointer().getX(), cp5.getPointer().getY()); - stroke(255); - line(-10,0,10,0); - line(0,-10,0,10); - popMatrix(); - println(cp5.isMouseOver()); -} - -void mousePressed() { - cp5.getPointer().pressed(); -} - -void mouseReleased() { - cp5.getPointer().released(); -} - -/* -a list of all methods available for the Pointer Controller -use ControlP5.printPublicMethodsFor(Pointer.class); -to print the following list into the console. - -You can find further details about class Pointer in the javadoc. - -Format: -ClassName : returnType methodName(parameter type) - - - -created: 2015/03/24 12:22:14 - -*/ - - diff --git a/Processing/libraries/controlP5/examples/extra/ControlP5propertiesSets/ControlP5propertiesSets.pde b/Processing/libraries/controlP5/examples/extra/ControlP5propertiesSets/ControlP5propertiesSets.pde deleted file mode 100644 index 2c3d1a6..0000000 --- a/Processing/libraries/controlP5/examples/extra/ControlP5propertiesSets/ControlP5propertiesSets.pde +++ /dev/null @@ -1,133 +0,0 @@ -/** - * ControlP5 properties sets. - * - * saves/loads controller values into/from properties-file. - * this example shows how to make property sets of controllers that can be loaded and - * saved individually. By default property files come in a serialized format - * with a .ser extension. - * - * - * default properties load/save key combinations are - * alt+shift+l to load properties - * alt+shift+s to save properties - * - * - * find a list of public methods available for the ControllerPropererties Controller - * at the bottom of this sketch's source code - * - * by andreas schlegel, 2011 - * www.sojamo.de/libraries/controlp5 - * - */ - -import controlP5.*; - -ControlP5 cp5; - -public int slider1 = 32; -public int slider2 = 64; -public int slider3 = 128; -public int slider4 = 255; - - -void setup() { - size(400, 600); - cp5 = new ControlP5(this); - - // add a vertical slider - cp5.addSlider("slider1", 0, 255, 20, 100, 128, 20); - cp5.addSlider("slider2", 0, 255, 20, 150, 128, 20); - cp5.addSlider("slider3", 0, 255, 20, 200, 128, 20); - cp5.addSlider("slider4", 0, 255, 20, 250, 128, 20); - - cp5.addButton("b1", 0, 20, 350, 80, 12).setCaptionLabel("save setA"); - cp5.addButton("b2", 0, 101, 350, 80, 12).setCaptionLabel("load setA").setColorBackground(color(0, 100, 50)); - - cp5.addButton("b3", 0, 200, 350, 80, 12).setCaptionLabel("save default"); - cp5.addButton("b4", 0, 281, 350, 80, 12).setCaptionLabel("load default").setColorBackground(color(0, 100, 50)); - - - // add a new properties set 'setA' - cp5.getProperties().addSet("setA"); - - // move controller 'slider' from the default set to setA - // the 3 parameters read like this: move controller(1) from set(2) to set(3) - cp5.getProperties().move(cp5.getController("slider1"), "default", "setA"); - // use copy instead of move to register 'slider' with both sets (default and setA) - - // prints the current list of properties registered and the set(s) they belong to - cp5.getProperties().print(); - - /* by default properties are saved in JSON format, if you want to change to the old default (java's serialized format), un-comment line below*/ - // cp5.getProperties().setFormat(ControlP5.SERIALIZED); -} - -void draw() { - background(0); - - fill(slider1); - rect(250, 100, 100, 20); - - fill(slider2); - rect(250, 150, 100, 20); - - fill(slider3); - rect(250, 200, 100, 20); - - fill(slider4); - rect(250, 250, 100, 20); -} - -void b1(float v) { - cp5.saveProperties("setA", "setA"); -} - -void b2(float v) { - cp5.loadProperties(("setA")); -} - -void b3(float v) { - cp5.saveProperties("default", "default"); -} - -void b4(float v) { - cp5.loadProperties(("default.json")); -} - - - - - -/* - a list of all methods available for the ControllerProperties class - use ControlP5.printPublicMethodsFor(ControllerProperties.class); - to print the following list into the console. - - You can find further details about class ControllerProperties in the javadoc. - - Format: - ClassName : returnType methodName(parameter type) - -controlP5.ControllerProperties : ControllerProperties remove(ControllerInterface) -controlP5.ControllerProperties : ControllerProperties remove(ControllerInterface, String) -controlP5.ControllerProperties : ControllerProperties remove(ControllerInterface, String, String) -controlP5.ControllerProperties : ControllerProperty getProperty(ControllerInterface, String) -controlP5.ControllerProperties : ControllerProperty getProperty(ControllerInterface, String, String) -controlP5.ControllerProperties : ControllerProperty register(ControllerInterface, String) -controlP5.ControllerProperties : ControllerProperty register(ControllerInterface, String, String) -controlP5.ControllerProperties : HashSet addSet(String) -controlP5.ControllerProperties : HashSet getPropertySet(ControllerInterface) -controlP5.ControllerProperties : List get(ControllerInterface) -controlP5.ControllerProperties : Map get() -controlP5.ControllerProperties : String toString() -controlP5.ControllerProperties : boolean load() -controlP5.ControllerProperties : boolean load(String) -controlP5.ControllerProperties : void delete(ControllerProperty) -controlP5.ControllerProperties : void move(ControllerInterface, String, String) -controlP5.ControllerProperties : void move(ControllerProperty, String, String) -controlP5.ControllerProperties : void only(ControllerProperty, String) -controlP5.ControllerProperties : void print() -controlP5.ControllerProperties : void setFormat(Format) -java.lang.Object : String toString() -java.lang.Object : boolean equals(Object) -*/ diff --git a/Processing/libraries/controlP5/examples/extra/ControlP5propertiesSets/default.json b/Processing/libraries/controlP5/examples/extra/ControlP5propertiesSets/default.json deleted file mode 100644 index 473af1b..0000000 --- a/Processing/libraries/controlP5/examples/extra/ControlP5propertiesSets/default.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "/slider3": { - "min": 0, - "max": 255, - "value": 12.750000953674316 - }, - "/slider2": { - "min": 0, - "max": 255, - "value": 130.05001831054688 - }, - "/slider4": { - "min": 0, - "max": 255, - "value": 214.20004272460938 - } -} \ No newline at end of file diff --git a/Processing/libraries/controlP5/examples/extra/ControlP5propertiesSets/setA.json b/Processing/libraries/controlP5/examples/extra/ControlP5propertiesSets/setA.json deleted file mode 100644 index 8a50c9b..0000000 --- a/Processing/libraries/controlP5/examples/extra/ControlP5propertiesSets/setA.json +++ /dev/null @@ -1,5 +0,0 @@ -{"/slider1": { - "min": 0, - "max": 255, - "value": 255 -}} \ No newline at end of file diff --git a/Processing/libraries/controlP5/examples/extra/ControlP5renderIntoPGraphics/ControlP5renderIntoPGraphics.pde b/Processing/libraries/controlP5/examples/extra/ControlP5renderIntoPGraphics/ControlP5renderIntoPGraphics.pde deleted file mode 100644 index 0c11bc9..0000000 --- a/Processing/libraries/controlP5/examples/extra/ControlP5renderIntoPGraphics/ControlP5renderIntoPGraphics.pde +++ /dev/null @@ -1,51 +0,0 @@ -/** -* ControlP5 RenderIntoPGraphics -* -* -* experimental -* -* by Andreas Schlegel, 2013 -* www.sojamo.de/libraries/controlp5 -* -*/ - - -import controlP5.*; - -ControlP5 c1 , c2; -PGraphics panel1 , panel2; - -void setup() { - size( 1024, 500 , P3D ); // - panel1 = createGraphics( 200 , height/2 ); - panel2 = createGraphics( 200 , height/2 ); - c1 = new ControlP5( this ); - c1.enableShortcuts(); - c1.setBackground( color( 0 , 50 ) ); - c1.addButton("hello").setSize(200,20).setPosition( 0 , 0 ); - c1.addButton("world").setSize(200,100).setPosition( 0 , 70 ); - c1.addSlider("slider").setSize(50,20).setPosition( 0 , 40 ); - c1.setGraphics( panel1 , 0 , 0 ); - - c2 = new ControlP5( this ); - c2.enableShortcuts(); - c2.setBackground( color( 0 , 50 ) ); - c2.addButton("hello").setSize(200,20).setPosition( 0 , 0 ); - c2.addButton("world").setSize(200,100).setPosition( 0 , 70 ); - c2.addSlider("slider").setSize(50,20).setPosition( 0 , 40 ); - c2.setGraphics( panel2 , 220 , 0 ); - -} - - -void draw() { - background( 100 , 0 , 0 ); - - /* TODO update mouseevent when using setGraphics */ - c1.setGraphics( panel1 , 100 + int(sin(frameCount*0.1) * 100) , 250 ); -} - - -void controlEvent( ControlEvent ce) { - println(ce); -} diff --git a/Processing/libraries/controlP5/examples/extra/ControlP5style/ControlP5style.pde b/Processing/libraries/controlP5/examples/extra/ControlP5style/ControlP5style.pde deleted file mode 100644 index 01147c0..0000000 --- a/Processing/libraries/controlP5/examples/extra/ControlP5style/ControlP5style.pde +++ /dev/null @@ -1,110 +0,0 @@ -/** -* ControlP5 ControllerStyle -* -* -* find a list of public methods available for the ControllerStyle Controller -* at the bottom of this sketch. -* -* by Andreas Schlegel, 2011 -* www.sojamo.de/libraries/controlp5 -* -*/ - -import controlP5.*; - -ControlP5 cp5; - -float v1 = 50, v2 = 100, v3 = 100, v4 = 100; - -void setup() { - size(400,600); - smooth(); - noStroke(); - cp5 = new ControlP5(this); - - cp5.begin(100,100); - cp5.addSlider("v1",0,255).linebreak(); - cp5.addSlider("v2",0,200).linebreak(); - cp5.addSlider("v3",0,300).linebreak(); - cp5.addSlider("v4",0,400); - cp5.end(); - - // change the caption label for controller v1 and apply styles - cp5.getController("v1").setCaptionLabel("Background"); - style("v1"); - - // change the caption label for controller v2 and apply styles - cp5.getController("v2").setCaptionLabel("Ellipse A"); - style("v2"); - - // change the caption label for controller v3 and apply styles - cp5.getController("v3").setCaptionLabel("Ellipse B"); - style("v3"); - - // change the caption label for controller v3 and apply styles - cp5.getController("v4").setCaptionLabel("Ellipse C"); - style("v4"); - - -} - -void style(String theControllerName) { - Controller c = cp5.getController(theControllerName); - // adjust the height of the controller - c.setHeight(15); - - // add some padding to the caption label background - c.getCaptionLabel().getStyle().setPadding(4,4,3,4); - - // shift the caption label up by 4px - c.getCaptionLabel().getStyle().setMargin(-4,0,0,0); - - // set the background color of the caption label - c.getCaptionLabel().setColorBackground(color(10,20,30,140)); -} - -void draw() { - background(v1); - fill(255,255,220,100); - ellipse(width/2-100, height/2-100,v2 + 50,v2 + 50); - ellipse(width/2+100, height/2,v3,v3); - ellipse(width/2, height/2+100,v4,v4); -} - - - -/* -a list of all methods available for the ControllerStyle Controller -use ControlP5.printPublicMethodsFor(ControllerStyle.class); -to print the following list into the console. - -You can find further details about class ControllerStyle in the javadoc. - -Format: -ClassName : returnType methodName(parameter type) - - - - -controlP5.ControllerStyle : ControllerStyle margin(int) -controlP5.ControllerStyle : ControllerStyle margin(int, int, int, int) -controlP5.ControllerStyle : ControllerStyle moveMargin(int, int, int, int) -controlP5.ControllerStyle : ControllerStyle movePadding(int, int, int, int) -controlP5.ControllerStyle : ControllerStyle padding(int) -controlP5.ControllerStyle : ControllerStyle padding(int, int, int, int) -controlP5.ControllerStyle : ControllerStyle setMargin(int, int, int, int) -controlP5.ControllerStyle : ControllerStyle setMarginBottom(int) -controlP5.ControllerStyle : ControllerStyle setMarginLeft(int) -controlP5.ControllerStyle : ControllerStyle setMarginRight(int) -controlP5.ControllerStyle : ControllerStyle setMarginTop(int) -controlP5.ControllerStyle : ControllerStyle setPadding(int, int, int, int) -controlP5.ControllerStyle : ControllerStyle setPaddingBottom(int) -controlP5.ControllerStyle : ControllerStyle setPaddingLeft(int) -controlP5.ControllerStyle : ControllerStyle setPaddingRight(int) -controlP5.ControllerStyle : ControllerStyle setPaddingTop(int) -java.lang.Object : String toString() -java.lang.Object : boolean equals(Object) - - -*/ - diff --git a/Processing/libraries/controlP5/examples/extra/ControlP5textfieldAdvanced/ControlP5textfieldAdvanced.pde b/Processing/libraries/controlP5/examples/extra/ControlP5textfieldAdvanced/ControlP5textfieldAdvanced.pde deleted file mode 100644 index 61899bd..0000000 --- a/Processing/libraries/controlP5/examples/extra/ControlP5textfieldAdvanced/ControlP5textfieldAdvanced.pde +++ /dev/null @@ -1,114 +0,0 @@ -/** - * ControlP5 textfield (advanced) - * - * demonstrates how to use keepFocus, setText, getText, getTextList, - * clear, setAutoClear, isAutoClear and submit. - * - * by andreas schlegel, 2012 - * www.sojamo.de/libraries/controlp5 - * - */ - -import controlP5.*; - -ControlP5 cp5; - -String textValue = ""; - -Textfield myTextfield; - -void setup() { - size(400, 600); - - cp5 = new ControlP5(this); - myTextfield = cp5.addTextfield("textinput") - .setPosition(100, 200) - .setSize(200, 20) - .setFocus(true) - ; - - cp5.addTextfield("textValue") - .setPosition(100, 300) - .setSize(200, 20) - ; - - // use setAutoClear(true/false) to clear a textfield or keep text displayed in - // a textfield after pressing return. - myTextfield.setAutoClear(true).keepFocus(true); - - cp5.addButton("clear", 0, 20, 200, 70, 20); - cp5.addButton("submit", 0, 310, 200, 60, 20); - cp5.addButton("performTextfieldActions", 0, 20, 100, 150, 20); - cp5.addToggle("toggleAutoClear", true, 180, 100, 90, 20).setCaptionLabel("Auto Clear"); - cp5.addToggle("toggleKeepFocus", true, 280, 100, 90, 20).setCaptionLabel("Keep Focus"); - - -} - -void draw() { - background(0); -} - -void toggleAutoClear(boolean theFlag) { - myTextfield.setAutoClear(theFlag); -} - -void toggleKeepFocus(boolean theFlag) { - myTextfield.keepFocus(theFlag); -} - -void clear(int theValue) { - myTextfield.clear(); -} - -void submit(int theValue) { - myTextfield.submit(); -} - - -void controlEvent(ControlEvent theEvent) { - if (theEvent.isAssignableFrom(Textfield.class)) { - Textfield t = (Textfield)theEvent.getController(); - - println("controlEvent: accessing a string from controller '" - +t.getName()+"': "+t.getStringValue() - ); - - // Textfield.isAutoClear() must be true - print("controlEvent: trying to setText, "); - - t.setText("controlEvent: changing text."); - if (t.isAutoClear()==false) { - println(" success!"); - } - else { - println(" but Textfield.isAutoClear() is false, could not setText here."); - } - } -} - -void performTextfieldActions() { - println("\n"); - // Textfield.getText(); - println("the current text of myTextfield: "+myTextfield.getText()); - println("the current value of textValue: "+textValue); - // Textfield.setText(); - myTextfield.setText("changed the text of a textfield"); - println("changing text of myTextfield to: "+myTextfield.getText()); - // Textfield.getTextList(); - println("the textlist of myTextfield has "+myTextfield.getTextList().length+" items."); - for (int i=0;i - * After initializing controlP5 you can add controllers to controlP5. - * Here we use three numberboxes, one slider and one textfield. - * The numberbox with name numberboxC will trigger function numberboxC() - * in the example below. Whenever controlP5 detects a function in your - * sketch that corresponds to the name of a controller, it will forward - * an event to that function. Any event triggered by a controller - * will be forwarded to function controlEvent in your sketch. - * related examples ControlP5numberbox, ControlP5slider, ControlP5textfield - * - * by Andreas Schlegel, 2011 - * www.sojamo.de/libraries/controlp5 - * - */ - - -import controlP5.*; - -ControlP5 cp5; -public int myColorRect = 200; -public int myColorBackground = 100; - -void setup() { - size(400, 400); - noStroke(); - - cp5 = new ControlP5(this); - - // create a slider - // parameters: - // name, minValue, maxValue, defaultValue, x, y, width, height - cp5.addSlider("sliderA", 100, 200, 100, 100, 260, 100, 14); - - - // create 3 numberboxes and assign an id for each - cp5.addNumberbox("numberboxA", myColorRect, 100, 140, 100, 14).setId(1); - cp5.addNumberbox("numberboxB", myColorBackground, 100, 180, 100, 14).setId(2); - cp5.addNumberbox("numberboxC", 0, 100, 220, 100, 14).setId(3); - - - // create a texfield - cp5.addTextfield("textA", 100, 290, 100, 20); - - // change individual settings for a controller - cp5.getController("numberboxA").setMax(255); - cp5.getController("numberboxA").setMin(0); -} - -void draw() { - background(myColorBackground); - fill(myColorRect); - rect(0, 0, width, 100); -} - - -// events from controller numberboxC are received here -public void numberboxC(int theValue) { - println("### got an event from numberboxC : "+theValue); -} - - -// an event from slider sliderA will change the value of textfield textA here -public void sliderA(int theValue) { - Textfield txt = ((Textfield)cp5.getController("textA")); - txt.setValue(""+theValue); -} - - -// for every change (a textfield event confirmed with a return) in textfield textA, -// function textA will be invoked -public void textA(String theValue) { - println("### got an event from textA : "+theValue); -} - - -// function controlEvent will be invoked with every value change -// in any registered controller -public void controlEvent(ControlEvent theEvent) { - println("got a control event from controller with id "+theEvent.getId()); - switch(theEvent.getId()) { - case(1): // numberboxA is registered with id 1 - myColorRect = (int)(theEvent.getController().getValue()); - break; - case(2): // numberboxB is registered with id 2 - myColorBackground = (int)(theEvent.getController().getValue()); - break; - } -} - diff --git a/Processing/libraries/controlP5/examples/use/ControlP5beginEnd/ControlP5beginEnd.pde b/Processing/libraries/controlP5/examples/use/ControlP5beginEnd/ControlP5beginEnd.pde deleted file mode 100644 index 954ddd2..0000000 --- a/Processing/libraries/controlP5/examples/use/ControlP5beginEnd/ControlP5beginEnd.pde +++ /dev/null @@ -1 +0,0 @@ -// TBD diff --git a/Processing/libraries/controlP5/examples/use/ControlP5behavior/ControlP5behavior.pde b/Processing/libraries/controlP5/examples/use/ControlP5behavior/ControlP5behavior.pde deleted file mode 100644 index 6f76b82..0000000 --- a/Processing/libraries/controlP5/examples/use/ControlP5behavior/ControlP5behavior.pde +++ /dev/null @@ -1,125 +0,0 @@ -/** - * ControlP5 Behavior - * ControlBehavior is an abstract class that can be extended using your - * custom control behaviors. What is a control behavior? Control Behaviors - * allow you to automate and dynamically change the state or value of a - * controller. One behavior per controller is currently supported. i case you - * need to use more that one bahavior, the implementation has to happen - * on your side - inside your control behavior. - * - * find a list of public methods available for the ControlBehavior Controller - * at the bottom of this sketch. - * - * by Andreas Schlegel, 2012 - * www.sojamo.de/libraries/controlp5 - * - */ - -import controlP5.*; - - -ControlP5 cp5; - -int myColorBackground = color(0, 0, 0); - -public int sliderValue = 100; - -void setup() { - size(400, 400); - noStroke(); - - cp5 = new ControlP5(this); - cp5.addSlider("sliderValue") - .setRange(0,255) - .setValue(128) - .setPosition(100, 50 + height/2) - .setSize(40, 100); - - cp5.addSlider("slider") - .setRange(100, 255) - .setValue(128) - .setPosition(100, 50) - .setSize(100, 40); - - - cp5.addBang("bang") - .setPosition(40, 50 + height/2) - .setSize(40, 40); - - // add a custom ControlBehavior to controller bang, - // class TimerEvent is included in this sketch at the bottom - // and extends abstract class ControlBehavior. - cp5.getController("bang").setBehavior(new TimedEvent()); - - // use an anonymous class of type ControlBehavior. - cp5.getController("slider").setBehavior(new ControlBehavior() { - float a = 0; - public void update() { - setValue(sin(a += 0.1) * 50 + 150); - } - } - ); -} - -void draw() { - background(myColorBackground); - fill(sliderValue); - rect(0, 0, width, height/2); -} - -void slider(float theColor) { - myColorBackground = color(theColor); - println("# a slider event. setting background to "+theColor); -} - -public void bang() { - println("# an event received from controller bang."); - // a bang will set the value of controller sliderValue - // to a random number between 0 and 255. - cp5.getController("sliderValue").setValue(random(0, 255)); -} - -// custom ControlBehavior -class TimedEvent extends ControlBehavior { - long myTime; - int interval = 200; - - public TimedEvent() { - reset(); - } - void reset() { - myTime = millis() + interval; - } - - public void update() { - if (millis()>myTime) { - setValue(1); - reset(); - } - } -} - - - - -/* -a list of all methods available for the ControlBehavior Controller -use ControlP5.printPublicMethodsFor(ControlBehavior.class); -to print the following list into the console. - -You can find further details about class ControlBehavior in the javadoc. - -Format: -ClassName : returnType methodName(parameter type) - - -controlP5.ControlBehavior : Controller controller() -controlP5.ControlBehavior : boolean isActive() -controlP5.ControlBehavior : void setActive(boolean) -controlP5.ControlBehavior : void setValue(float) -java.lang.Object : String toString() -java.lang.Object : boolean equals(Object) - - -*/ - diff --git a/Processing/libraries/controlP5/examples/use/ControlP5bringToFront/ControlP5bringToFront.pde b/Processing/libraries/controlP5/examples/use/ControlP5bringToFront/ControlP5bringToFront.pde deleted file mode 100644 index d777514..0000000 --- a/Processing/libraries/controlP5/examples/use/ControlP5bringToFront/ControlP5bringToFront.pde +++ /dev/null @@ -1,55 +0,0 @@ -import controlP5.*; - -ControlP5 cp5; - -void setup() { - size(700, 400); - - cp5 = new ControlP5(this); - - CallbackListener toFront = new CallbackListener() { - public void controlEvent(CallbackEvent theEvent) { - theEvent.getController().bringToFront(); - ((ScrollableList)theEvent.getController()).open(); - } - }; - - CallbackListener close = new CallbackListener() { - public void controlEvent(CallbackEvent theEvent) { - ((ScrollableList)theEvent.getController()).close(); - } - }; - - cp5.addScrollableList("myList1") - .setPosition(100, 100) - .addItems(new String[] {"a-1","b-1","c-1","d-1","e-1"}) - .onEnter(toFront) - .onLeave(close) - .setWidth(200) - .setItemHeight(20) - .setBarHeight(20) - .setBackgroundColor(color(128)) - .setHeight(100) - .close() - ; - - cp5.addScrollableList("myList2") - .setPosition(100, 125) - .addItems(new String[] {"a-2","b-2","c-2","d-2","e-2"}) - .onEnter(toFront) - .onLeave(close) - .setWidth(200) - .setItemHeight(20) - .setBarHeight(20) - .setBackgroundColor(color(128)) - .setHeight(100) - .setColor(ControlP5.THEME_RED) - .close() - ; -} - - - -void draw() { - background(220); -} diff --git a/Processing/libraries/controlP5/examples/use/ControlP5callback/ControlP5callback.pde b/Processing/libraries/controlP5/examples/use/ControlP5callback/ControlP5callback.pde deleted file mode 100644 index 216797c..0000000 --- a/Processing/libraries/controlP5/examples/use/ControlP5callback/ControlP5callback.pde +++ /dev/null @@ -1,178 +0,0 @@ -/** - * ControlP5 Callback - * - * The following example demonstrates the CallbackListener and CallbackEvent. - * Here additional information about each available slider will be show when - * hovering the controller with the mouse. The info will fade out when leaving - * the controller. - * - * When hovering a controller, the mouse pointer will change as well. - * - * find a list of public methods available for the CallbackEvent Controller - * at the bottom of this sketch. - * - * by Andreas Schlegel, 2012 - * www.sojamo.de/libraries/controlp5 - * - */ - -import controlP5.*; - -ControlP5 cp5; -Slider s1, s2; -Info info; -CallbackListener cb; - -void setup() { - size(800, 400); - - cp5 = new ControlP5(this); - - - // create a new instance of class Info - // info will be used to display a controller's information and - // will fade in when a CallbackEvent is invoked. - info = new Info(); - - - // add 2 sliders - s1 = cp5.addSlider("hello") - .setRange(0, 100) - .setValue(50) - .setPosition(40, 40) - .setSize(100, 20); - - s2 = cp5.addSlider("world") - .setRange(0, 100) - .setValue(10) - .setPosition(40, 70) - .setSize(100, 20); - - - // the following CallbackListener will listen to any controlP5 - // action such as enter, leave, pressed, released, releasedoutside, broadcast - // see static variables starting with ACTION_ inside class controlP5.ControlP5Constants - - cb = new CallbackListener() { - public void controlEvent(CallbackEvent theEvent) { - switch(theEvent.getAction()) { - case(ControlP5.ACTION_ENTER): - info.n = 1; - info.label.setText(theEvent.getController().getInfo()); - cursor(HAND); - break; - case(ControlP5.ACTION_LEAVE): - case(ControlP5.ACTION_RELEASEDOUTSIDE): - info.n = 0; - cursor(ARROW); - break; - } - } - }; - - // add the above callback to controlP5 - cp5.addCallback(cb); - - // add another callback to slider s1, callback event will only be invoked for this - // particular controller. - s1.addCallback(new CallbackListener() { - public void controlEvent(CallbackEvent theEvent) { - if (theEvent.getAction()==ControlP5.ACTION_BROADCAST) { - s2.setValue(s2.getMax() - s1.getValue()); - } - } - } - ); -} - -void draw() { - background(0); - info.update(); -} - - -void controlEvent(ControlEvent theEvent) { - println("Got a ControlEvent for "+theEvent.name()+" = "+theEvent.value()); - info.label.setText(theEvent.getController().getInfo()); -} - -void keyPressed() { - // uncomment the line below to remove callback cb from controlP5 - // when a key is pressed. - //controlP5.removeCallback(cb); -} - -// controlEvent(CallbackEvent) is called whenever a callback -// has been triggered. controlEvent(CallbackEvent) is detected by -// controlP5 automatically. -void controlEvent(CallbackEvent theEvent) { - if (theEvent.getController().equals(s2)) { - switch(theEvent.getAction()) { - case(ControlP5.ACTION_ENTER): - println("Action:ENTER"); - break; - case(ControlP5.ACTION_LEAVE): - println("Action:LEAVE"); - break; - case(ControlP5.ACTION_PRESSED): - println("Action:PRESSED"); - break; - case(ControlP5.ACTION_RELEASED): - println("Action:RELEASED"); - break; - case(ControlP5.ACTION_RELEASEDOUTSIDE): - println("Action:RELEASED OUTSIDE"); - break; - case(ControlP5.ACTION_BROADCAST): - println("Action:BROADCAST"); - break; - } - } -} - - - -class Info { - float a; - float n = 0; - String txt = ""; - Textarea label; - - Info() { - label = cp5.addTextarea("Hello\nWorld") - .setSize(200,200) - .setPosition(300,40) - .setColor(color(255)) - .setColorBackground(color(100,0)) - .setLineHeight(12); - - } - - void update() { - a += (n-a)*0.1; - label.setColorBackground(color(100,255*a)); - } -} - - -/* -a list of all methods available for the CallbackEvent Controller - use ControlP5.printPublicMethodsFor(CallbackEvent.class); - to print the following list into the console. - - You can find further details about class CallbackEvent in the javadoc. - - Format: - ClassName : returnType methodName(parameter type) - - - controlP5.CallbackEvent : Controller getController() - controlP5.CallbackEvent : int getAction() - java.lang.Object : String toString() - java.lang.Object : boolean equals(Object) - - - */ - - - diff --git a/Processing/libraries/controlP5/examples/use/ControlP5controlEvent/ControlP5controlEvent.pde b/Processing/libraries/controlP5/examples/use/ControlP5controlEvent/ControlP5controlEvent.pde deleted file mode 100644 index 5f7a909..0000000 --- a/Processing/libraries/controlP5/examples/use/ControlP5controlEvent/ControlP5controlEvent.pde +++ /dev/null @@ -1,119 +0,0 @@ -/** - * ControlP5 ControlEvent. - * every control event is automatically forwarded to the function controlEvent(ControlEvent) - * inside a sketch if such function is available. For further details about the API of - * the ControlEvent class, please refer to the documentation. - * - * - * find a list of public methods available for ControlEvent - * at the bottom of this sketch's source code - * - * by Andreas Schlegel, 2012 - * www.sojamo.de/libraries/controlP5 - * - */ - -import controlP5.*; - -ControlP5 cp5; - -public int myColorRect1 = 200; - -public int myColorRect2 = 100; - - -void setup() { - size(400, 400); - noStroke(); - - cp5 = new ControlP5(this); - cp5.addNumberbox("n1") - .setValue(myColorRect1) - .setPosition(20, 20) - .setSize(100, 20) - .setMin(0) - .setMax(255) - .setId(1); - - cp5.addNumberbox("n2") - .setValue(myColorRect2) - .setPosition(20, 60) - .setSize(100, 20) - .setMin(0) - .setMax(255) - .setId(2); - - cp5.addTextfield("n3") - .setPosition(20, 100) - .setSize(100, 20) - .setId(3); - -} - -void draw() { - background(ControlP5.MAROON); - fill(ControlP5.RED, myColorRect1); - rect(140, 20, 240, 170); - fill(ControlP5.FUCHSIA, myColorRect2); - rect(140, 210, 240, 170); -} - - -void controlEvent(ControlEvent theEvent) { - println("got a control event from controller with id "+theEvent.getController().getId()); - - if (theEvent.isFrom(cp5.getController("n1"))) { - println("this event was triggered by Controller n1"); - } - - switch(theEvent.getController().getId()) { - case(1): - myColorRect1 = (int)(theEvent.getController().getValue()); - break; - case(2): - myColorRect2 = (int)(theEvent.getController().getValue()); - break; - case(3): - println(theEvent.getController().getStringValue()); - break; - } -} - - -/* -a list of all methods available for the ControlEvent Controller -use ControlP5.printPublicMethodsFor(ControlEvent.class); -to print the following list into the console. - -You can find further details about class ControlEvent in the javadoc. - -Format: -ClassName : returnType methodName(parameter type) - - -controlP5.ControlEvent : ControlGroup getGroup() -controlP5.ControlEvent : Controller getController() -controlP5.ControlEvent : String getLabel() -controlP5.ControlEvent : String getName() -controlP5.ControlEvent : String getStringValue() -controlP5.ControlEvent : String toString() -controlP5.ControlEvent : Tab getTab() -controlP5.ControlEvent : boolean isAssignableFrom(Class) -controlP5.ControlEvent : boolean isController() -controlP5.ControlEvent : boolean isFrom(ControllerInterface) -controlP5.ControlEvent : boolean isFrom(String) -controlP5.ControlEvent : boolean isGroup() -controlP5.ControlEvent : boolean isTab() -controlP5.ControlEvent : float getArrayValue(int) -controlP5.ControlEvent : float getValue() -controlP5.ControlEvent : float[] getArrayValue() -controlP5.ControlEvent : int getId() -controlP5.ControlEvent : int getType() -java.lang.Object : String toString() -java.lang.Object : boolean equals(Object) - -created: 2015/03/24 12:22:35 - -*/ - - diff --git a/Processing/libraries/controlP5/examples/use/ControlP5controlFont/ControlP5controlFont.pde b/Processing/libraries/controlP5/examples/use/ControlP5controlFont/ControlP5controlFont.pde deleted file mode 100644 index 35df35c..0000000 --- a/Processing/libraries/controlP5/examples/use/ControlP5controlFont/ControlP5controlFont.pde +++ /dev/null @@ -1,134 +0,0 @@ -/** - * ControlP5 controlFont. - * - * this example shows how to create a button with controlP5 (1), how to - * load and use a PFont with controlP5 (2), apply a ControlFont to - * the caption label of a button (3), and adjust the location of a - * caption label using the style() property of a controller. - * - * by andreas schlegel, 2012 - */ -import controlP5.*; - -ControlP5 cp5; - -controlP5.Button b; - -int buttonValue = 1; - -boolean isOpen; - -int myColorBackground = color(0,0,0); - - -void setup() { - size(700,400); - smooth(); - - cp5 = new ControlP5(this); - // (1) - // create some controllers - cp5.addButton("button") - .setValue(10) - .setPosition(20,20) - .setSize(100,50) - .setId(1); - - b = cp5.addButton("buttonValue") - .setValue(4) - .setPosition(100,190) - .setSize(200,200) - .setId(2); - - // (2) - // load a new font. ControlFont is a wrapper for processing's PFont - // with processing 1.1 ControlFont.setSmooth() is not supported anymore. - // to display a font as smooth or non-smooth, use true/false as 3rd parameter - // when creating a PFont: - - PFont pfont = createFont("Arial",20,true); // use true/false for smooth/no-smooth - ControlFont font = new ControlFont(pfont,241); - - - - // (3) - // change the font and content of the captionlabels - // for both buttons create earlier. - cp5.getController("button") - .getCaptionLabel() - .setFont(font) - .toUpperCase(false) - .setSize(24) - ; - - b.getCaptionLabel() - .setFont(font) - .setSize(50) - .toUpperCase(false) - .setText("hello") - ; -// - // (4) - // adjust the location of a catiption label using the - // style property of a controller. - b.getCaptionLabel().getStyle().marginLeft = 20; - b.getCaptionLabel().getStyle().marginTop = 40; - -} - -void draw() { - background(ControlP5.SILVER); - // animate button b - float x = b.x(b.getPosition()); - x += ((isOpen==true ? 0:-200) - x) * 0.2;; - float y = b.y(b.getPosition()); - b.setPosition(x,y); -} - -public void controlEvent(ControlEvent theEvent) { - println(theEvent.getController().getId()); -} - -public void button(float theValue) { - println("a button event. "+theValue); - isOpen = !isOpen; - cp5.getController("button").setCaptionLabel((isOpen==true) ? "close":"open"); -} - - - -/* -a list of all methods available for the ControlFont Controller -use ControlP5.printPublicMethodsFor(ControlFont.class); -to print the following list into the console. - -You can find further details about class ControlFont in the javadoc. - -Format: -ClassName : returnType methodName(parameter type) - - -controlP5.ControlFont : PFont getFont() -controlP5.ControlFont : int getBaseline() -controlP5.ControlFont : int getBottom() -controlP5.ControlFont : int getCenter() -controlP5.ControlFont : int getHeight() -controlP5.ControlFont : int getOffset(int) -controlP5.ControlFont : int getOverflow() -controlP5.ControlFont : int getSize() -controlP5.ControlFont : int getTextHeight() -controlP5.ControlFont : int getTop() -controlP5.ControlFont : int getWidth() -controlP5.ControlFont : void adjust(PGraphics, Label) -controlP5.ControlFont : void draw(ControlP5, Label) -controlP5.ControlFont : void draw(PGraphics, Label) -controlP5.ControlFont : void init(Label) -controlP5.ControlFont : void setSize(int) -java.lang.Object : String toString() -java.lang.Object : boolean equals(Object) - -created: 2015/03/24 12:22:36 - -*/ - - diff --git a/Processing/libraries/controlP5/examples/use/ControlP5customView/ControlP5customView.pde b/Processing/libraries/controlP5/examples/use/ControlP5customView/ControlP5customView.pde deleted file mode 100644 index 4db2e6f..0000000 --- a/Processing/libraries/controlP5/examples/use/ControlP5customView/ControlP5customView.pde +++ /dev/null @@ -1,101 +0,0 @@ -/** -* ControlP5 Custom View -* -* -* find a list of public methods available for the ControllerDisplay Controller -* at the bottom of this sketch. -* -* by Andreas Schlegel, 2012 -* www.sojamo.de/libraries/controlp5 -* -*/ - - -import controlP5.*; - - -ControlP5 cp5; - - -void setup() { - size(400, 400); - smooth(); - cp5 = new ControlP5(this); - cp5.addButton("hello") - .setPosition(50, 100) - .setSize(150,150) - .setView(new CircularButton()) - ; - - cp5.addButton("world") - .setPosition(250, 100) - .setSize(50,50) - .setView(new CircularButton()) - ; -} - - -void draw() { - background(ControlP5.BLACK); -} - -public void hello(int theValue) { - println("Hello pressed"); -} - -public void world(int theValue) { - println("World pressed"); -} - -/** - * to define a custom View for a controller use the ContollerView interface - * T here must be replace by the name of the Controller class your custom View will be - * applied to. In our example T is replace by Button since we are aplpying the View - * to the Button instance create in setup. The ControllerView interface requires - * you to implement the display(PApplet, T) method. Same here, T must be replaced by - * the Controller class you are designing the custom view for, for us this is the - * Button class. - */ - -class CircularButton implements ControllerView