📄 initgui.c
字号:
programHelpMenu = newVMenu(HELP_X, HELP_Y, 0, 0, black, lgreen, white, green); attachCallBack(programHelpMenu, SDL_MOUSEBUTTONDOWN, (void *) &CloseHelpMenu); addButton(programHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE); addButton(programHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Program Button "), FALSE); addButton(programHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE); addButton(programHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Clicking the Program Button brings up a submenu in which "), FALSE); addButton(programHelpMenu, newButton(0, 0, 0, 0, 0, 0, " you select what you want to program into the PIC device. "), FALSE); addButton(programHelpMenu, newButton(0, 0, 0, 0, 0, 0, " You can select program space, data space, ID locations or "), FALSE); addButton(programHelpMenu, newButton(0, 0, 0, 0, 0, 0, " configuration bits. Selecting ID locations or configuration "), FALSE); addButton(programHelpMenu, newButton(0, 0, 0, 0, 0, 0, " bits will program the data currently displayed in the "), FALSE); addButton(programHelpMenu, newButton(0, 0, 0, 0, 0, 0, " status line above the main display. "), FALSE); addButton(programHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Choosing program or data space will program the PIC device "), FALSE); addButton(programHelpMenu, newButton(0, 0, 0, 0, 0, 0, " with the program or data memory currently displayed in the "), FALSE); addButton(programHelpMenu, newButton(0, 0, 0, 0, 0, 0, " main display window. The program or data memory may be read "), FALSE); addButton(programHelpMenu, newButton(0, 0, 0, 0, 0, 0, " from a file or from a PIC device in the PICSTART or Warp-13 "), FALSE); addButton(programHelpMenu, newButton(0, 0, 0, 0, 0, 0, " programmer. "), FALSE); addButton(programHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE); addButton(programHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Note that no sanity check is done on the configuration "), FALSE); addButton(programHelpMenu, newButton(0, 0, 0, 0, 0, 0, " value being programmed. If you enter an invalid value, the "), FALSE); addButton(programHelpMenu, newButton(0, 0, 0, 0, 0, 0, " programmer will not verify correctly. Check your documentation "), FALSE); addButton(programHelpMenu, newButton(0, 0, 0, 0, 0, 0, " for information on the configuration bits for the PIC device "), FALSE); addButton(programHelpMenu, newButton(0, 0, 0, 0, 0, 0, " in use. "), FALSE); addButton(programHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE); eraseHelpMenu = newVMenu(HELP_X, HELP_Y, 0, 0, black, lgreen, white, green); attachCallBack(eraseHelpMenu, SDL_MOUSEBUTTONDOWN, (void *) &CloseHelpMenu); addButton(eraseHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE); addButton(eraseHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Erase Button "), FALSE); addButton(eraseHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE); addButton(eraseHelpMenu, newButton(0, 0, 0, 0, 0, 0, " The Erase Button brings up a submenu in which you select a "), FALSE); addButton(eraseHelpMenu, newButton(0, 0, 0, 0, 0, 0, " region to erase. Select either program, data (for those "), FALSE); addButton(eraseHelpMenu, newButton(0, 0, 0, 0, 0, 0, " devices that have data memory), ID, or configuration bits. "), FALSE); addButton(eraseHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE); addButton(eraseHelpMenu, newButton(0, 0, 0, 0, 0, 0, " For those PIC devices that have flash memory, selecting "), FALSE); addButton(eraseHelpMenu, newButton(0, 0, 0, 0, 0, 0, " \"flash device\" will erase everything. "), FALSE); addButton(eraseHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE); verifyHelpMenu = newVMenu(HELP_X, HELP_Y, 0, 0, black, lgreen, white, green); attachCallBack(verifyHelpMenu, SDL_MOUSEBUTTONDOWN, (void *) &CloseHelpMenu); addButton(verifyHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE); addButton(verifyHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Verify Button "), FALSE); addButton(verifyHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE); addButton(verifyHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Verify functions will compare program memory, "), FALSE); addButton(verifyHelpMenu, newButton(0, 0, 0, 0, 0, 0, " configuration bits, ID locations, or data"), FALSE); addButton(verifyHelpMenu, newButton(0, 0, 0, 0, 0, 0, " memory with the currently displayed values "), FALSE); addButton(verifyHelpMenu, newButton(0, 0, 0, 0, 0, 0, " and report whether or not they match."), FALSE); addButton(verifyHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE); blankHelpMenu = newVMenu(HELP_X, HELP_Y, 0, 0, black, lgreen, white, green); attachCallBack(blankHelpMenu, SDL_MOUSEBUTTONDOWN, (void *) &CloseHelpMenu); addButton(blankHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE); addButton(blankHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Blank Check Button "), FALSE); addButton(blankHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE); addButton(blankHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Blank checks the PIC device and reports the "), FALSE); addButton(blankHelpMenu, newButton(0, 0, 0, 0, 0, 0, " results for program memory, configuration "), FALSE); addButton(blankHelpMenu, newButton(0, 0, 0, 0, 0, 0, " bits, ID locations, and data memory."), FALSE); addButton(blankHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE); configBitsHelpMenu = newVMenu(HELP_X, HELP_Y, 0, 0, black, lgreen, white, green); attachCallBack(configBitsHelpMenu, SDL_MOUSEBUTTONDOWN, (void *) &CloseHelpMenu); addButton(configBitsHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE); addButton(configBitsHelpMenu, newButton(0, 0, 0, 0, 0, 0, " To modify the configuration bits, click the mouse "), FALSE); addButton(configBitsHelpMenu, newButton(0, 0, 0, 0, 0, 0, " on the configuration bits display just above the "), FALSE); addButton(configBitsHelpMenu, newButton(0, 0, 0, 0, 0, 0, " main program display window, or click on the Edit "), FALSE); addButton(configBitsHelpMenu, newButton(0, 0, 0, 0, 0, 0, " cfg bits button. A dialog box will appear in which "), FALSE); addButton(configBitsHelpMenu, newButton(0, 0, 0, 0, 0, 0, " you can edit the configuration bits. "), FALSE); addButton(configBitsHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE); addButton(configBitsHelpMenu, newButton(0, 0, 0, 0, 0, 0, " To program the modified configuration bits, click "), FALSE); addButton(configBitsHelpMenu, newButton(0, 0, 0, 0, 0, 0, " on the Program Button in the main menu and select "), FALSE); addButton(configBitsHelpMenu, newButton(0, 0, 0, 0, 0, 0, " configuration. "), FALSE); addButton(configBitsHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE); IdHelpMenu = newVMenu(HELP_X, HELP_Y, 0, 0, black, lgreen, white, green); attachCallBack(IdHelpMenu, SDL_MOUSEBUTTONDOWN, (void *) &CloseHelpMenu); addButton(IdHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE); addButton(IdHelpMenu, newButton(0, 0, 0, 0, 0, 0, " To modify the PIC device ID locations, click the mouse on "), FALSE); addButton(IdHelpMenu, newButton(0, 0, 0, 0, 0, 0, " the ID display just above the main program display window "), FALSE); addButton(IdHelpMenu, newButton(0, 0, 0, 0, 0, 0, " or click on the Edit ID button. A dialog box will appear in "), FALSE); addButton(IdHelpMenu, newButton(0, 0, 0, 0, 0, 0, " which you can edit the ID data. "), FALSE); addButton(IdHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE); addButton(IdHelpMenu, newButton(0, 0, 0, 0, 0, 0, " To program the modified ID, click on the Program Button in "), FALSE); addButton(IdHelpMenu, newButton(0, 0, 0, 0, 0, 0, " the main menu and select ID. "), FALSE); addButton(IdHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE); DisasmHelpMenu = newVMenu(HELP_X, HELP_Y, 0, 0, black, lgreen, white, green); attachCallBack(DisasmHelpMenu, SDL_MOUSEBUTTONDOWN, (void *) &CloseHelpMenu); addButton(DisasmHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE); addButton(DisasmHelpMenu, newButton(0, 0, 0, 0, 0, 0, " If you have gpdasm installed (http://gputils.sourceforge.net), "), FALSE); addButton(DisasmHelpMenu, newButton(0, 0, 0, 0, 0, 0, " clicking the Disasm Button will bring up a separate window in "), FALSE); addButton(DisasmHelpMenu, newButton(0, 0, 0, 0, 0, 0, " which a disassembly of the current program memory will be "), FALSE); addButton(DisasmHelpMenu, newButton(0, 0, 0, 0, 0, 0, " displayed. Move through the listing using the scroll bar to "), FALSE); addButton(DisasmHelpMenu, newButton(0, 0, 0, 0, 0, 0, " the right of the display. "), FALSE); addButton(DisasmHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE); addButton(DisasmHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Note: If you change the PIC device type, you will need to "), FALSE); addButton(DisasmHelpMenu, newButton(0, 0, 0, 0, 0, 0, " reopen your PIC hex file, or re-read the program from the "), FALSE); addButton(DisasmHelpMenu, newButton(0, 0, 0, 0, 0, 0, " PICSTART or Warp-13 for the disassembly to work properly."), FALSE); addButton(DisasmHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE); addButton(DisasmHelpMenu, newButton(0, 0, 0, 0, 0, 0, " The disassembly shown is for the data in program memory at "), FALSE); addButton(DisasmHelpMenu, newButton(0, 0, 0, 0, 0, 0, " time the disassembly window was opened. If you change the "), FALSE); addButton(DisasmHelpMenu, newButton(0, 0, 0, 0, 0, 0, " data by reloading from a file or from the programmer, you "), FALSE); addButton(DisasmHelpMenu, newButton(0, 0, 0, 0, 0, 0, " will need to close the disassembly window and then click "), FALSE); addButton(DisasmHelpMenu, newButton(0, 0, 0, 0, 0, 0, " the Disasm Button again."), FALSE); addButton(DisasmHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE); DisplayHelpMenu = newVMenu(HELP_X, HELP_Y, 0, 0, black, lgreen, white, green); attachCallBack(DisplayHelpMenu, SDL_MOUSEBUTTONDOWN, (void *) &CloseHelpMenu); addButton(DisplayHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE); addButton(DisplayHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Clicking on the title bar for the memory window display "), FALSE); addButton(DisplayHelpMenu, newButton(0, 0, 0, 0, 0, 0, " will toggle between the program memory and data memory "), FALSE); addButton(DisplayHelpMenu, newButton(0, 0, 0, 0, 0, 0, " displays (if the currently selected device has data memory). "), FALSE); addButton(DisplayHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE); addButton(DisplayHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Reading program memory or data memory from the read menu "), FALSE); addButton(DisplayHelpMenu, newButton(0, 0, 0, 0, 0, 0, " will automatically switch to the correct display mode. "), FALSE); addButton(DisplayHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE); aboutMenu = newVMenu(74, 22, 0, 0, black, lcyan, lgray, gray); btn = newButton(0, 0, 0, 0, 0, 0, " "); attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &aboutMenuCB); addButton(aboutMenu, btn, FALSE); btn = newButton(0, 0, 0, 0, 0, 0, " GPICP Programmer Interface for"); attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &aboutMenuCB); addButton(aboutMenu, btn, FALSE); btn = newButton(0, 0, 0, 0, 0, 0, " Picstart Plus and Warp-13 programmers"); attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &aboutMenuCB); addButton(aboutMenu, btn, FALSE); btn = newButton(0, 0, 0, 0, 0, 0, " "); attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &aboutMenuCB); addButton(aboutMenu, btn, FALSE); sprintf(versionString, " Version %d.%d.%d", VERSION, MAJORREV, MINORREV); btn = newButton(0, 0, 0, 0, 0, 0, versionString); attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &aboutMenuCB); addButton(aboutMenu, btn, FALSE); btn = newButton(0, 0, 0, 0, 0, 0, " "); attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &aboutMenuCB); addButton(aboutMenu, btn, FALSE); btn = newButton(0, 0, 0, 0, 0, 0, " picp (c) by Andrew Pines and Jeffery L. Post, "); attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &aboutMenuCB); addButton(aboutMenu, btn, FALSE); btn = newButton(0, 0, 0, 0, 0, 0, " released under the GNU General Public License."); attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &aboutMenuCB); addButton(aboutMenu, btn, FALSE); btn = newButton(0, 0, 0, 0, 0, 0, " "); attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &aboutMenuCB); addButton(aboutMenu, btn, FALSE); btn = newButton(0, 0, 0, 0, 0, 0, " GUI interface (c) by Jeffery L. Post, "); attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &aboutMenuCB); addButton(aboutMenu, btn, FALSE); btn = newButton(0, 0, 0, 0, 0, 0, " released under the GNU General Public License."); attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &aboutMenuCB); addButton(aboutMenu, btn, FALSE); btn = newButton(0, 0, 0, 0, 0, 0, " "); attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &aboutMenuCB); addButton(aboutMenu, btn, FALSE); btn = newButton(0, 0, 0, 0, 0, 0, " Gpdasm (c) by Craig Franklin (gputils.sourceforge.net), "); attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &aboutMenuCB); addButton(aboutMenu, btn, FALSE); btn = newButton(0, 0, 0, 0, 0, 0, " released under the GNU General Public License."); attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &aboutMenuCB); addButton(aboutMenu, btn, FALSE); btn = newButton(0, 0, 0, 0, 0, 0, " "); attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &aboutMenuCB); addButton(aboutMenu, btn, FALSE); btn = newButton(0, 0, 0, 0, 0, 0, " SDL (Simple DirectMedia Layer) (www.libsdl.org) "); attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &aboutMenuCB); addButton(aboutMenu, btn, FALSE); btn = newButton(0, 0, 0, 0, 0, 0, " (c) by Sam Lantinga, released under the GNU"); attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &aboutMenuCB); addButton(aboutMenu, btn, FALSE); btn = newButton(0, 0, 0, 0, 0, 0, " Library General Public License."); attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &aboutMenuCB); addButton(aboutMenu, btn, FALSE); btn = newButton(0, 0, 0, 0, 0, 0, " "); attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &aboutMenuCB); addButton(aboutMenu, btn, FALSE); blankCheckResultWin = newNoticeBox(140, 40, noticeMessage); blankCheckResultWin->h = 8 * FONT_HEIGHT; attachCallBack(blankCheckResultWin, SDL_MOUSEBUTTONDOWN, (void *) &NoticeCB); verifyResultWin = newNoticeBox(100, 40, noticeMessage); verifyResultWin->h = 4 * FONT_HEIGHT; attachCallBack(verifyResultWin, SDL_MOUSEBUTTONDOWN, (void *) &NoticeCB); fileErrorAlert = newAlertBox(20, 20, " File Error! "); attachCallBack(fileErrorAlert, SDL_MOUSEBUTTONDOWN, (void *) &AlertCB); confirmAlert = newAlertBox(50, 50, " Proceed with programming? "); attachCallBack(confirmAlert, SDL_MOUSEBUTTONDOWN, (void *) &AlertCB); confirmEraseAlert = newAlertBox(50, 50, " Proceed with erase? "); attachCallBack(confirmEraseAlert, SDL_MOUSEBUTTONDOWN, (void *) &AlertCB); connectAlert = newAlertBox(150, 50, " PICSTART not enabled! "); attachCallBack(connectAlert, SDL_MOUSEBUTTONDOWN, (void *) &AlertCB); errorAlert = newAlertBox(150, 80, alertMessage); errorAlert->w = 35 * FONT_WIDTH; errorAlert->h = 4 * FONT_HEIGHT; attachCallBack(errorAlert, SDL_MOUSEBUTTONDOWN, (void *) &AlertCB); attachCallBack(errorAlert, SDL_KEYDOWN, (void *) &AlertCB); selectedPicDevice = NULL; setSelectedDevice(deviceType); picProgramPC = 0; picDataPC = 0; disVSlider->offset = 0; disVSlider->position = 0; disVSlider->pc = 0; showProgram(); showWidget(statusMenu2); showWidget(statusMenu3); showWidget(outputWin);}// end of initgui.c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -