├── EuGTK ├── GtkEngine.e ├── GtkEnums.e ├── GtkEvents.e ├── GtkPrinter.e ├── README.txt └── license.txt ├── LICENSE ├── README.md ├── manifest.ex ├── manifest.json ├── mongoose-wee.ico ├── parser.e ├── scintilla.e ├── scintilla ├── License.txt ├── SciLexer.dll ├── SciLexer64.dll ├── gtk_makefile ├── scintilla32.so ├── scintilla32armhf.so ├── scintilla64.so └── scintillaOSX.dylib ├── ui_gtk.e ├── ui_win.e ├── updater.ex ├── wee.exw ├── wee.ico ├── weeicon.e └── window.ew /EuGTK/GtkEnums.e: -------------------------------------------------------------------------------- 1 | ---------------- 2 | namespace enums 3 | ---------------- 4 | export constant version = "4.9.4" 5 | 6 | public include std/io.e 7 | public include std/os.e 8 | public include std/dll.e 9 | public include std/text.e 10 | public include std/math.e 11 | public include std/error.e 12 | public include std/types.e 13 | public include std/search.e 14 | public include std/convert.e 15 | public include std/console.e 16 | public include std/filesys.e 17 | public include std/machine.e 18 | public include std/sequence.e 19 | public include std/serialize.e 20 | 21 | public constant LGPL = read_file(canonical_path("~/demos/license.txt")) 22 | 23 | --------------------------------------------------------------------------------- 24 | -- ListView/TreeView storage types. Use these when creating new 25 | -- GtkListStores or GtkTreeStores 26 | --------------------------------------------------------------------------------- 27 | public enum 28 | gCHAR = 12, gUCHAR = 16, gINT = 24, gUINT = 28, 29 | gLONG = 32, gULONG = 36, gINT64 = 40, gUINT64 = 44, 30 | gDBL = 60, gFLT = 56, 31 | gSTR = 64, gPTR = 68, gBOOL= 20 32 | -- plus gPIX and gCOMBO, which must be defined at run-time 33 | -- by GtkEngine.e ... don't ask me why! 34 | 35 | -- here's a list of GObject types; 36 | public enum type OBJECT by 4 37 | void = 4, 38 | GInterface, 39 | gchar, 40 | guchar, 41 | gboolean, 42 | gint, 43 | guint, 44 | glong, 45 | gulong, 46 | gint64, 47 | guint64, 48 | GEnum, 49 | GFlags, 50 | gfloat, 51 | gdouble, 52 | gchararray, 53 | gpointer, 54 | GBoxed, 55 | GParam 56 | end type 57 | 58 | ------------------------------------------------------------------------ 59 | -- These are the widget names used to create GTK widgets; 60 | -- GObject MUST be first on the list. 61 | -- Other than that, order is unimportant, but try to keep 'em in 62 | -- alphabetical order just to be neat. 63 | ------------------------------------------------------------------------ 64 | public enum type WIDGET 65 | GObject, 66 | GActionGroup, 67 | GAppInfo, 68 | GEmblem, 69 | GEmblemedIcon, 70 | GFile, 71 | GFileIcon, 72 | GIcon, 73 | GIdle, 74 | GList, 75 | GMenu, 76 | GMenuItem, 77 | GMenuModel, 78 | GSList, 79 | GThemedIcon, 80 | GTimeout, 81 | Cairo_t, 82 | CairoFontOptions, 83 | CairoContent_t, 84 | CairoLinearGradient, 85 | CairoPattern, 86 | CairoPattern_t, 87 | CairoRadialGradient, 88 | CairoRegion_t, 89 | CairoImageSurface, 90 | CairoStatus_t, 91 | CairoSurface_t, 92 | CairoSurfaceType_t, 93 | GdkCairo_t, 94 | GdkCursor, 95 | GdkDevice, 96 | GdkDeviceManager, 97 | GdkDisplay, 98 | GdkEvent, 99 | GdkEventSequence, 100 | GdkFrameClock, 101 | GdkFrameTimings, 102 | GdkGLContext, 103 | GdkGLProfile, 104 | GdkKeymap, 105 | GdkKeyval, 106 | GdkPixbuf, 107 | GdkPixbufAnimation, 108 | GdkPixbufAnimationIter, 109 | GdkScreen, 110 | GdkVisual, 111 | GdkWindow, 112 | GdkX11Display, 113 | GdkX11Screen, 114 | GdkX11Window, 115 | GtkAboutDialog, 116 | GtkAccelGroup, 117 | GtkAccelLabel, 118 | GtkAccessible, 119 | GtkActionable, 120 | GtkActionBar, 121 | GtkActivatable, 122 | GtkAdjustment, 123 | GtkAlignment, 124 | GtkAppChooser, 125 | GtkAppChooserButton, 126 | GtkAppChooserDialog, 127 | GtkAppChooserWidget, 128 | GtkAppLaunchContext, 129 | GtkApplication, 130 | GtkApplicationWindow, 131 | GtkArrow, 132 | GtkAspectFrame, 133 | GtkAssistant, 134 | GtkBin, 135 | GtkBindingEntry, 136 | GtkBindingSet, 137 | GtkBox, 138 | GtkBuildable, 139 | GtkBuilder, 140 | GtkButton, 141 | GtkButtonBox, 142 | GtkCalendar, 143 | GtkCellArea, 144 | GtkCellAreaBox, 145 | GtkCellAreaCell, 146 | GtkCellAreaContext, 147 | GtkCellEditable, 148 | GtkCellLayout, 149 | GtkCellRenderer, 150 | GtkCellRendererAccel, 151 | GtkCellRendererCombo, 152 | GtkCellRendererPixbuf, 153 | GtkCellRendererProgress, 154 | GtkCellRendererSpin, 155 | GtkCellRendererSpinner, 156 | GtkCellRendererText, 157 | GtkCellRendererToggle, 158 | GtkCellView, 159 | GtkCheckButton, 160 | GtkCheckMenuItem, 161 | GtkClipboard, 162 | GtkColorButton, 163 | GtkColorChooser, 164 | GtkColorChooserDialog, 165 | GtkColorChooserWidget, 166 | GtkColorSelection, 167 | GtkColorSelectionDialog, 168 | GtkComboBox, 169 | GtkComboBoxEntry, 170 | GtkComboBoxText, 171 | GtkContainer, 172 | GtkCssProvider, 173 | GtkCssSection, 174 | GtkDialog, 175 | GtkDrag, 176 | GtkDrawingArea, 177 | GtkEditable, 178 | GtkEntry, 179 | GtkEntryBuffer, 180 | GtkEntryCompletion, 181 | GtkEventBox, 182 | GtkEventController, 183 | GtkExpander, 184 | GtkFileChooser, 185 | GtkFileChooserButton, 186 | GtkFileChooserDialog, 187 | GtkFileChooserWidget, 188 | GtkFileFilter, 189 | GtkFixed, 190 | GtkFlowBox, 191 | GtkFlowBoxChild, 192 | GtkFontButton, 193 | GtkFontChooser, 194 | GtkFontChooserDialog, 195 | GtkFontChooserWidget, 196 | GtkFrame, 197 | GtkGesture, 198 | GtkGestureSingle, 199 | GtkGestureDrag, 200 | GtkGestureLongPress, 201 | GtkGestureMultiPress, 202 | GtkGesturePan, 203 | GtkGestureRotate, 204 | GtkGestureSwipe, 205 | GtkGestureZoom, 206 | GtkGLArea, 207 | GtkGrid, 208 | GtkHeaderBar, 209 | GtkIconInfo, 210 | GtkIconTheme, 211 | GtkIconView, 212 | GtkImage, 213 | GtkImageMenuItem, 214 | GtkInfoBar, 215 | GtkInvisible, 216 | GtkLabel, 217 | GtkLayout, 218 | GtkLevelBar, 219 | GtkLinkButton, 220 | GtkListBox, 221 | GtkListBoxRow, 222 | GtkListStore, 223 | GtkLockButton, 224 | GtkMenu, 225 | GtkMenuBar, 226 | GtkMenuButton, 227 | GtkMenuItem, 228 | GtkMenuShell, 229 | GtkMenuToolButton, 230 | GtkMessageDialog, 231 | GtkMisc, 232 | GtkModelButton, 233 | GtkMountOperation, 234 | GtkNotebook, 235 | GtkNumerableIcon, 236 | GtkOffscreenWindow, 237 | GtkOrientable, 238 | GtkOverlay, 239 | GtkPaperSize, 240 | GtkPageRange, 241 | GtkPageSetup, 242 | GtkPageSetupUnixDialog, 243 | GtkPaned, 244 | GtkPlacesSidebar, 245 | GtkPlug, 246 | GtkPopover, 247 | GtkPopoverMenu, 248 | GtkPrinter, 249 | GtkPrintContext, 250 | GtkPrintJob, 251 | GtkPrintSettings, 252 | GtkPrintOperation, 253 | GtkPrintOperationPreview, 254 | GtkPrintUnixDialog, 255 | GtkProgressBar, 256 | GtkRadioButton, 257 | GtkRadioMenuItem, 258 | GtkRadioToolButton, 259 | GtkRange, 260 | GtkRcStyle, 261 | GtkRecentChooser, 262 | GtkRecentChooserDialog, 263 | GtkRecentChooserMenu, 264 | GtkRecentChooserWidget, 265 | GtkRecentFilter, 266 | GtkRecentInfo, 267 | GtkRevealer, 268 | GtkScale, 269 | GtkScaleButton, 270 | GtkScrollable, 271 | GtkScrollbar, 272 | GtkScrolledWindow, 273 | GtkSearchBar, 274 | GtkSearchEntry, 275 | GtkSelectionData, 276 | GtkSeparator, 277 | GtkSeparatorMenuItem, 278 | GtkSeparatorToolItem, 279 | GtkSettings, 280 | GtkSocket, 281 | GtkSidebar, 282 | GtkSizeGroup, 283 | GtkSpinButton, 284 | GtkSpinner, 285 | GtkStack, 286 | GtkStackSidebar, 287 | GtkStackSwitcher, 288 | GtkStatusbar, 289 | GtkStatusIcon, 290 | GtkStock, 291 | GtkStockList, 292 | GtkStyle, 293 | GtkStyleContext, 294 | GtkStyleProvider, 295 | GtkSwitch, 296 | GtkTargetEntry, 297 | GtkTargetList, 298 | GtkTextAttributes, 299 | GtkTextBuffer, 300 | GtkTextChildAnchor, 301 | GtkTextMark, 302 | GtkTextTag, 303 | GtkTextTagTable, 304 | GtkTextView, 305 | GtkThemedIcon, 306 | GtkToggleButton, 307 | GtkToggleToolButton, 308 | GtkToolbar, 309 | GtkToolButton, 310 | GtkToolItem, 311 | GtkToolItemGroup, 312 | GtkToolPalette, 313 | GtkToolShell, 314 | GtkTooltip, 315 | GtkTreeDragDest, 316 | GtkTreeDragSource, 317 | GtkTreeIter, 318 | GtkTreeModel, 319 | GtkTreeModelFilter, 320 | GtkTreeModelSort, 321 | GtkTreePath, 322 | GtkTreeRowReference, 323 | GtkTreeSelection, 324 | GtkTreeSortable, 325 | GtkTreeStore, 326 | GtkTreeView, 327 | GtkTreeViewColumn, 328 | GtkViewport, 329 | GtkVolumeButton, 330 | GtkWidget, 331 | GtkWidgetPath, 332 | GtkWindow, 333 | GtkWindowGroup, 334 | PangoCairoLayout, 335 | PangoContext, 336 | PangoFont, 337 | PangoFontSet, 338 | PangoFontsetSimple, 339 | PangoFontDescription, 340 | PangoFontFace, 341 | PangoFontFamily, 342 | PangoFontMap, 343 | PangoLanguage, 344 | PangoLayout, 345 | PangoLayoutIter, 346 | PangoLayoutLine, 347 | PangoLayoutRun, 348 | PangoTabArray 349 | end type 350 | 351 | global integer GtkFinal = PangoTabArray + 1 352 | 353 | ------------------------------------------------------------------------ 354 | 355 | public enum -- Response codes returned by button presses, etc; 356 | MB_YES = -8, 357 | MB_NO = -9, 358 | MB_OK = -5, 359 | MB_CANCEL = -6, 360 | MB_CLOSE = -7, 361 | MB_ABORT = -4, 362 | MB_NONE = -1, 363 | MB_REJECT = -2, 364 | MB_ACCEPT = -3, 365 | MB_APPLY = -10, 366 | MB_HELP = -11 367 | 368 | public enum -- Orientation: 369 | VERTICAL = 1, HORIZONTAL = 0 370 | 371 | public enum -- Sort Order: 372 | UNSORTED = -1, ASCENDING = 1, DESCENDING = 2 373 | 374 | public enum by 2 -- Cursors: 375 | GDK_X_CURSOR = 0, 376 | GDK_ARROW, 377 | GDK_BASED_ARROW_DOWN, 378 | GDK_BASED_ARROW_UP, 379 | GDK_BOAT, 380 | GDK_BOGOSITY, 381 | GDK_BOTTOM_LEFT_CORNER, 382 | GDK_BOTTOM_RIGHT_CORNER, 383 | GDK_BOTTOM_SIDE, 384 | GDK_BOTTOM_TEE, 385 | GDK_BOX_SPIRAL, 386 | GDK_CENTER_PTR, 387 | GDK_CIRCLE, 388 | GDK_CLOCK, 389 | GDK_COFFEE_MUG, 390 | GDK_CROSS, 391 | GDK_CROSS_REVERSE, 392 | GDK_CROSSHAIR, 393 | GDK_DIAMOND_CROSS, 394 | GDK_DOT, 395 | GDK_DOTBOX, 396 | GDK_DOUBLE_ARROW, 397 | GDK_DRAFT_LARGE, 398 | GDK_DRAFT_SMALL, 399 | GDK_DRAPED_BOX, 400 | GDK_EXCHANGE, 401 | GDK_FLEUR, 402 | GDK_GOBBLER, 403 | GDK_GUMBY, 404 | GDK_HAND1, 405 | GDK_HAND2, 406 | GDK_HEART, 407 | GDK_ICON, 408 | GDK_IRON_CROSS, 409 | GDK_LEFT_PTR, 410 | GDK_LEFT_SIDE, 411 | GDK_LEFT_TEE, 412 | GDK_LEFTBUTTON, 413 | GDK_LL_ANGLE, 414 | GDK_LR_ANGLE, 415 | GDK_MAN, 416 | GDK_MIDDLEBUTTON, 417 | GDK_MOUSE, 418 | GDK_PENCIL, 419 | GDK_PIRATE, 420 | GDK_PLUS, 421 | GDK_QUESTION_ARROW, 422 | GDK_RIGHT_PTR, 423 | GDK_RIGHT_SIDE, 424 | GDK_RIGHT_TEE, 425 | GDK_RIGHTBUTTON, 426 | GDK_RTL_LOGO, 427 | GDK_SAILBOAT, 428 | GDK_SB_DOWN_ARROW, 429 | GDK_SB_H_DOUBLE_ARROW, 430 | GDK_SB_LEFT_ARROW, 431 | GDK_SB_RIGHT_ARROW, 432 | GDK_SB_UP_ARROW, 433 | GDK_SB_V_DOUBLE_ARROW, 434 | GDK_SHUTTLE, 435 | GDK_SIZING, 436 | GDK_SPIDER, 437 | GDK_SPRAYCAN, 438 | GDK_STAR, 439 | GDK_TARGET, 440 | GDK_TCROSS, 441 | GDK_TOP_LEFT_ARROW, 442 | GDK_TOP_LEFT_CORNER, 443 | GDK_TOP_RIGHT_CORNER, 444 | GDK_TOP_SIDE, 445 | GDK_TOP_TEE, 446 | GDK_TREK, 447 | GDK_UL_ANGLE, 448 | GDK_UMBRELLA, 449 | GDK_UR_ANGLE, 450 | GDK_WATCH, 451 | GDK_XTERM, 452 | GDK_LAST_CURSOR = 153, 453 | GDK_BLANK_CURSOR = -2, 454 | GDK_CURSOR_IS_PIXMAP = -1 455 | 456 | public enum 457 | 458 | GTK_LICENSE_UNKNOWN = 0, 459 | GTK_LICENSE_CUSTOM, 460 | GTK_LICENSE_GPL_2_0, 461 | GTK_LICENSE_GPL_3_0, 462 | GTK_LICENSE_LGPL_2_1, 463 | GTK_LICENSE_LGPL_3_0, 464 | GTK_LICENSE_BSD, 465 | GTK_LICENSE_MIT_X11, 466 | GTK_LICENSE_ARTISTIC, 467 | 468 | GTK_ACCEL_VISIBLE = 1, 469 | GTK_ACCEL_LOCKED = 2, 470 | GTK_ACCEL_MASK = 7, 471 | 472 | GTK_ALIGN_FILL = 0, 473 | GTK_ALIGN_START, 474 | GTK_ALIGN_END, 475 | GTK_ALIGN_CENTER, 476 | 477 | GTK_ANCHOR_CENTER = 0, 478 | GTK_ANCHOR_NORTH, 479 | GTK_ANCHOR_NORTH_WEST, 480 | GTK_ANCHOR_NORTH_EAST, 481 | GTK_ANCHOR_SOUTH, 482 | GTK_ANCHOR_SOUTH_WEST, 483 | GTK_ANCHOR_SOUTH_EAST, 484 | GTK_ANCHOR_WEST, 485 | GTK_ANCHOR_EAST, 486 | GTK_ANCHOR_N = 1, 487 | GTK_ANCHOR_NW, 488 | GTK_ANCHOR_NE, 489 | GTK_ANCHOR_S, 490 | GTK_ANCHOR_SW, 491 | GTK_ANCHOR_SE, 492 | GTK_ANCHOR_W, 493 | GTK_ANCHOR_E, 494 | 495 | GTK_APPLICATION_INHIBIT_LOGOUT = 1, 496 | GTK_APPLICATION_INHIBIT_SWITCH = 2, 497 | GTK_APPLICATION_INHIBIT_SUSPEND = 4, 498 | GTK_APPLICATION_INHIBIT_IDLE = 8, 499 | 500 | G_APPLICATION_FLAGS_NONE = 0, 501 | G_APPLICATION_IS_SERVICE, 502 | G_APPLICATION_IS_LAUNCHER, 503 | G_APPLICATION_HANDLES_OPEN = 4, 504 | G_APPLICATION_HANDLES_COMMAND_LINE = 8, 505 | G_APPLICATION_SEND_ENVIRONMENT = 16, 506 | G_APPLICATION_NON_UNIQUE = 32, 507 | 508 | -- arrows are deprecated 509 | GTK_ARROWS_BOTH = 0, 510 | GTK_ARROWS_START, 511 | GTK_ARROWS_END, 512 | 513 | GTK_ARROW_UP = 0, 514 | GTK_ARROW_DOWN, 515 | GTK_ARROW_LEFT, 516 | GTK_ARROW_RIGHT, 517 | GTK_ARROW_NONE, 518 | 519 | GTK_ASSISTANT_PAGE_CONTENT = 0, 520 | GTK_ASSISTANT_PAGE_INTRO, 521 | GTK_ASSISTANT_PAGE_CONFIRM, 522 | GTK_ASSISTANT_PAGE_SUMMARY, 523 | GTK_ASSISTANT_PAGE_PROGRESS, 524 | GTK_ASSISTANT_PAGE_CUSTOM, 525 | 526 | GTK_EXPAND = 1, 527 | GTK_SHRINK = 2, 528 | GTK_FILL = 4, 529 | 530 | GTK_BASELINE_POSITION_TOP = 0, 531 | GTK_BASELINE_POSITION_CENTER, 532 | GTK_BASELINE_POSITION_BOTTOM, 533 | 534 | GTK_BORDER_STYLE_NONE = 0, 535 | GTK_BORDER_STYLE_SOLID, 536 | GTK_BORDER_STYLE_INSET, 537 | GTK_BORDER_STYLE_OUTSET, 538 | GTK_BORDER_STYLE_HIDDEN, 539 | GTK_BORDER_STYLE_DOTTED, 540 | GTK_BORDER_STYLE_DASHED, 541 | GTK_BORDER_STYLE_DOUBLE, 542 | GTK_BORDER_STYLE_GROOVE, 543 | GTK_BORDER_STYLE_RIDGE, 544 | 545 | GTK_BUTTON_ROLE_NORMAL = 0, 546 | GTK_BUTTON_ROLE_CHECK, 547 | GTK_BUTTON_ROLE_RADIO, 548 | 549 | GTK_BUTTONS_NONE = 0, 550 | GTK_BUTTONS_OK, 551 | GTK_BUTTONS_CLOSE, 552 | GTK_BUTTONS_CANCEL, 553 | GTK_BUTTONS_YES_NO, 554 | GTK_BUTTONS_OK_CANCEL, 555 | 556 | GTK_BUTTONBOX_DEFAULT_STYLE = 0, 557 | GTK_BUTTONBOX_SPREAD, 558 | GTK_BUTTONBOX_EDGE, 559 | GTK_BUTTONBOX_START, 560 | GTK_BUTTONBOX_END, 561 | GTK_BUTTONBOX_CENTER, 562 | GTK_BUTTONBOX_EXPAND, 563 | 564 | GTK_CALENDAR_SHOW_HEADING = 1, 565 | GTK_CALENDAR_SHOW_DAY_NAMES = 2, 566 | GTK_CALENDAR_NO_MONTH_CHANGE = 4, 567 | GTK_CALENDAR_SHOW_WEEK_NUMBERS = 8, 568 | GTK_CALENDAR_SHOW_DETAILS = 16, 569 | 570 | GTK_CORNER_TOP_LEFT = 0, 571 | GTK_CORNER_BOTTOM_LEFT, 572 | GTK_CORNER_TOP_RIGHT, 573 | GTK_CORNER_BOTTOM_RIGHT, 574 | 575 | GTK_CURVE_TYPE_LINEAR = 0, 576 | GTK_CURVE_TYPE_SPLINE, 577 | GTK_CURVE_TYPE_FREE, 578 | 579 | GTK_DELETE_CHARS = 0, 580 | GTK_DELETE_WORD_ENDS, 581 | GTK_DELETE_WORDS, 582 | GTK_DELETE_DISPLAY_LINES, 583 | GTK_DELETE_DISPLAY_LINE_ENDS, 584 | GTK_DELETE_PARAGRAPH_ENDS, 585 | GTK_DELETE_PARAGRAPHS, 586 | GTK_DELETE_WHITESPACE, 587 | 588 | GTK_DIALOG_NON_MODAL = 0, 589 | GTK_DIALOG_MODAL = 1, 590 | GTK_DIALOG_DESTROY_WITH_PARENT = 2, 591 | GTK_DIALOG_NO_SEPARATOR = 4, 592 | 593 | NON_MODAL = -1, -- for EuGTK 594 | 595 | GTK_DIR_TAB_FORWARD = 0, 596 | GTK_DIR_TAB_BACKWARD, 597 | GTK_DIR_UP, 598 | GTK_DIR_DOWN, 599 | GTK_DIR_LEFT, 600 | GTK_DIR_RIGHT, 601 | 602 | GTK_EVENT_SEQUENCE_NONE = 0, 603 | GTK_EVENT_SEQUENCE_CLAIMED, 604 | GTK_EVENT_SEQUENCE_DENIED, 605 | 606 | GTK_EXPANDER_COLLAPSED = 0, 607 | GTK_EXPANDER_SEMI_COLLAPSED, 608 | GTK_EXPANDER_SEMI_EXPANDED, 609 | GTK_EXPANDER_EXPANDED, 610 | 611 | GTK_FILE_CHOOSER_ACTION_OPEN = 0, 612 | GTK_FILE_CHOOSER_ACTION_SAVE, 613 | GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, 614 | GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER, 615 | 616 | GTK_ICON_SIZE_INVALID = 0, 617 | GTK_ICON_SIZE_MENU, 618 | GTK_ICON_SIZE_SMALL_TOOLBAR, 619 | GTK_ICON_SIZE_LARGE_TOOLBAR, 620 | GTK_ICON_SIZE_BUTTON, 621 | GTK_ICON_SIZE_DND, 622 | GTK_ICON_SIZE_DIALOG, 623 | 624 | GTK_ICON_LOOKUP_NO_SVG = 1, 625 | GTK_ICON_LOOKUP_FORCE_SVG = 2, 626 | GTK_ICON_LOOKUP_USE_BUILTIN = 4, 627 | GTK_ICON_LOOKUP_GENERIC_FALLBACK = 8, 628 | GTK_ICON_LOOKUP_FORCE_SIZE = 16, 629 | 630 | GTK_IMAGE_EMPTY = 0, 631 | GTK_IMAGE_PIXBUF, 632 | GTK_IMAGE_STOCK, 633 | GTK_IMAGE_ICON_SET, 634 | GTK_IMAGE_ANIMATION, 635 | GTK_IMAGE_ICON_NAME, 636 | GTK_IMAGE_GICON, 637 | 638 | GTK_IM_PREEDIT_NOTHING = 0, 639 | GTK_IM_PREEDIT_CALLBACK, 640 | GTK_IM_PREEDIT_NONE, 641 | 642 | GTK_IM_STATUS_NOTHING = 0, 643 | GTK_IM_STATUS_CALLBACK, 644 | GTK_IM_STATUS_NONE, 645 | 646 | GTK_INPUT_HINT_NONE = 0, 647 | GTK_INPUT_HINT_SPELLCHECK, 648 | GTK_INPUT_HINT_NO_SPELLCHECK, 649 | GTK_INPUT_HINT_WORD_COMPLETION = 4, 650 | GTK_INPUT_HINT_LOWERCASE = 8, 651 | GTK_INPUT_HINT_UPPERCASE_CHARS = 16, 652 | GTK_INPUT_HINT_UPPERCASE_WORDS = 32, 653 | GTK_INPUT_HINT_UPPERCASE_SENTENCES = 64, 654 | 655 | GTK_JUSTIFY_LEFT = 0, 656 | GTK_JUSTIFY_RIGHT, 657 | GTK_JUSTIFY_CENTER, 658 | GTK_JUSTIFY_FILL, 659 | 660 | GTK_LEVEL_BAR_MODE_CONTINUOUS = 0, 661 | GTK_LEVEL_BAR_MODE_DISCRETE, 662 | 663 | GTK_MATCH_ALL = 0, 664 | GTK_MATCH_ALL_TAIL, 665 | GTK_MATCH_HEAD, 666 | GTK_MATCH_TAIL, 667 | GTK_MATCH_EXACT, 668 | GTK_MATCH_LAST, 669 | 670 | GTK_PIXELS = 0, 671 | GTK_INCHES, 672 | GTK_CENTIMETERS, 673 | 674 | GTK_MESSAGE_INFO = 0, 675 | GTK_MESSAGE_WARNING, 676 | GTK_MESSAGE_QUESTION, 677 | GTK_MESSAGE_ERROR, 678 | GTK_MESSAGE_OTHER, 679 | 680 | GTK_ICON_INFO = 0, 681 | GTK_ICON_WARNING, 682 | GTK_ICON_QUESTION, 683 | GTK_ICON_ERROR, 684 | GTK_ICON_OTHER, 685 | 686 | GTK_MOVEMENT_LOGICAL_POSITIONS = 0, 687 | GTK_MOVEMENT_VISUAL_POSITIONS, 688 | GTK_MOVEMENT_WORDS, 689 | GTK_MOVEMENT_DISPLAY_LINES, 690 | GTK_MOVEMENT_DISPLAY_LINE_ENDS, 691 | GTK_MOVEMENT_PARAGRAPHS, 692 | GTK_MOVEMENT_PARAGRAPH_ENDS, 693 | GTK_MOVEMENT_PAGES, 694 | GTK_MOVEMENT_BUFFER_ENDS, 695 | GTK_MOVEMENT_HORIZONTAL_PAGES, 696 | 697 | GTK_ORIENTATION_HORIZONTAL = 0, 698 | GTK_ORIENTATION_VERTICAL, 699 | 700 | GTK_PACK_START = 0, 701 | GTK_PACK_END, 702 | 703 | GTK_PAN_DIRECTION_LEFT = 0, 704 | GTK_PAN_DIRECTION_RIGHT, 705 | GTK_PAN_DIRECTION_UP, 706 | GTK_PAN_DIRECTION_DOWN, 707 | 708 | GTK_PATH_PRIO_LOWEST = 0, 709 | GTK_PATH_PRIO_GTK = 4, 710 | GTK_PATH_PRIO_APPLICATION = 8, 711 | GTK_PATH_PRIO_THEME = 10, 712 | GTK_PATH_PRIO_RC = 12, 713 | GTK_PATH_PRIO_HIGHEST = 15, 714 | 715 | GTK_PATH_WIDGET = 0, 716 | GTK_PATH_WIDGET_CLASS, 717 | GTK_PATH_CLASS, 718 | 719 | GTK_PHASE_NONE = 0, 720 | GTK_PHASE_CAPTURE, 721 | GTK_PHASE_BUBBLE, 722 | GTK_PHASE_TARGET, 723 | 724 | GTK_POLICY_ALWAYS = 0, 725 | GTK_POLICY_AUTOMATIC, 726 | GTK_POLICY_NEVER, 727 | 728 | GTK_POS_LEFT = 0, 729 | GTK_POS_RIGHT, 730 | GTK_POS_TOP, 731 | GTK_POS_BOTTOM, 732 | LEFT = 0, --aliases; 733 | RIGHT, 734 | TOP, 735 | BOTTOM 736 | 737 | public enum by * 2 738 | GTK_PRINT_CAPABILITY_PAGE_SET = 0, 739 | GTK_PRINT_CAPABILITY_COPIES = 2, 740 | GTK_PRINT_CAPABILITY_COLLATE, 741 | GTK_PRINT_CAPABILITY_REVERSE, 742 | GTK_PRINT_CAPABILITY_SCALE, 743 | GTK_PRINT_CAPABILITY_GENERATE_PDF, 744 | GTK_PRINT_CAPABILITY_GENERATE_PS, 745 | GTK_PRINT_CAPABILITY_PREVIEW, 746 | GTK_PRINT_CAPABILITY_NUMBER_UP, 747 | GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT, 748 | 749 | GTK_REGION_EVEN = 0, 750 | GTK_REGION_ODD = 1, 751 | GTK_REGION_FIRST, 752 | GTK_REGION_LAST, 753 | GTK_REGION_ONLY, 754 | GTK_REGION_SORTED, 755 | 756 | GTK_STATE_FLAG_NORMAL = 0, 757 | GTK_STATE_FLAG_ACTIVE = 1, 758 | GTK_STATE_FLAG_PRELIGHT, 759 | GTK_STATE_FLAG_SELECTED, 760 | GTK_STATE_FLAG_INSENSITIVE, 761 | GTK_STATE_FLAG_INCONSISTENT, 762 | GTK_STATE_FLAG_FOCUSED, 763 | GTK_STATE_FLAG_BACKDROP, 764 | GTK_STATE_FLAG_DIR_LTR , 765 | GTK_STATE_FLAG_DIR_RTL, 766 | GTK_STATE_FLAG_LINK, 767 | GTK_STATE_FLAG_VISITED, 768 | GTK_STATE_FLAG_CHECKED 769 | 770 | public enum 771 | GTK_PROGRESS_LEFT_TO_RIGHT = 0, 772 | GTK_PROGRESS_RIGHT_TO_LEFT, 773 | GTK_PROGRESS_BOTTOM_TO_TOP, 774 | GTK_PROGRESS_TOP_TO_BOTTOM, 775 | 776 | GTK_RELIEF_NORMAL = 0, 777 | GTK_RELIEF_HALF, 778 | GTK_RELIEF_NONE, 779 | 780 | GTK_RESIZE_PARENT = 0, 781 | GTK_RESIZE_QUEUE, 782 | GTK_RESIZE_IMMEDIATE, 783 | 784 | GTK_REVEALER_TRANSITION_TYPE_NONE = 0, 785 | GTK_REVEALER_TRANSITION_TYPE_CROSSFADE, 786 | GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT, 787 | GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT, 788 | GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP, 789 | GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN, 790 | 791 | GTK_SCROLL_STEPS = 0, 792 | GTK_SCROLL_PAGES, 793 | GTK_SCROLL_ENDS, 794 | GTK_SCROLL_HORIZONTAL_STEPS, 795 | GTK_SCROLL_HORIZONTAL_PAGES, 796 | GTK_SCROLL_HORIZONTAL_ENDS, 797 | 798 | GTK_SCROLL_NONE = 0, 799 | GTK_SCROLL_JUMP, 800 | GTK_SCROLL_STEP_BACKWARD, 801 | GTK_SCROLL_STEP_FORWARD, 802 | GTK_SCROLL_PAGE_BACKWARD, 803 | GTK_SCROLL_PAGE_FORWARD, 804 | GTK_SCROLL_STEP_UP, 805 | GTK_SCROLL_STEP_DOWN, 806 | GTK_SCROLL_PAGE_UP, 807 | GTK_SCROLL_PAGE_DOWN, 808 | GTK_SCROLL_STEP_LEFT, 809 | GTK_SCROLL_STEP_RIGHT, 810 | GTK_SCROLL_PAGE_LEFT, 811 | GTK_SCROLL_PAGE_RIGHT, 812 | GTK_SCROLL_START, 813 | GTK_SCROLL_END, 814 | 815 | GTK_SELECTION_NONE = 0, 816 | GTK_SELECTION_SINGLE, 817 | GTK_SELECTION_BROWSE, 818 | GTK_SELECTION_MULTIPLE, 819 | 820 | GTK_SHADOW_NONE = 0, 821 | GTK_SHADOW_IN, 822 | GTK_SHADOW_OUT, 823 | GTK_SHADOW_ETCHED_IN, 824 | GTK_SHADOW_ETCHED_OUT, 825 | 826 | GTK_STATE_NORMAL = 0, 827 | GTK_STATE_ACTIVE, 828 | GTK_STATE_PRELIGHT, 829 | GTK_STATE_SELECTED, 830 | GTK_STATE_INSENSITIVE, 831 | GTK_STATE_INCONSISTENT, 832 | GTK_STATE_FOCUSED, 833 | GTK_STATE_PRESSED = 1, 834 | GTK_STATE_MOUSEOVER, 835 | 836 | GTK_TEXT_DIR_NONE = 0, 837 | GTK_TEXT_DIR_LTR, 838 | GTK_TEXT_DIR_RTL, 839 | 840 | GTK_TOOLBAR_ICONS = 0, 841 | GTK_TOOLBAR_TEXT, 842 | GTK_TOOLBAR_BOTH, 843 | GTK_TOOLBAR_BOTH_HORIZ, 844 | 845 | GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID = -1, 846 | GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID = -2, 847 | 848 | GTK_UPDATE_CONTINUOUS = 0, 849 | GTK_UPDATE_DISCONTINUOUS, 850 | GTK_UPDATE_DELAYED, 851 | 852 | GTK_VISIBILITY_NONE = 0, 853 | GTK_VISIBILITY_PARTIAL, 854 | GTK_VISIBILITY_FULL, 855 | 856 | GTK_WIN_POS_NONE = 0, 857 | GTK_WIN_POS_CENTER, 858 | GTK_WIN_POS_MOUSE, 859 | GTK_WIN_POS_CENTER_ALWAYS, 860 | GTK_WIN_POS_CENTER_ON_PARENT, 861 | 862 | GTK_WINDOW_TOPLEVEL = 0, 863 | GTK_WINDOW_POPUP, 864 | 865 | GTK_SORT_ASCENDING = 1, 866 | GTK_SORT_DESCENDING, 867 | 868 | GTK_DRAG_RESULT_SUCCESS = 0, 869 | GTK_DRAG_RESULT_NO_TARGET, 870 | GTK_DRAG_RESULT_USER_CANCELLED, 871 | GTK_DRAG_RESULT_TIMEOUT_EXPIRED, 872 | GTK_DRAG_RESULT_GRAB_BROKEN, 873 | GTK_DRAG_RESULT_ERROR, 874 | 875 | PANGO_ELLIPSIZE_NONE = 0, 876 | PANGO_ELLIPSIZE_START, 877 | PANGO_ELLIPSIZE_MIDDLE, 878 | PANGO_ELLIPSIZE_END, 879 | 880 | GDK_SOLID = 0, 881 | GDK_TILED, 882 | GDK_STIPPLED, 883 | GDK_OPAQUE_STIPPLED, 884 | 885 | GTK_RESPONSE_NONE = -1, 886 | GTK_RESPONSE_REJECT = -2, 887 | GTK_RESPONSE_ACCEPT = -3, 888 | GTK_RESPONSE_DELETE_EVENT = -4, 889 | GTK_RESPONSE_OK = -5, 890 | GTK_RESPONSE_CANCEL = -6, 891 | GTK_RESPONSE_CLOSE = -7, 892 | GTK_RESPONSE_YES = -8, 893 | GTK_RESPONSE_NO = -9, 894 | GTK_RESPONSE_APPLY = -10, 895 | GTK_RESPONSE_HELP = -11, 896 | 897 | GTK_TREE_VIEW_COLUMN_GROW_ONLY = 0, 898 | GTK_TREE_VIEW_COLUMN_AUTOSIZE, 899 | GTK_TREE_VIEW_COLUMN_FIXED, 900 | 901 | GTK_TREE_VIEW_GRID_LINES_NONE = 0, 902 | GTK_TREE_VIEW_GRID_LINES_HORIZONTAL, 903 | GTK_TREE_VIEW_GRID_LINES_VERTICAL, 904 | GTK_TREE_VIEW_GRID_LINES_BOTH, 905 | 906 | GTK_TEXT_WINDOW_PRIVATE = 0, 907 | GTK_TEXT_WINDOW_WIDGET, 908 | GTK_TEXT_WINDOW_TEXT, 909 | GTK_TEXT_WINDOW_LEFT, 910 | GTK_TEXT_WINDOW_RIGHT, 911 | GTK_TEXT_WINDOW_TOP, 912 | GTK_TEXT_WINDOW_BOTTOM, 913 | 914 | G_USER_DIRECTORY_DESKTOP = 0, 915 | G_USER_DIRECTORY_DOCUMENTS, 916 | G_USER_DIRECTORY_DOWNLOAD, 917 | G_USER_DIRECTORY_MUSIC, 918 | G_USER_DIRECTORY_PICTURES, 919 | G_USER_DIRECTORY_PUBLIC_SHARE, 920 | G_USER_DIRECTORY_TEMPLATES, 921 | G_USER_DIRECTORY_VIDEOS, 922 | G_USER_N_DIRECTORIES, 923 | 924 | GTK_WRAP_NONE = 0, 925 | GTK_WRAP_CHAR, 926 | GTK_WRAP_WORD, 927 | GTK_WRAP_WORD_CHAR, 928 | 929 | GDK_WINDOW_TYPE_HINT_NORMAL = 0, 930 | GDK_WINDOW_TYPE_HINT_DIALOG, 931 | GDK_WINDOW_TYPE_HINT_MENU, 932 | GDK_WINDOW_TYPE_HINT_TOOLBAR, 933 | GDK_WINDOW_TYPE_HINT_SPLASHSCREEN, 934 | GDK_WINDOW_TYPE_HINT_UTILITY, 935 | GDK_WINDOW_TYPE_HINT_DOCK, 936 | GDK_WINDOW_TYPE_HINT_DESKTOP, 937 | GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU, 938 | GDK_WINDOW_TYPE_HINT_POPUP_MENU, 939 | GDK_WINDOW_TYPE_HINT_TOOLTIP, 940 | GDK_WINDOW_TYPE_HINT_NOTIFICATION, 941 | GDK_WINDOW_TYPE_HINT_COMBO, 942 | GDK_WINDOW_TYPE_HINT_DND, 943 | 944 | GDK_ACTION_DEFAULT = 0, 945 | GDK_ACTION_COPY = 1, 946 | GDK_ACTION_MOVE = 2, 947 | GDK_ACTION_LINK = 4, 948 | GDK_ACTION_PRIVATE = 8, 949 | GDK_ACTION_ASK = 16, 950 | 951 | GTK_CELL_RENDERER_MODE_INERT = 0, 952 | GTK_CELL_RENDERER_MODE_ACTIVATABLE, 953 | GTK_CELL_RENDERER_MODE_EDITABLE, 954 | 955 | GTK_CELL_RENDERER_ACCEL_MODE_GTK = 0, 956 | GTK_CELL_RENDERER_ACCEL_MODE_OTHER, 957 | 958 | GTK_DEST_DEFAULT_MOTION = 1, 959 | GTK_DEST_DEFAULT_HIGHLIGHT = 2, 960 | GTK_DEST_DEFAULT_DROP = 4, 961 | GTK_DEST_DEFAULT_ALL = 0x07, 962 | 963 | GTK_SIZE_GROUP_NONE = 0, 964 | GTK_SIZE_GROUP_HORIZONTAL, 965 | GTK_SIZE_GROUP_VERTICAL, 966 | GTK_SIZE_GROUP_BOTH 967 | 968 | public enum 969 | MOUSE_BUTTON1 = 1, 970 | MOUSE_BUTTON2, 971 | MOUSE_BUTTON3 972 | 973 | public enum 974 | PANGO_SCALE = 1000, 975 | PANGO_STYLE_NORMAL= 0, 976 | PANGO_STYLE_OBLIQUE, 977 | PANGO_STYLE_ITALIC, 978 | 979 | PANGO_STRETCH_ULTRA_CONDENSED = 0, 980 | PANGO_STRETCH_EXTRA_CONDENSED, 981 | PANGO_STRETCH_CONDENSED, 982 | PANGO_STRETCH_SEMI_CONDENSED, 983 | PANGO_STRETCH_NORMAL, 984 | PANGO_STRETCH_SEMI_EXPANDED, 985 | PANGO_STRETCH_EXPANDED, 986 | PANGO_STRETCH_EXTRA_EXPANDED, 987 | PANGO_STRETCH_ULTRA_EXPANDED, 988 | 989 | PANGO_VARIANT_NORMAL=1, 990 | PANGO_VARIANT_SMALL_CAPS, 991 | 992 | PANGO_WEIGHT_THIN = 100, 993 | PANGO_WEIGHT_ULTRALIGHT = 200, 994 | PANGO_WEIGHT_LIGHT = 300, 995 | PANGO_WEIGHT_BOOK = 380, 996 | PANGO_WEIGHT_NORMAL = 400, 997 | PANGO_WEIGHT_MEDIUM = 500, 998 | PANGO_WEIGHT_SEMIBOLD = 600, 999 | PANGO_WEIGHT_BOLD = 700, 1000 | PANGO_WEIGHT_ULTRABOLD = 800, 1001 | PANGO_WEIGHT_HEAVY = 900, 1002 | PANGO_WEIGHT_ULTRAHEAVY = 1000, 1003 | PANGO_UNIT = 1024 1004 | 1005 | public enum 1006 | GTK_RECENT_SORT_NONE = 0, 1007 | GTK_RECENT_SORT_MRU, 1008 | GTK_RECENT_SORT_LRU, 1009 | GTK_RECENT_SORT_CUSTOM 1010 | 1011 | public enum by * 2 -- GdkModifierTypes 1012 | GDK_SHIFT_MASK = 1, 1013 | GDK_LOCK_MASK, 1014 | GDK_CONTROL_MASK, 1015 | GDK_MOD1_MASK, -- Alt+ 1016 | GDK_MOD2_MASK, 1017 | GDK_MOD3_MASK, 1018 | GDK_MOD4_MASK, 1019 | GDK_MOD5_MASK, 1020 | GDK_BUTTON1_MASK, 1021 | GDK_BUTTON2_MASK, 1022 | GDK_BUTTON3_MASK, 1023 | GDK_BUTTON4_MASK, 1024 | GDK_BUTTON5_MASK, 1025 | SHFT = 1, -- 'shorthand' versions of above 1026 | LOCK, 1027 | CTL, 1028 | ALT 1029 | 1030 | public enum -- events 1031 | GDK_NOTHING = -1, 1032 | GDK_DELETE, 1033 | GDK_DESTROY, 1034 | GDK_EXPOSE, 1035 | GDK_MOTION_NOTIFY, 1036 | GDK_BUTTON_PRESS, 1037 | GDK_2BUTTON_PRESS, 1038 | GDK_3BUTTON_PRESS, 1039 | GDK_BUTTON_RELEASE, 1040 | GDK_KEY_PRESS, 1041 | GDK_KEY_RELEASE, 1042 | GDK_ENTER_NOTIFY, 1043 | GDK_LEAVE_NOTIFY, 1044 | GDK_FOCUS_CHANGE, 1045 | GDK_CONFIGURE, 1046 | GDK_MAP, 1047 | GDK_UNMAP 1048 | 1049 | public enum -- event masks 1050 | GDK_EXPOSURE_MASK = 2, 1051 | GDK_POINTER_MOTION_MASK = 4, 1052 | GDK_POINTER_MOTION_HINT_MASK = 8, 1053 | GDK_BUTTON_MOTION_MASK = 16, 1054 | GDK_BUTTON1_MOTION_MASK = #20, 1055 | GDK_BUTTON2_MOTION_MASK = #40, 1056 | GDK_BUTTON3_MOTION_MASK = #80, 1057 | GDK_BUTTON_PRESS_MASK = #100, 1058 | GDK_BUTTON_RELEASE_MASK = #200, 1059 | GDK_KEY_PRESS_MASK = #400, 1060 | GDK_KEY_RELEASE_MASK = #800, 1061 | GDK_ENTER_NOTIFY_MASK = #1000, 1062 | GDK_LEAVE_NOTIFY_MASK = #2000, 1063 | GDK_FOCUS_CHANGE_MASK = #4000, 1064 | GDK_STRUCTURE_MASK = #8000, 1065 | GDK_PROPERTY_CHANGE_MASK = #10000, 1066 | GDK_VISIBILITY_NOTIFY_MASK = #20000, 1067 | GDK_PROXIMITY_IN_MASK = #40000, 1068 | GDK_PROXIMITY_OUT_MASK = #80000, 1069 | GDK_SUBSTRUCTURE_MASK = #100000, 1070 | GDK_SCROLL_MASK = #200000, 1071 | GDK_ALL_EVENTS_MASK = #3FFFFE, 1072 | 1073 | GDK_PROPERTY_NOTIFY = 16, 1074 | GDK_SELECTION_CLEAR, 1075 | GDK_SELECTION_REQUEST, 1076 | GDK_SELECTION_NOTIFY, 1077 | GDK_PROXIMITY_IN, 1078 | GDK_PROXIMITY_OUT, 1079 | GDK_DRAG_ENTER, 1080 | GDK_DRAG_LEAVE, 1081 | GDK_DRAG_MOTION, 1082 | GDK_DRAG_STATUS, 1083 | GDK_DROP_START, 1084 | GDK_DROP_FINISHED, 1085 | GDK_CLIENT_EVENT, 1086 | GDK_VISIBILITY_NOTIFY, 1087 | GDK_NO_EXPOSE, 1088 | GDK_SCROLL, 1089 | GDK_WINDOW_STATE, 1090 | GDK_SETTING, 1091 | GDK_OWNER_CHANGE, 1092 | GDK_GRAB_BROKEN, 1093 | GDK_DAMAGE, 1094 | 1095 | GDK_FULLSCREEN_ON_CURRENT_MONITOR = 0, 1096 | GDK_FULLSCREEN_ON_ALL_MONITORS, 1097 | 1098 | GTK_PAGE_SET_ALL = 0, 1099 | GTK_PAGE_SET_EVEN, 1100 | GTK_PAGE_SET_ODD, 1101 | 1102 | GTK_PAGE_ORIENTATION_PORTRAIT = 0, 1103 | GTK_PAGE_ORIENTATION_LANDSCAPE, 1104 | GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT, 1105 | GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE, 1106 | 1107 | GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG = 0, 1108 | GTK_PRINT_OPERATION_ACTION_PRINT, 1109 | GTK_PRINT_OPERATION_ACTION_PREVIEW, 1110 | GTK_PRINT_OPERATION_ACTION_EXPORT, 1111 | 1112 | GTK_PRINT_OPERATION_RESULT_ERROR = 0, 1113 | GTK_PRINT_OPERATION_RESULT_APPLY, 1114 | GTK_PRINT_OPERATION_RESULT_CANCEL, 1115 | GTK_PRINT_OPERATION_RESULT_IN_PROGRESS, 1116 | 1117 | GTK_PRINT_STATUS_INITIAL = 0, 1118 | GTK_PRINT_STATUS_PREPARING, 1119 | GTK_PRINT_STATUS_GENERATING_DATA, 1120 | GTK_PRINT_STATUS_SENDING_DATA, 1121 | GTK_PRINT_STATUS_PENDING, 1122 | GTK_PRINT_STATUS_PENDING_ISSUE, 1123 | GTK_PRINT_STATUS_PRINTING, 1124 | GTK_PRINT_STATUS_FINISHED, 1125 | GTK_PRINT_STATUS_FINISHED_ABORTED, 1126 | 1127 | GTK_PRINT_DUPLEX_SIMPLE = 0, 1128 | GTK_PRINT_DUPLEX_HORIZONTAL, 1129 | GTK_PRINT_DUPLEX_VERTICAL, 1130 | 1131 | GTK_PRINT_PAGES_ALL = 0, 1132 | GTK_PRINT_PAGES_CURRENT, 1133 | GTK_PRINT_PAGES_RANGES, 1134 | GTK_PRINT_PAGES_SELECTION, 1135 | 1136 | GTK_PRINT_QUALITY_LOW = 0, 1137 | GTK_PRINT_QUALITY_NORMAL, 1138 | GTK_PRINT_QUALITY_HIGH, 1139 | GTK_PRINT_QUALITY_DRAFT, 1140 | 1141 | GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_TOP_TO_BOTTOM = 0, 1142 | GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_BOTTOM_TO_TOP, 1143 | GTK_NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_TOP_TOP_BOTTOM, 1144 | GTK_NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_BOTTOM_TO_TOP, 1145 | GTK_NUMBER_UP_LAYOUT_TOP_TO_BOTTOM_LEFT_TO_RIGHT, 1146 | GTK_NUMBER_UP_LAYOUT_TOP_TO_BOTTOM_RIGHT_TO_LEFT, 1147 | GTK_NUMBER_UP_LAYOUT_BOTTOM_TO_TOP_LEFT_TO_RIGHT, 1148 | GTK_NUMBER_UP_LAYOUT_BOTTOM_TO_TOP_RIGHT_TO_LEFT, 1149 | 1150 | GTK_STYLE_PROVIDER_PRIORITY_FALLBACK = 1, 1151 | GTK_STYLE_PROVIDER_PRIORITY_THEME = 200, 1152 | GTK_STYLE_PROVIDER_PRIORITY_SETTINGS = 400, 1153 | GTK_STYLE_PROVIDER_PRIORITY_APPLICATION = 600, 1154 | GTK_STYLE_PROVIDER_PRIORITY_USER = 800, 1155 | 1156 | GTK_UNIT_PIXEL = 0, 1157 | GTK_UNIT_POINTS, 1158 | GTK_UNIT_INCH, 1159 | GTK_UNIT_MM, 1160 | 1161 | GTK_STACK_TRANSITION_TYPE_NONE = 0, 1162 | GTK_STACK_TRANSITION_TYPE_CROSSFADE, 1163 | GTK_STACK_TRANSITION_TYPE_SLIDE_RIGHT, 1164 | GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT, 1165 | GTK_STACK_TRANSITION_TYPE_SLIDE_UP, 1166 | GTK_STACK_TRANSITION_TYPE_SLIDE_DOWN, 1167 | GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT, 1168 | GTK_STACK_TRANSITION_TYPE_SLIDE_UP_DOWN, 1169 | GTK_STACK_TRANSITION_TYPE_OVER_UP, -- GTK3.12 from here down 1170 | GTK_STACK_TRANSITION_TYPE_OVER_DOWN, 1171 | GTK_STACK_TRANSITION_TYPE_OVER_LEFT, 1172 | GTK_STACK_TRANSITION_TYPE_OVER_RIGHT, 1173 | GTK_STACK_TRANSITION_TYPE_UNDER_UP, 1174 | GTK_STACK_TRANSITION_TYPE_UNDER_DOWN, 1175 | GTK_STACK_TRANSITION_TYPE_UNDER_LEFT, 1176 | GTK_STACK_TRANSITION_TYPE_UNDER_RIGHT, 1177 | GTK_STACK_TRANSITION_TYPE_OVER_UP_DOWN, 1178 | GTK_STACK_TRANSITION_TYPE_OVER_DOWN_UP, -- GTK3.14 from here down 1179 | GTK_STACK_TRANSITION_TYPE_OVER_LEFT_RIGHT, 1180 | GTK_STACK_TRANSITION_TYPE_OVER_RIGHT_LEFT, 1181 | 1182 | GTK_PLACES_OPEN_NORMAL = 0, 1183 | GTK_PLACES_OPEN_NEW_TAB, 1184 | GTK_PLACES_OPEN_NEW_WINDOW, 1185 | 1186 | GDK_PIXBUF_ROTATE_NONE = 0, 1187 | GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE = 90, 1188 | GDK_PIXBUF_ROTATE_UPSIDEDOWN = 180, 1189 | GDK_PIXBUF_ROTATE_CLOCKWISE = 270, 1190 | 1191 | GDK_INTERP_NEAREST = 0, 1192 | GDK_INTERP_TILES, 1193 | GDK_INTERP_BILINEAR, 1194 | GDK_INTERP_HYPER, 1195 | 1196 | CAIRO_EXTEND_REPEAT = 1, 1197 | 1198 | CAIRO_FILL_RULE_EVEN_ODD = 1, 1199 | CAIRO_FILL_RULE_WINDING = 0, 1200 | 1201 | CAIRO_FONT_SLANT_NORMAL = 0, 1202 | CAIRO_FONT_SLANT_ITALIC, 1203 | CAIRO_FONT_SLANT_OBLIQUE, 1204 | 1205 | CAIRO_FONT_WEIGHT_NORMAL = 0, NORMAL = 0, 1206 | CAIRO_FONT_WEIGHT_BOLD, BOLD = 1, 1207 | 1208 | CAIRO_FORMAT_INVALID = -1, 1209 | CAIRO_FORMAT_ARGB32 = 0, 1210 | CAIRO_FORMAT_RGB24, 1211 | CAIRO_FORMAT_A8, 1212 | CAIRO_FORMAT_A1, 1213 | CAIRO_FORMAT_RGB16_565, 1214 | 1215 | CAIRO_LINE_CAP_BUTT = 0, 1216 | CAIRO_LINE_CAP_ROUND, 1217 | CAIRO_LINE_CAP_SQUARE, 1218 | 1219 | CAIRO_LINE_JOIN_MITER = 0, 1220 | CAIRO_LINE_JOIN_ROUND, 1221 | CAIRO_LINE_JOIN_BEVEL, 1222 | 1223 | CAIRO_OPERATOR_CLEAR = 0, 1224 | CAIRO_OPERATOR_SOURCE, 1225 | CAIRO_OPERATOR_OVER, 1226 | CAIRO_OPERATOR_IN, 1227 | CAIRO_OPERATOR_OUT, 1228 | CAIRO_OPERATOR_ATOP, 1229 | CAIRO_OPERATOR_DEST, 1230 | CAIRO_OPERATOR_DEST_OVER, 1231 | CAIRO_OPERATOR_DEST_IN, 1232 | CAIRO_OPERATOR_DEST_OUT, 1233 | CAIRO_OPERATOR_DEST_ATOP, 1234 | CAIRO_OPERATOR_XOR, 1235 | CAIRO_OPERATOR_ADD, 1236 | CAIRO_OPERATOR_SATURATE, 1237 | CAIRO_OPERATOR_MULTIPLY, 1238 | CAIRO_OPERATOR_SCREEN, 1239 | CAIRO_OPERATOR_OVERLAY, 1240 | CAIRO_OPERATOR_DARKEN, 1241 | CAIRO_OPERATOR_LIGHTEN, 1242 | CAIRO_OPERATOR_COLOR_DODGE, 1243 | CAIRO_OPERATOR_COLOR_BURN, 1244 | CAIRO_OPERATOR_HARD_LIGHT, 1245 | CAIRO_OPERATOR_SOFT_LIGHT, 1246 | CAIRO_OPERATOR_DIFFERENCE, 1247 | CAIRO_OPERATOR_EXCLUSION, 1248 | CAIRO_OPERATOR_HSL_HUE, 1249 | CAIRO_OPERATOR_HSL_SATURATION, 1250 | CAIRO_OPERATOR_HSL_COLOR, 1251 | CAIRO_OPERATOR_HSL_LUMINOSITY, 1252 | 1253 | CAIRO_PDF_VERSION_1_4 = 0, 1254 | CAIRO_PDF_VERSION_1_5, 1255 | 1256 | CAIRO_SVG_VERSION_1_1 = 0, 1257 | CAIRO_SVG_VERSION_1_2, 1258 | 1259 | CAIRO_SURFACE_TYPE_IMAGE = 0, 1260 | CAIRO_SURFACE_TYPE_PDF, 1261 | CAIRO_SURFACE_TYPE_PS, 1262 | CAIRO_SURFACE_TYPE_XLIB, 1263 | CAIRO_SURFACE_TYPE_XCB, 1264 | CAIRO_SURFACE_TYPE_GLITZ, 1265 | CAIRO_SURFACE_TYPE_QUARTZ, 1266 | CAIRO_SURFACE_TYPE_WIN32, 1267 | CAIRO_SURFACE_TYPE_BEOS, 1268 | CAIRO_SURFACE_TYPE_DIRECTFB, 1269 | CAIRO_SURFACE_TYPE_SVG, 1270 | CAIRO_SURFACE_TYPE_OS2, 1271 | CAIRO_SURFACE_TYPE_WIN32_PRINTING, 1272 | CAIRO_SURFACE_TYPE_QUARTZ_IMAGE, 1273 | CAIRO_SURFACE_TYPE_SCRIPT, 1274 | CAIRO_SURFACE_TYPE_QT, 1275 | CAIRO_SURFACE_TYPE_RECORDING, 1276 | CAIRO_SURFACE_TYPE_VG, 1277 | CAIRO_SURFACE_TYPE_GL, 1278 | CAIRO_SURFACE_TYPE_DRM, 1279 | CAIRO_SURFACE_TYPE_TEE, 1280 | CAIRO_SURFACE_TYPE_XML, 1281 | CAIRO_SURFACE_TYPE_SKIA, 1282 | CAIRO_SURFACE_TYPE_SUBSURFACE, 1283 | 1284 | CAIRO_FONT_TYPE_TOY = 0, 1285 | CAIRO_FONT_TYPE_FT, 1286 | CAIRO_FONT_TYPE_WIN32, 1287 | CAIRO_FONT_TYPE_QUARTZ, 1288 | CAIRO_FONT_TYPE_USER 1289 | 1290 | public enum ICON_PIXBUF = 1, 1291 | ICON_DISPLAY_NAME, 1292 | ICON_FILENAME, 1293 | ICON_BASE_SIZE, 1294 | ICON_BASE_SCALE, 1295 | ICON_IS_SYMBOLIC 1296 | 1297 | function _(atom x, integer t) 1298 | if x = 0 then 1299 | crash("Invalid type - pointer is null!") 1300 | end if 1301 | init(t) register(x,t) 1302 | return x 1303 | end function 1304 | 1305 | ------------------------------------------------------------------------ 1306 | -- GTK Widget Types -- used rarely, with caution 1307 | ------------------------------------------------------------------------ 1308 | global type Object(atom x)return _(x,GObject)end type 1309 | global type Window(atom x)return _(x,GtkWindow)end type 1310 | global type Dialog(atom x)return _(x,GtkDialog)end type 1311 | global type AboutDialog(atom x)return _(x,GtkAboutDialog)end type 1312 | global type Assistant(atom x)return _(x,GtkAssistant)end type 1313 | global type Box(atom x)return _(x,GtkBox)end type 1314 | global type Grid(atom x)return _(x,GtkGrid)end type 1315 | global type Revealer(atom x)return _(x,GtkRevealer)end type 1316 | global type ListBox(atom x)return _(x,GtkListBox)end type 1317 | global type FlowBox(atom x)return _(x,GtkFlowBox)end type 1318 | global type Stack(atom x)return _(x,GtkStack)end type 1319 | global type StackSwitcher(atom x)return _(x,GtkStackSwitcher)end type 1320 | global type Sidebar(atom x)return _(x,GtkSidebar)end type 1321 | global type ActionBar(atom x)return _(x,GtkActionBar)end type 1322 | global type HeaderBar(atom x)return _(x,GtkHeaderBar)end type 1323 | global type Overlay(atom x)return _(x,GtkOverlay)end type 1324 | global type ButtonBox(atom x)return _(x,GtkButtonBox)end type 1325 | global type Paned(atom x)return _(x,GtkPaned)end type 1326 | global type Layout(atom x)return _(x,GtkLayout)end type 1327 | global type Notebook(atom x)return _(x,GtkNotebook)end type 1328 | global type Expander(atom x)return _(x,GtkExpander)end type 1329 | global type AspectFrame(atom x)return _(x,GtkAspectFrame)end type 1330 | global type Label(atom x)return _(x,GtkLabel)end type 1331 | global type Image(atom x)return _(x,GtkImage)end type 1332 | global type Spinner(atom x)return _(x,GtkSpinner)end type 1333 | global type InfoBar(atom x)return _(x,GtkInfoBar)end type 1334 | global type ProgressBar(atom x)return _(x,GtkProgressBar)end type 1335 | global type LevelBar(atom x)return _(x,GtkLevelBar)end type 1336 | global type Statusbar(atom x)return _(x,GtkStatusbar)end type 1337 | global type AccelLabel(atom x)return _(x,GtkAccelLabel)end type 1338 | global type Button(atom x)return _(x,GtkButton)end type 1339 | global type CheckButton(atom x)return _(x,GtkCheckButton)end type 1340 | global type RadioButton(atom x)return _(x,GtkRadioButton)end type 1341 | global type ToggleButton(atom x)return _(x,GtkToggleButton)end type 1342 | global type LinkButton(atom x)return _(x,GtkLinkButton)end type 1343 | global type MenuButton(atom x)return _(x,GtkMenuButton)end type 1344 | global type Switch(atom x)return _(x,GtkSwitch)end type 1345 | global type ScaleButton(atom x)return _(x,GtkScaleButton)end type 1346 | global type VolumeButton(atom x)return _(x,GtkVolumeButton)end type 1347 | global type LockButton(atom x)return _(x,GtkLockButton)end type 1348 | global type Entry(atom x)return _(x,GtkEntry)end type 1349 | global type EntryBuffer(atom x)return _(x,GtkEntryBuffer)end type 1350 | global type EntryCompletion(atom x)return _(x,GtkEntryCompletion)end type 1351 | global type Scale(atom x)return _(x,GtkScale)end type 1352 | global type SpinButton(atom x)return _(x,GtkSpinButton)end type 1353 | global type SearchEntry(atom x)return _(x,GtkSearchEntry)end type 1354 | global type SearchBar(atom x)return _(x,GtkSearchBar)end type 1355 | global type Editable(atom x)return _(x,GtkEditable)end type 1356 | global type TextMark(atom x)return _(x,GtkTextMark)end type 1357 | global type TextBuffer(atom x)return _(x,GtkTextBuffer)end type 1358 | global type TextTag(atom x)return _(x,GtkTextTag)end type 1359 | global type TextTagTable(atom x)return _(x,GtkTextTagTable)end type 1360 | global type TextView(atom x)return _(x,GtkTextView)end type 1361 | global type TreeModel(atom x)return _(x,GtkTreeModel)end type 1362 | global type TreeModelSort(atom x)return _(x,GtkTreeModelSort)end type 1363 | global type TreeSelection(atom x)return _(x,GtkTreeSelection)end type 1364 | global type TreeViewColumn(atom x)return _(x,GtkTreeViewColumn)end type 1365 | global type TreeView(atom x)return _(x,GtkTreeView)end type 1366 | global type IconView(atom x)return _(x,GtkIconView)end type 1367 | global type CellRendererText(atom x)return _(x,GtkCellRendererText)end type 1368 | global type CellRendererAccel(atom x)return _(x,GtkCellRendererAccel)end type 1369 | global type CellRendererCombo(atom x)return _(x,GtkCellRendererCombo)end type 1370 | global type CellRendererPixbuf(atom x)return _(x,GtkCellRendererPixbuf)end type 1371 | global type CellRendererProgress(atom x)return _(x,GtkCellRendererProgress)end type 1372 | global type CellRendererSpin(atom x)return _(x,GtkCellRendererSpin)end type 1373 | global type CellRendererToggle(atom x)return _(x,GtkCellRendererToggle)end type 1374 | global type CellRendererSpinner(atom x)return _(x,GtkCellRendererSpinner)end type 1375 | global type ListStore(atom x)return _(x,GtkListStore)end type 1376 | global type TreeStore(atom x)return _(x,GtkTreeStore)end type 1377 | global type ComboBox(atom x)return _(x,GtkComboBox)end type 1378 | global type ComboBoxText(atom x)return _(x,GtkComboBoxText)end type 1379 | global type Menu(atom x)return _(x,GtkMenu)end type 1380 | global type MenuBar(atom x)return _(x,GtkMenuBar)end type 1381 | global type MenuItem(atom x)return _(x,GtkMenuItem)end type 1382 | global type RadioMenuItem(atom x)return _(x,GtkRadioMenuItem)end type 1383 | global type CheckMenuItem(atom x)return _(x,GtkCheckMenuItem)end type 1384 | global type SeparatorMenuItem(atom x)return _(x,GtkSeparatorMenuItem)end type 1385 | global type Toolbar(atom x)return _(x,GtkToolbar)end type 1386 | global type ToolItem(atom x)return _(x,GtkToolItem)end type 1387 | global type ToolPalette(atom x)return _(x,GtkToolPalette)end type 1388 | global type ToolButton(atom x)return _(x,GtkToolButton)end type 1389 | global type MenuToolButton(atom x)return _(x,GtkMenuToolButton)end type 1390 | global type ToggleToolButton(atom x)return _(x,GtkToggleToolButton)end type 1391 | global type RadioToolButton(atom x)return _(x,GtkRadioToolButton)end type 1392 | global type Popover(atom x)return _(x,GtkPopover)end type 1393 | global type PopoverMenu(atom x)return _(x,GtkPopoverMenu)end type 1394 | global type ColorChooser(atom x)return _(x,GtkColorChooser)end type 1395 | global type ColorButton(atom x)return _(x,GtkColorButton)end type 1396 | global type ColorChooserWidget(atom x)return _(x,GtkColorChooserWidget)end type 1397 | global type ColorChooserDialog(atom x)return _(x,GtkColorChooserDialog)end type 1398 | global type FileChooser(atom x)return _(x,GtkFileChooser)end type 1399 | global type FileChooserButton(atom x)return _(x,GtkFileChooserButton)end type 1400 | global type FileChooserDialog(atom x)return _(x,GtkFileChooserDialog)end type 1401 | global type FileChooserWidget(atom x)return _(x,GtkFileChooserWidget)end type 1402 | global type FileFilter(atom x)return _(x,GtkFileFilter)end type 1403 | global type FontChooser(atom x)return _(x,GtkFontChooser)end type 1404 | global type FontButton(atom x)return _(x,GtkFontButton)end type 1405 | global type FontChooserWidget(atom x)return _(x,GtkFontChooserWidget)end type 1406 | global type FontChooserDialog(atom x)return _(x,GtkFontChooserDialog)end type 1407 | global type PlacesSidebar(atom x)return _(x,GtkPlacesSidebar)end type 1408 | global type Frame(atom x)return _(x,GtkFrame)end type 1409 | global type Scrollbar(atom x)return _(x,GtkScrollbar)end type 1410 | global type ScrolledWindow(atom x)return _(x,GtkScrolledWindow)end type 1411 | global type Adjustment(atom x)return _(x,GtkAdjustment)end type 1412 | global type Calendar(atom x)return _(x,GtkCalendar)end type 1413 | global type GLArea(atom x)return _(x,GtkGLArea)end type 1414 | global type Tooltip(atom x)return _(x,GtkTooltip)end type 1415 | global type Viewport(atom x)return _(x,GtkViewport)end type 1416 | global type Widget(atom x)return _(x,GtkWidget)end type 1417 | global type Container(atom x)return _(x,GtkContainer)end type 1418 | global type Bin(atom x)return _(x,GtkBin)end type 1419 | global type Range(atom x)return _(x,GtkRange)end type 1420 | global type PrintContext(atom x)return _(x,GtkPrintContext)end type 1421 | global type ListBoxRow(atom x)return _(x,GtkListBoxRow)end type 1422 | global type FontFamily(atom x)return _(x,PangoFontFamily)end type 1423 | global type FontDescription(atom x)return _(x,PangoFontDescription)end type 1424 | global type AppChooserDialog(atom x)return _(x,GtkAppChooserDialog)end type 1425 | global type PaperSize(atom x)return _(x,GtkPaperSize)end type 1426 | global type DrawingArea(atom x)return _(x,GtkDrawingArea)end type 1427 | global type RecentChooserDialog(atom x)return _(x,GtkRecentChooserDialog)end type 1428 | global type RecentChooserWidget(atom x)return _(x,GtkRecentChooserWidget)end type 1429 | global type RecentChooser(atom x)return _(x,GtkRecentChooser)end type 1430 | global type RecentFilter(atom x)return _(x,GtkRecentFilter)end type 1431 | global type RecentChooserMenu(atom x)return _(x,GtkRecentChooserMenu)end type 1432 | global type EventBox(atom x)return _(x,GtkEventBox)end type 1433 | global type TreeModelFilter(atom x)return _(x,GtkTreeModelFilter)end type 1434 | global type Application(atom x)return _(x,GtkApplication)end type 1435 | global type ApplicationWindow(atom x)return _(x,GtkApplicationWindow)end type 1436 | global type Pixbuf(atom x)return _(x,GdkPixbuf)end type 1437 | global type IconTheme(atom x)return _(x,GtkIconTheme)end type 1438 | global type Cairo_T(atom x)return _(x,Cairo_t)end type 1439 | ------------------------- 1440 | -- © 2015 by Irv Mullins 1441 | ------------------------- 1442 | -------------------------------------------------------------------------------- /EuGTK/GtkEvents.e: -------------------------------------------------------------------------------- 1 | 2 | namespace events 3 | 4 | --Thanks to Pete Eberlein for helping with this! 5 | 6 | include GtkEngine.e 7 | include std/convert.e 8 | 9 | -- Maps keys from keypad to match same keys on keyboard, 10 | -- maps control/arrow keys to negative numbers, so they 11 | -- can be differentiated from the same ascii character 12 | -- values; 13 | 14 | constant keyvalues = { 15 | {8,-8}, -- bksp 16 | {9,-9}, -- tab 17 | {20,-20}, -- scroll lock 18 | {27,27}, -- escape 19 | {80,-80}, -- home 'P' 20 | {81,-81}, -- left arrow 'Q' 21 | {82,-82}, -- up arrow 'R' 22 | {83,-83}, -- right arrow 'S' 23 | {84,-84}, -- down arrow 'T' 24 | {85,-85}, -- page up 'U' 25 | {86,-86}, -- page dn 'V' 26 | {87,-87}, -- end 'W' 27 | {99,-99}, -- insert 'c' 28 | {103,-103}, 29 | {127,-127}, -- num lock 30 | 31 | {141,13}, -- keypad Enter, with or w/o numlock; 32 | 33 | -- keypad keys w/o numlock; 34 | {149,-149}, -- keypad home 35 | {150,-150}, -- keypad left 36 | {151,-151}, -- keypad up 37 | {152,-152}, -- keypad right 38 | {153,-153}, -- keypad down 39 | {154,-154}, -- keypad pg up 40 | {155,-155}, -- keypad pg dn 41 | {156,-156}, -- keypad end 42 | {157,-157}, -- keypad 5 43 | {158,-158}, -- keypad ins 44 | {159,-159}, -- keypad del 45 | 46 | -- keypad keys with numlock - return ascii 0..9 47 | {170,'*'},{171,'+'},{173,'-'},{175,'/'}, 48 | {176,48},{177,49},{178,50},{179,51},{180,52}, -- keypad numbers 0..4 49 | {181,53},{182,54},{183,55},{184,56},{185,57}, -- keypad numbers 5..9 50 | 51 | -- F keys; 52 | {190,-190}, -- F1 53 | {191,-191}, -- F2 54 | {192,-192}, -- F3 55 | {193,-193}, -- F4 56 | {194,-194}, -- F5 57 | {195,-195}, -- F6 58 | {196,-196}, -- F7 59 | {197,-197}, -- F8 60 | {198,-198}, -- F9 61 | {199,-199}, -- F10 62 | {200,-200}, -- F11 63 | {201,-201}, -- F12 64 | {227,-227}, -- left ctl 65 | {228,-228}, -- right ctl 66 | {229,-229}, 67 | {225,-225}, -- left shift 68 | {226,-226}, -- right shift 69 | {228,-228}, 70 | {233,-233}, -- left alt 71 | {234,-234}, -- right alt 72 | {236,-236}, 73 | {255,-255}, -- delete 74 | $} 75 | 76 | constant shiftkeys = { 77 | {32,-9}, -- shift tab 78 | $} 79 | 80 | ---------------------------------------------------------------------- 81 | export function key(atom event) -- get key pressed; 82 | ---------------------------------------------------------------------- 83 | integer k = peek(event+16) 84 | integer z = peek(event+17) 85 | integer s = state(event) 86 | ifdef BITS64 then 87 | k = peek(event+28) 88 | z = peek(event+29) 89 | end ifdef 90 | switch z do 91 | case 0 then return k 92 | case 255 then return vlookup(k,keyvalues,1,2,k) 93 | case 254 then return vlookup(k,shiftkeys,1,2,k) 94 | end switch 95 | return 0 96 | end function 97 | 98 | --------------------------------------------------------------------- 99 | export function id(atom event) 100 | --------------------------------------------------------------------- 101 | return peek4u(event) 102 | end function 103 | 104 | ---------------------------------------------------------------------- 105 | export function state(atom event) 106 | ---------------------------------------------------------------------- 107 | ifdef BITS64 then 108 | return peek(event+24) 109 | end ifdef 110 | return peek(event+12) 111 | end function 112 | 113 | ---------------------------------------------------------------------- 114 | export function hwcode(atom event) 115 | ---------------------------------------------------------------------- 116 | ifdef BITS64 then 117 | return peek({event+28,2}) 118 | end ifdef 119 | return peek({event+16,2}) 120 | end function 121 | 122 | --------------------------------------------------------------------- 123 | export function button(atom event) -- get mouse button clicked; 124 | --------------------------------------------------------------------- 125 | ifdef BITS64 then 126 | return peek(event+52) 127 | end ifdef 128 | return peek(event+40) 129 | end function 130 | 131 | --(32/64)struct GdkEventButton 132 | -- 0 0 GdkEventType type 133 | -- 4 8 GtkWindow *window 134 | -- 8 16 gint8 send_event 135 | -- 12 20 guint32 time 136 | -- 16 24 gdouble x 137 | -- 24 32 gdouble y 138 | -- 32 40 gdouble *axes 139 | -- 36 48 guint state 140 | -- 40 52 guint button 141 | -- 44 56 GdkDevice *device 142 | -- 48 64 gdouble x_root, y_root 143 | 144 | --------------------------------------------------------------------- 145 | export function window(atom event) -- get event window 146 | --------------------------------------------------------------------- 147 | ifdef BITS64 then 148 | return peek8u(event + 8) 149 | end ifdef 150 | return peek4u(event + 4) 151 | end function 152 | 153 | --------------------------------------------------------------------- 154 | export function time(atom event) -- get event time 155 | --------------------------------------------------------------------- 156 | ifdef BITS64 then 157 | return peek4u(event + 20) 158 | end ifdef 159 | return peek4u(event + 12) 160 | end function 161 | 162 | 163 | --------------------------------------------------------------------- 164 | export function xy(atom event) -- get mouse button x y; 165 | --------------------------------------------------------------------- 166 | ifdef BITS64 then 167 | return { 168 | float64_to_atom(peek({event + 24, 8})), 169 | float64_to_atom(peek({event + 32, 8}))} 170 | end ifdef 171 | return { 172 | float64_to_atom(peek({event + 16, 8})), 173 | float64_to_atom(peek({event + 24, 8}))} 174 | end function 175 | 176 | --------------------------------------------------------------------- 177 | export function clicks(atom event) 178 | --------------------------------------------------------------------- 179 | atom ct = allocate(64) 180 | object result 181 | if gtk_func("gdk_event_get_click_count",{P,I},{event,ct}) then 182 | result = peek4u(ct) 183 | else 184 | result = -1 185 | end if 186 | free(ct) 187 | return result 188 | end function 189 | 190 | --------------------------------------------------------------------- 191 | export function scroll_dir(atom event) 192 | --------------------------------------------------------------------- 193 | atom dir = allocate(64) 194 | object result 195 | if gtk_func("gdk_event_get_scroll_direction",{P,I},{event,dir}) then 196 | result = peek4u(dir) 197 | else 198 | result = -1 199 | end if 200 | free(dir) 201 | return result 202 | end function 203 | 204 | ------------------------------------------------------------------------ 205 | -- following routine traps the enter key when Entry is activated, 206 | -- and uses it like the tab key - so it works like people expect. 207 | -- in Glade, connect each entry's 'activate' signal to 208 | -- trap_enter_key 209 | ------------------------------------------------------------------------ 210 | constant gsig = define_proc("g_signal_emit_by_name",{P,P,P}) 211 | constant fsig = allocate_string("move-focus") 212 | ------------------------------------------------------------------------ 213 | global function trap_enter_key(atom ctl, atom event) 214 | ----------------------------------------------------------------------- 215 | if classid(ctl) = GtkEntry then 216 | if event = 0 then 217 | c_proc(gsig,{ctl,allocate_string("move-focus"),0}) 218 | return 1 219 | end if 220 | end if 221 | return 0 222 | end function 223 | -------------------------------------------------------------------------------- /EuGTK/GtkPrinter.e: -------------------------------------------------------------------------------- 1 | ------------------ 2 | namespace printer 3 | ------------------ 4 | constant version = "4.9.4" 5 | 6 | include GtkEngine.e 7 | include std/datetime.e 8 | 9 | -------------------------------------------------------------------------------- 10 | -- This version handles most common printing needs, but it will not yet respect 11 | -- 'marked up' a.k.a. 'rich' text, i.e. text with colors and styles such as 12 | -- set by test59. It just prints them as plain text. 13 | -- However, it DOES print text marked up with GTK's HTML subset, so you can use 14 | -- , , , length(text) then 292 | set(progress,"text","Printing complete") 293 | return 0 294 | end if 295 | 296 | if show_progress then 297 | set(progress,"text",sprintf("Printing page %d",pg)) 298 | set(progress,"fraction",pg/n_pages) 299 | end if 300 | 301 | ifdef DELAY then sleep(0.25) end ifdef 302 | 303 | object details = { 304 | page_title,sub_title,file_name,short_name, 305 | pg,n_pages,n_copies, 306 | today,user,real_name,font,filesize,timestamp,export_file 307 | } 308 | 309 | object page 310 | 311 | if atom(header) then header = "[1] page [5] of [6]\n\n" end if 312 | 313 | if pg = 1 or atom(subheader) then 314 | page = text:format(header,details) 315 | & flatten(text[pg]) 316 | & text:format(footer,details) 317 | else 318 | page = text:format(subheader,details) 319 | & flatten(text[pg]) 320 | & text:format(footer,details) 321 | end if 322 | 323 | set(pl,"markup",page,length(page)) 324 | set(pl,"update layout",cr) 325 | set(pl,"show layout",cr) 326 | 327 | ifdef PRINT then printf(1,"Page %d\n",pg) end ifdef 328 | 329 | return 1 330 | end function 331 | 332 | ------------------------------------------------------------------------ 333 | function process_text(object txt) 334 | ------------------------------------------------------------------------ 335 | txt = split(txt,'\n') 336 | integer comment 337 | object a,b 338 | object test 339 | 340 | 341 | for i = 1 to length(txt) do -- replace chars which will confuse markup 342 | 343 | txt[i] = join(split(txt[i],'&'),"&") 344 | txt[i] = join(split(txt[i],"&amp;"),"&") 345 | 346 | if sourcecode then 347 | txt[i] = join(split(txt[i],'<'),"<") 348 | txt[i] = join(split(txt[i],'>'),">") 349 | end if 350 | 351 | if use_color then 352 | comment = match("--",txt[i]) 353 | if comment then 354 | comment -=1 355 | txt[i] = txt[i][1..comment] & "" & txt[i][comment+1..$] & "" 356 | end if 357 | end if 358 | 359 | if use_line_numbers then 360 | txt[i] = text:format(line_number_format,{i,txt[i]}) 361 | else 362 | txt[i] &= '\n' 363 | end if 364 | 365 | end for 366 | 367 | txt = breakup(txt,lines_per_page) 368 | if n_pages = 0 then -- no selection 369 | n_pages = length(txt) 370 | end if 371 | 372 | return txt 373 | end function 374 | 375 | ------------------------------------------------------------------------ 376 | export function end_print() 377 | ------------------------------------------------------------------------ 378 | status_string = "Printing complete" 379 | ifdef PRINT then display(status_string) end ifdef 380 | return 1 381 | end function 382 | 383 | --------------------------------------------------------------- 384 | export function setup_printer() 385 | --------------------------------------------------------------- 386 | atom _size = create(GtkPaperSize,paper_name) 387 | atom err = allocate(16) err = 0 388 | object results = 0 389 | 390 | atom fn7 = define_func("gtk_print_operation_run",{P,I,P,P},I) 391 | atom fn8 = define_func("gtk_print_run_page_setup_dialog",{P,P,P},P) 392 | 393 | set(settings,"paper size",_size,units) 394 | set(settings,"n copies",n_copies) 395 | set(settings,"collate",collate) 396 | set(settings,"duplex",duplex) 397 | set(settings,"reverse",order) 398 | set(settings,"scale",scale) 399 | set(settings,"quality",quality) 400 | set(settings,"number up",number_up) 401 | set(settings,"number up layout",number_up_layout) 402 | 403 | if string(name) then 404 | set(settings,"printer",name) 405 | end if 406 | 407 | atom setup = create(GtkPageSetup) 408 | set(setup,"paper size",_size) 409 | set(setup,"orientation",orientation) 410 | set(setup,"left margin",left_margin,units) 411 | set(setup,"right margin",right_margin,units) 412 | set(setup,"top margin",top_margin,units) 413 | set(setup,"bottom margin",bottom_margin,units) 414 | 415 | atom printop = create(GtkPrintOperation) 416 | set(printop,"print settings",settings) 417 | set(printop,"default page setup",setup) 418 | set(printop,"show progress",show_progress) 419 | set(printop,"track print status",track_status) 420 | set(printop,"embed page setup",embed_page_setup) 421 | set(printop,"support selection",support_selection) 422 | set(printop,"has selection",has_selection) 423 | set(printop,"use full page",use_full_page) 424 | 425 | if action = GTK_PRINT_OPERATION_ACTION_EXPORT then 426 | export_file = canonical_path(export_file) 427 | set(printop,"export filename",export_file) 428 | end if 429 | 430 | if string(jobname) then 431 | set(printop,"job name",jobname) 432 | end if 433 | 434 | if custom_tab_hook != 0 then 435 | set(printop,"custom tab label",custom_tab_label) 436 | connect(printop,"create-custom-widget",custom_tab_func,printop) 437 | connect(printop,"custom-widget-apply",custom_tab_hook) 438 | end if 439 | 440 | connect(printop,"status-changed",signal_status_changed) 441 | connect(printop,"begin-print",signal_begin_print) 442 | connect(printop,"draw-page",signal_draw_page) 443 | connect(printop,"end-print",signal_end_print) 444 | connect(printop,"request-page-setup",signal_request_page_setup) 445 | connect(printop,"done",signal_done) 446 | connect(printop,"ready",signal_ready) 447 | connect(printop,"got-page-size",signal_got_page_size) 448 | 449 | c_func(fn7,{printop,action,parent,err}) -- start the print process; 450 | 451 | if string(settings_file) then 452 | get(settings,"to file",settings_file) 453 | end if 454 | if string(setup_file) then 455 | get(setup,"to file",setup_file) 456 | end if 457 | 458 | object jobname = get(printop,"job name") 459 | if confirm then 460 | if action = GTK_PRINT_OPERATION_ACTION_EXPORT then 461 | if Question(0,"PDF Written", 462 | sprintf("%s\nFolder: %s", 463 | {filename(export_file),pathname(export_file)}), 464 | sprintf("%s\nStatus: %d\n%s\nClick Yes to view",{jobname,status_code,status_string}) 465 | ,,,"cups") then 466 | show_uri(export_file) 467 | end if 468 | else 469 | Info(0,"Print Job",jobname, 470 | sprintf("Status: %d %s",{status_code,status_string}) 471 | ,,"cups") 472 | end if 473 | end if 474 | 475 | page_title = 0 476 | n_pages = 0 477 | n_copies = 1 478 | action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG 479 | 480 | return 1 481 | end function 482 | 483 | header = "[1]\n\n" 484 | 485 | ------------------------- 486 | -- © 2015 by Irv Mullins 487 | ------------------------- 488 | -------------------------------------------------------------------------------- /EuGTK/README.txt: -------------------------------------------------------------------------------- 1 | GTK Library for Euphoria 4.0 2 | by Irv Mullins 3 | 4 | https://sites.google.com/site/euphoriagtk/Home 5 | -------------------------------------------------------------------------------- /EuGTK/license.txt: -------------------------------------------------------------------------------- 1 | 2 | LGPL ~ GNU Lesser General Public License version 3.0 3 | 4 | This library is free software; you can redistribute it 5 | and/or modify it under the terms of the GNU Lesser General 6 | Public License as published by the Free Software Foundation; 7 | either version 2 of the License, or (at your option) any later 8 | version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | See the GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Pl, Suite 330, Boston, MA 02111-1307 USA 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 peberlein 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WEE 2 | A small code-aware editor for Euphoria programming 3 | 4 | ### Featuring 5 | * [Scintilla](http://www.scintilla.org/) editor control with syntax highlighting 6 | * subroutines list 7 | * automatic if/while/for/procedure/function expansion 8 | * code identifier completion 9 | * jump to subroutine declaration 10 | * ex.err monitoring 11 | * show subroutine arguments 12 | 13 | Supports Windows 14 | 15 | Supports Linux and Mac OS using [EuGTK](https://sites.google.com/site/euphoriagtk/Home) 16 | 17 | Requires [Euphoria 4.1.0 Beta 2](http://openeuphoria.org/wiki/view/DownloadEuphoria.wc) or later. 18 | 19 | ### How to Get It 20 | 21 | Create a folder called "Wee" and download [updater.ex](https://github.com/peberlein/WEE/raw/master/updater.ex). Run "eui updater.ex" to download/update the files for your platform. Run "eui wee" to run the editor, or compile/bind/shroud it for convenience. 22 | -------------------------------------------------------------------------------- /manifest.ex: -------------------------------------------------------------------------------- 1 | include std/pretty.e 2 | include std/io.e 3 | include std/hash.e 4 | include std/os.e 5 | include std/pipeio.e 6 | 7 | 8 | sequence files 9 | files = { 10 | -- platform independent 11 | {"wee.exw", 0, 0, 0}, 12 | {"scintilla.e", 0, 0, 0}, 13 | {"parser.e", 0, 0, 0}, 14 | {"updater.ex", 0, 0, 0}, 15 | {"weeicon.e", 0, 0, 0}, 16 | -- windows 17 | {"ui_win.e", 0, 0, 0, WINDOWS}, 18 | {"window.ew", 0, 0, 0, WINDOWS}, 19 | -- GTK 20 | {"ui_gtk.e", 0, 0, 0, LINUX, OSX}, 21 | {"EuGTK/GtkEngine.e", 0, 0, 0, LINUX, OSX}, 22 | {"EuGTK/GtkEnums.e", 0, 0, 0, LINUX, OSX}, 23 | {"EuGTK/GtkPrinter.e", 0, 0, 0, LINUX, OSX}, 24 | {"EuGTK/GtkEvents.e", 0, 0, 0, LINUX, OSX}, 25 | {"EuGTK/README.txt", 0, 0, 0, LINUX, OSX}, 26 | {"EuGTK/license.txt", 0, 0, 0, LINUX, OSX}, 27 | -- scintilla 28 | {"scintilla/SciLexer.dll", 0, 0, 32, WINDOWS}, 29 | {"scintilla/SciLexer64.dll", 0, 0, 64, WINDOWS}, 30 | {"scintilla/scintilla32.so", 0, 0, 32, LINUX}, 31 | {"scintilla/scintilla64.so", 0, 0, 64, LINUX}, 32 | {"scintilla/scintillaOSX.dylib", 0, 0, 64, OSX}, 33 | {"scintilla/scintilla32armhf.so", 0, 0, 32, LINUX}, 34 | {"scintilla/License.txt", 0, 0, 0} 35 | } 36 | 37 | object file, p 38 | 39 | -- returns 40 | function read_until_eof(object pipe) 41 | sequence result = {} 42 | object o = pipeio:read(pipe, 1024) 43 | while sequence(o) and length(o) do 44 | result &= o 45 | o = pipeio:read(pipe, 1024) 46 | end while 47 | return result 48 | end function 49 | 50 | for i = 1 to length(files) do 51 | files[i][2] = hash(read_file(files[i][1]), HSIEH30) 52 | -- git log -n 1 --format=oneline -- ui_gtk.e 53 | p = pipeio:exec("git log -n1 --format=oneline -- "&files[i][1], pipeio:create()) 54 | files[i][3] = pipeio:read(p[pipeio:STDOUT], 10) 55 | pipeio:kill(p) 56 | 57 | p = pipeio:exec("git show "&files[i][3]&":"&files[i][1], pipeio:create()) 58 | object h = hash(read_until_eof(p[pipeio:STDOUT]), HSIEH30) 59 | pipeio:kill(p) 60 | 61 | printf(1, "%s %s %d %d\n", {files[i][1], files[i][3], files[i][2], h}) 62 | files[i][2] = h 63 | end for 64 | 65 | --display(files) 66 | ? write_file("manifest.json", pretty_sprint(files, {2})) 67 | -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | { 3 | "wee.exw", 4 | 1007379884, 5 | "9587ace88f", 6 | 0 7 | }, 8 | { 9 | "scintilla.e", 10 | 13846666, 11 | "e3cc5860ac", 12 | 0 13 | }, 14 | { 15 | "parser.e", 16 | 215958451, 17 | "87365ad72b", 18 | 0 19 | }, 20 | { 21 | "updater.ex", 22 | 859055865, 23 | "13903da955", 24 | 0 25 | }, 26 | { 27 | "weeicon.e", 28 | 39797371, 29 | "fdc3db69d4", 30 | 0 31 | }, 32 | { 33 | "ui_win.e", 34 | 26874630, 35 | "0bbed7c48a", 36 | 0, 37 | 2 38 | }, 39 | { 40 | "window.ew", 41 | 73452942, 42 | "eeba782b05", 43 | 0, 44 | 2 45 | }, 46 | { 47 | "ui_gtk.e", 48 | 59538677, 49 | "839c798be8", 50 | 0, 51 | 3, 52 | 4 53 | }, 54 | { 55 | "EuGTK/GtkEngine.e", 56 | 132693288, 57 | "4df40ce0cd", 58 | 0, 59 | 3, 60 | 4 61 | }, 62 | { 63 | "EuGTK/GtkEnums.e", 64 | 202551058, 65 | "506cdc498b", 66 | 0, 67 | 3, 68 | 4 69 | }, 70 | { 71 | "EuGTK/GtkPrinter.e", 72 | 443615540, 73 | "506cdc498b", 74 | 0, 75 | 3, 76 | 4 77 | }, 78 | { 79 | "EuGTK/GtkEvents.e", 80 | 1050187785, 81 | "506cdc498b", 82 | 0, 83 | 3, 84 | 4 85 | }, 86 | { 87 | "EuGTK/README.txt", 88 | 332011652, 89 | "04aa6ff6c9", 90 | 0, 91 | 3, 92 | 4 93 | }, 94 | { 95 | "EuGTK/license.txt", 96 | 70721840, 97 | "506cdc498b", 98 | 0, 99 | 3, 100 | 4 101 | }, 102 | { 103 | "scintilla/SciLexer.dll", 104 | 376057439, 105 | "b6035dbac0", 106 | 32, 107 | 2 108 | }, 109 | { 110 | "scintilla/SciLexer64.dll", 111 | 971949613, 112 | "683bd7ddbf", 113 | 64, 114 | 2 115 | }, 116 | { 117 | "scintilla/scintilla32.so", 118 | 794231462, 119 | "b6035dbac0", 120 | 32, 121 | 3 122 | }, 123 | { 124 | "scintilla/scintilla64.so", 125 | 778289070, 126 | "b6035dbac0", 127 | 64, 128 | 3 129 | }, 130 | { 131 | "scintilla/scintillaOSX.dylib", 132 | 510448282, 133 | "b6035dbac0", 134 | 64, 135 | 4 136 | }, 137 | { 138 | "scintilla/scintilla32armhf.so", 139 | 572289041, 140 | "e3cc5860ac", 141 | 32, 142 | 3 143 | }, 144 | { 145 | "scintilla/License.txt", 146 | 662502963, 147 | "b6035dbac0", 148 | 0 149 | } 150 | } -------------------------------------------------------------------------------- /mongoose-wee.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peberlein/WEE/1744f655e3097da221fb8302f84c96a24ca477e1/mongoose-wee.ico -------------------------------------------------------------------------------- /scintilla/License.txt: -------------------------------------------------------------------------------- 1 | License for Scintilla and SciTE 2 | 3 | Copyright 1998-2003 by Neil Hodgson 4 | 5 | All Rights Reserved 6 | 7 | Permission to use, copy, modify, and distribute this software and its 8 | documentation for any purpose and without fee is hereby granted, 9 | provided that the above copyright notice appear in all copies and that 10 | both that copyright notice and this permission notice appear in 11 | supporting documentation. 12 | 13 | NEIL HODGSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 14 | SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 15 | AND FITNESS, IN NO EVENT SHALL NEIL HODGSON BE LIABLE FOR ANY 16 | SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 17 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 18 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 19 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE 20 | OR PERFORMANCE OF THIS SOFTWARE. -------------------------------------------------------------------------------- /scintilla/SciLexer.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peberlein/WEE/1744f655e3097da221fb8302f84c96a24ca477e1/scintilla/SciLexer.dll -------------------------------------------------------------------------------- /scintilla/SciLexer64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peberlein/WEE/1744f655e3097da221fb8302f84c96a24ca477e1/scintilla/SciLexer64.dll -------------------------------------------------------------------------------- /scintilla/gtk_makefile: -------------------------------------------------------------------------------- 1 | # Make file for Scintilla on Linux or compatible OS 2 | # Copyright 1998-2010 by Neil Hodgson 3 | # The License.txt file describes the conditions under which this software may be distributed. 4 | # This makefile assumes GCC 4.3 is used and changes will be needed to use other compilers. 5 | # GNU make does not like \r\n line endings so should be saved to CVS in binary form. 6 | # Builds for GTK+ 2 and no longer supports GTK+ 1. 7 | # Also works with ming32-make on Windows. 8 | 9 | .SUFFIXES: .cxx .c .o .h .a 10 | ifdef CLANG 11 | CXX = clang++ -Wno-deprecated-register 12 | CC = clang 13 | # Can choose aspect to sanitize: address and undefined can simply change SANITIZE but for 14 | # thread also need to create Position Independent Executable -> search online documentation 15 | SANITIZE = address 16 | #SANITIZE = undefined 17 | endif 18 | RANLIB = touch 19 | 20 | ifdef GTK3 21 | GTKVERSION=gtk+-3.0 22 | else 23 | GTKVERSION=gtk+-2.0 24 | endif 25 | 26 | # Environment variable windir always defined on Win32 27 | 28 | ifndef windir 29 | ifeq ($(shell uname),Darwin) 30 | RANLIB = ranlib 31 | endif 32 | endif 33 | 34 | ifdef windir 35 | DEL = del /q 36 | COMPLIB=..\bin\scintilla.a 37 | else 38 | DEL = rm -f 39 | COMPLIB=../bin/scintilla.a 40 | SOLIB=../bin/scintilla.so 41 | endif 42 | 43 | vpath %.h ../src ../include ../lexlib 44 | vpath %.cxx ../src ../lexlib ../lexers 45 | 46 | INCLUDEDIRS=-I ../include -I ../src -I ../lexlib 47 | ifdef CHECK_DEPRECATED 48 | DEPRECATED=-DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DDISABLE_GDK_FONT 49 | endif 50 | CXXBASEFLAGS=-Wall -pedantic -DGTK -DSCI_LEXER $(INCLUDEDIRS) $(DEPRECATED) -fPIC 51 | 52 | ifdef NOTHREADS 53 | THREADFLAGS=-DG_THREADS_IMPL_NONE 54 | else 55 | THREADFLAGS= 56 | endif 57 | 58 | ifdef CXX11_REGEX 59 | REFLAGS=-DCXX11_REGEX 60 | endif 61 | 62 | ifdef DEBUG 63 | ifdef CLANG 64 | CTFLAGS=-DDEBUG -g -fsanitize=$(SANITIZE) $(CXXBASEFLAGS) $(THREADFLAGS) 65 | else 66 | CTFLAGS=-DDEBUG -g $(CXXBASEFLAGS) $(THREADFLAGS) 67 | endif 68 | else 69 | CTFLAGS=-DNDEBUG -Os $(CXXBASEFLAGS) $(THREADFLAGS) 70 | endif 71 | 72 | CFLAGS:=$(CTFLAGS) 73 | CXXTFLAGS:=--std=c++0x $(CTFLAGS) $(REFLAGS) 74 | 75 | CONFIGFLAGS:=$(shell pkg-config --cflags $(GTKVERSION)) 76 | MARSHALLER=scintilla-marshal.o 77 | 78 | .cxx.o: 79 | $(CXX) $(CONFIGFLAGS) $(CXXTFLAGS) $(CXXFLAGS) -c $< 80 | .c.o: 81 | $(CC) $(CONFIGFLAGS) $(CFLAGS) -w -c $< 82 | 83 | LEXOBJS:=$(addsuffix .o,$(basename $(notdir $(wildcard ../lexers/Lex*.cxx)))) 84 | 85 | all: $(COMPLIB) $(SOLIB) 86 | 87 | clean: 88 | $(DEL) *.o $(COMPLIB) *.plist 89 | 90 | analyze: 91 | clang --analyze $(CONFIGFLAGS) $(CXXTFLAGS) $(CXXFLAGS) *.cxx ../src/*.cxx ../lexlib/*.cxx ../lexers/*.cxx 92 | 93 | deps: 94 | $(CXX) -MM $(CONFIGFLAGS) $(CXXTFLAGS) *.cxx ../src/*.cxx ../lexlib/*.cxx ../lexers/*.cxx | sed -e 's/\/usr.* //' | grep [a-zA-Z] >deps.mak 95 | 96 | COMPLIBS=Accessor.o CharacterSet.o LexerBase.o LexerModule.o LexerSimple.o StyleContext.o WordList.o \ 97 | CharClassify.o Decoration.o Document.o PerLine.o Catalogue.o CallTip.o CaseConvert.o CaseFolder.o \ 98 | ScintillaBase.o ContractionState.o EditModel.o Editor.o EditView.o ExternalLexer.o MarginView.o \ 99 | PropSetSimple.o PlatGTK.o \ 100 | KeyMap.o LineMarker.o PositionCache.o ScintillaGTK.o CellBuffer.o CharacterCategory.o ViewStyle.o \ 101 | RESearch.o RunStyles.o Selection.o Style.o Indicator.o AutoComplete.o UniConversion.o XPM.o \ 102 | $(MARSHALLER) $(LEXOBJS) 103 | $(COMPLIB): $(COMPLIBS) 104 | $(AR) rc $@ $^ 105 | $(RANLIB) $@ 106 | $(SOLIB): $(COMPLIBS) 107 | $(CC) $(CFLAGS) -shared -o $@ $^ -lm -lstdc++ `pkg-config --libs $(GTKVERSION) gthread-2.0 gmodule-2.0` 108 | 109 | # Automatically generate header dependencies with "make deps" 110 | include deps.mak 111 | -------------------------------------------------------------------------------- /scintilla/scintilla32.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peberlein/WEE/1744f655e3097da221fb8302f84c96a24ca477e1/scintilla/scintilla32.so -------------------------------------------------------------------------------- /scintilla/scintilla32armhf.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peberlein/WEE/1744f655e3097da221fb8302f84c96a24ca477e1/scintilla/scintilla32armhf.so -------------------------------------------------------------------------------- /scintilla/scintilla64.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peberlein/WEE/1744f655e3097da221fb8302f84c96a24ca477e1/scintilla/scintilla64.so -------------------------------------------------------------------------------- /scintilla/scintillaOSX.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peberlein/WEE/1744f655e3097da221fb8302f84c96a24ca477e1/scintilla/scintillaOSX.dylib -------------------------------------------------------------------------------- /ui_gtk.e: -------------------------------------------------------------------------------- 1 | -- ui_gtk.e 2 | 3 | -- A huge thanks to Irv Mullins for making EuGTK, which made the Linux 4 | -- and OSX GTK ports painless. Thanks to Irv for: 5 | -- * focus-in-event for checking modified tabs 6 | -- * current folder for load and save dialogs 7 | -- * window placement taking window theme into account 8 | -- * file dialog filters 9 | -- * menu accelerator appearance 10 | -- * new subs dialog 11 | 12 | -- Changes: 13 | -- fix intermittent hang on quit (found it, caused by putting the program in the 14 | -- background using Ctrl-Z and "bg". It blocks on doing something to console 15 | -- before exiting, so need to do "fg" to unfreeze and exit normally.) 16 | 17 | -- font seems to be ok on OSX now, 18 | -- needed to strip spaces and "bold", "italic", from the font name. 19 | 20 | -- Todo: 21 | -- fix modifier keys not working on OS X (might be ok now using gtk accelerators) 22 | -- menu accelerator labels show up as "-/-" on OS X 23 | -- investigate if widgets need to be Destroy'd 24 | 25 | 26 | public include std/machine.e 27 | public include std/error.e 28 | include std/get.e 29 | include std/regex.e 30 | include std/sort.e 31 | include scintilla.e 32 | include EuGTK/GtkEngine.e 33 | include EuGTK/GtkEvents.e 34 | include wee.exw as wee 35 | include weeicon.e 36 | 37 | -- nifty shortcut, thanks Greg Haberek 38 | function callback(sequence name, atom rid = routine_id(name)) 39 | if rid = -1 then 40 | crash("routine '"&name&"' is not visible") 41 | end if 42 | return call_back(rid) 43 | end function 44 | 45 | -- check to see if 64-bit callback arguments are broken 46 | ifdef BITS64 then 47 | function check_callback_func(atom x) 48 | if x = 0 then 49 | crash("You need a newer 64-bit Euphoria with callback bug fix: 4.1.0 Beta 2 or later") 50 | end if 51 | return 0 52 | end function 53 | 54 | c_proc(define_c_proc("", callback("check_callback_func"), {C_LONG}), 55 | {#100000000}) 56 | end ifdef 57 | 58 | 59 | 60 | wee_init() -- initialize global variables 61 | 62 | x_pos = 100 y_pos = 50 63 | x_size = 500 y_size = 600 64 | 65 | constant wee_conf_file = getenv("HOME") & "/.wee_conf" 66 | load_wee_conf(wee_conf_file) 67 | 68 | -- bind the icon so it won't have to be found at runtime; 69 | constant wee_icon = gtk_func("gdk_pixbuf_new_from_xpm_data", {P}, 70 | {allocate_string_pointer_array(wee_xpm)}) 71 | 72 | -------------------------------------------------- 73 | -- Find dialog 74 | 75 | constant 76 | GTK_RESPONSE_FIND = 1, 77 | GTK_RESPONSE_REPLACE = 2, 78 | GTK_RESPONSE_REPLACE_ALL = 3 79 | 80 | integer find_backward = 0 81 | 82 | procedure find_dialog(integer replace_flag) 83 | atom dialog, content, row, vbox, hbox, lbl, hedit, 84 | find_entry, rep_entry, chk_word, chk_case, chk_backward 85 | integer flags, result, pos 86 | sequence text 87 | 88 | text = get_selection() 89 | if length(text) then 90 | find_phrase = text 91 | end if 92 | 93 | dialog = create(GtkDialog, { 94 | {"border width", 5}, 95 | {"transient for", win}, 96 | {"title", "Find"}, 97 | {"modal", TRUE}, 98 | {"add button", "gtk-close", GTK_RESPONSE_DELETE_EVENT}}) 99 | if replace_flag then 100 | set(dialog, "add button", "Replace All", GTK_RESPONSE_REPLACE_ALL) 101 | set(dialog, "add button", "Replace", GTK_RESPONSE_REPLACE) 102 | end if 103 | set(dialog, "add button", "Find Next", GTK_RESPONSE_FIND) 104 | set(dialog, "default response", GTK_RESPONSE_FIND) 105 | 106 | content = gtk:get(dialog, "content area") 107 | 108 | vbox = create(GtkBox, VERTICAL, 5) 109 | set(vbox, "margin bottom", 5) 110 | add(content, vbox) 111 | 112 | hbox = create(GtkBox, HORIZONTAL, 5) 113 | pack(vbox, hbox) 114 | pack(hbox, create(GtkLabel, "Find What:")) 115 | find_entry = create(GtkEntry, { 116 | {"activates default", TRUE}, 117 | {"text", find_phrase}}) 118 | pack(hbox, find_entry, TRUE, TRUE) 119 | 120 | hedit = tab_hedit() 121 | 122 | if replace_flag then 123 | set(dialog, "default response", GTK_RESPONSE_REPLACE) 124 | hbox = create(GtkBox, HORIZONTAL, 5) 125 | pack(vbox, hbox) 126 | pack(hbox, create(GtkLabel, "Replace With:")) 127 | rep_entry = create(GtkEntry, { 128 | {"activates default", TRUE}, 129 | {"text", replace_phrase}}) 130 | pack(hbox, rep_entry, TRUE, TRUE) 131 | 132 | -- clear the target so that first replace won't reuse old one 133 | SSM(hedit, SCI_SETTARGETSTART, 0) 134 | SSM(hedit, SCI_SETTARGETEND, 0) 135 | end if 136 | 137 | flags = SSM(hedit, SCI_GETSEARCHFLAGS) 138 | 139 | chk_word = create(GtkCheckButton, { 140 | {"label", "Match whole word only"}, 141 | {"active", 0 != and_bits(flags, SCFIND_WHOLEWORD)}}) 142 | pack(vbox, chk_word) 143 | 144 | chk_case = create(GtkCheckButton, { 145 | {"label", "Match case"}, 146 | {"active", 0 != and_bits(flags, SCFIND_MATCHCASE)}}) 147 | pack(vbox, chk_case) 148 | 149 | chk_backward = create(GtkCheckButton, { 150 | {"label", "Search backward"}, 151 | {"active", find_backward}}) 152 | pack(vbox, chk_backward) 153 | 154 | show_all(dialog) 155 | 156 | result = set(dialog, "run") 157 | while result != GTK_RESPONSE_DELETE_EVENT do 158 | flags = 0 159 | if gtk:get(chk_word, "active") then 160 | flags += SCFIND_WHOLEWORD 161 | end if 162 | if gtk:get(chk_case, "active") then 163 | flags += SCFIND_MATCHCASE 164 | end if 165 | find_backward = gtk:get(chk_backward, "active") 166 | 167 | SSM(hedit, SCI_SETSEARCHFLAGS, flags) 168 | find_phrase = gtk:get(find_entry, "text") 169 | 170 | if result = GTK_RESPONSE_FIND then 171 | if search_find(find_phrase, find_backward) = 0 then 172 | Info(dialog, "Find", "Unable to find a match.") 173 | end if 174 | else 175 | replace_phrase = gtk:get(rep_entry, "text") 176 | if result = GTK_RESPONSE_REPLACE_ALL then 177 | result = search_replace_all(find_phrase, replace_phrase) 178 | if result then 179 | Info(dialog, "Replace All", sprintf("%d replacements.", {result})) 180 | else 181 | Info(dialog, "Replace All", "Unable to find a match.") 182 | end if 183 | else 184 | result = search_replace(replace_phrase) 185 | if search_find(find_phrase, find_backward) = 0 and result = 0 then 186 | Info(dialog, "Replace", "Unable to find a match.") 187 | end if 188 | end if 189 | end if 190 | result = set(dialog, "run") 191 | end while 192 | hide(dialog) 193 | return 194 | end procedure 195 | 196 | 197 | -------------------------------------------------- 198 | -- functions called from menu items 199 | 200 | function FileNew() new_file() return 0 end function 201 | function FileOpen() open_file("", 0) return 0 end function 202 | function FileSave() save_if_modified(0) return 0 end function 203 | function FileSaveAs() save_file_as() return 0 end function 204 | function FileClose() close_tab() return 0 end function 205 | function FileQuit() 206 | if save_modified_tabs() then 207 | save_wee_conf(wee_conf_file) 208 | Quit() 209 | end if 210 | return 0 211 | end function 212 | function EditUndo() SSM(tab_hedit(), SCI_UNDO) return 0 end function 213 | function EditRedo() SSM(tab_hedit(), SCI_REDO) return 0 end function 214 | function EditCut() SSM(tab_hedit(), SCI_CUT) return 0 end function 215 | function EditCopy() SSM(tab_hedit(), SCI_COPY) return 0 end function 216 | function EditPaste() SSM(tab_hedit(), SCI_PASTE) return 0 end function 217 | function EditClear() SSM(tab_hedit(), SCI_CLEAR) return 0 end function 218 | function EditSelectAll() SSM(tab_hedit(), SCI_SELECTALL) return 0 end function 219 | function EditToggleComment() toggle_comment() return 0 end function 220 | function SearchFind() find_dialog(0) return 0 end function 221 | function SearchFindNext() 222 | if length(find_phrase) = 0 then 223 | return SearchFind() 224 | end if 225 | search_find(find_phrase, 0) 226 | return 0 227 | end function 228 | function SearchFindPrevious() search_find(find_phrase, 1) return 0 end function 229 | function SearchReplace() find_dialog(1) return 0 end function 230 | function ViewDecl() view_declaration() return 0 end function 231 | function ViewArgs() view_subroutine_arguments() return 0 end function 232 | function ViewComp() view_completions() return 0 end function 233 | function ViewError() ui_view_error() return 0 end function 234 | function GoBack() go_back() return 0 end function 235 | 236 | function OldViewSubs() 237 | sequence text, word, subs, tmp 238 | integer pos, result 239 | atom dialog, scroll, list, content, row, lbl 240 | 241 | text = get_edit_text() 242 | pos = get_pos() 243 | word = word_pos(text, pos) 244 | tmp = get_subroutines(parse(text, file_name)) 245 | word = word[1] 246 | 247 | subs = repeat(0, floor(length(tmp)/2)) 248 | for i = 1 to length(subs) do 249 | subs[i] = {tmp[i*2-1], tmp[i*2]} 250 | end for 251 | if sorted_subs then 252 | subs = sort(subs) 253 | end if 254 | 255 | dialog = create(GtkDialog, { 256 | {"border width", 5}, 257 | {"default size", 200, 400}, 258 | {"add button", "gtk-close", GTK_RESPONSE_CLOSE}, 259 | {"add button", "gtk-ok", GTK_RESPONSE_OK}, 260 | {"transient for", win}, 261 | {"title", "Subroutines"}, 262 | {"default response", GTK_RESPONSE_OK}, 263 | {"modal", TRUE}}) 264 | 265 | content = gtk:get(dialog, "content area") 266 | scroll = create(GtkScrolledWindow) 267 | pack(content, scroll, TRUE, TRUE) 268 | 269 | list = create(GtkListBox) 270 | add(scroll, list) 271 | for i = 1 to length(subs) do 272 | lbl = create(GtkLabel, subs[i][1]) 273 | set(lbl, "halign", GTK_ALIGN_START) 274 | set(list, "insert", lbl, -1) 275 | if equal(subs[i][1], word) then 276 | row = gtk:get(list, "row at index", i-1) 277 | set(list, "select row", row) 278 | end if 279 | end for 280 | 281 | show_all(dialog) 282 | if set(dialog, "run") = GTK_RESPONSE_OK then 283 | row = gtk:get(list, "selected row") 284 | --result = gtk:get(row, "index") -- doesn't work? 285 | for i = 1 to length(subs) do 286 | if row = gtk:get(list, "row at index", i-1) then 287 | word = subs[i][1] 288 | pos = subs[i][2] 289 | goto_pos(pos, length(word)) 290 | exit 291 | end if 292 | end for 293 | end if 294 | hide(dialog) 295 | return 0 296 | end function 297 | 298 | function RowActivated(atom ctl, atom path, atom col, atom dialog) 299 | --? {ctl, path, col, dialog} 300 | set(dialog, "response", GTK_RESPONSE_OK) 301 | return 0 302 | end function 303 | constant row_activated = callback("RowActivated") 304 | 305 | -- contributed by Irv 306 | function ViewSubs() 307 | sequence text, word, subs 308 | integer pos, result 309 | atom dialog, scroll, list, content, row, lbl 310 | 311 | text = get_edit_text() 312 | pos = get_pos() 313 | word = word_pos(text, pos) 314 | subs = get_subroutines(parse(text, file_name)) 315 | word = word[1] 316 | 317 | dialog = create(GtkDialog, { 318 | {"border width", 5}, 319 | {"default size", 200, 400}, 320 | {"add button", "gtk-close", GTK_RESPONSE_CLOSE}, 321 | {"add button", "gtk-ok", GTK_RESPONSE_OK}, 322 | {"transient for", win}, 323 | {"title", "Subroutines"}, 324 | {"default response", GTK_RESPONSE_OK}, 325 | {"modal", TRUE}}) 326 | 327 | content = gtk:get(dialog, "content area") 328 | scroll = create(GtkScrolledWindow) 329 | pack(content, scroll, TRUE, TRUE) 330 | 331 | object routines = subs, data 332 | if sorted_subs then 333 | routines = sort(routines) 334 | end if 335 | 336 | list = create(GtkTreeView) 337 | add(scroll, list) 338 | object store = create(GtkListStore, {gSTR, gINT}) 339 | set(list, "model", store) 340 | object col1 = create(GtkTreeViewColumn) 341 | object rend1 = create(GtkCellRendererText) 342 | add(col1, rend1) 343 | set(col1, "add attribute", rend1, "text", 1) 344 | set(col1, "sort indicator", TRUE) 345 | set(col1, "max width", 100) 346 | set(col1, "title", "Routine Name") 347 | set(list, "append columns", col1) 348 | 349 | object col2 = create(GtkTreeViewColumn) 350 | object rend2 = create(GtkCellRendererText) 351 | add(col2, rend2) 352 | set(col2, "add attribute", rend2, "text", 2) 353 | set(list, "append columns", col2) 354 | set(store, "data", routines) 355 | 356 | object selection = gtk:get(list,"selection") 357 | set(selection, "mode", GTK_SELECTION_SINGLE) 358 | set(col2, "visible", FALSE) 359 | 360 | set(col1, "sort column id", 1) 361 | connect(list, "row-activated", row_activated, dialog) 362 | 363 | show_all(dialog) 364 | if gtk:get(dialog, "run") = GTK_RESPONSE_OK then 365 | row = gtk:get(selection, "selected row") 366 | data = gtk:get(store, "row data", row) 367 | word = data[1] 368 | pos = data[2] 369 | goto_pos(pos, length(word)) 370 | end if 371 | hide(dialog) 372 | 373 | return 0 374 | end function 375 | 376 | function OptionsFont() 377 | atom dialog 378 | sequence font, tmp 379 | 380 | dialog = create(GtkFontChooserDialog, "Font...", win) 381 | set(dialog, "font", sprintf("%s %d", {font_name, font_height})) 382 | if set(dialog, "run") = MB_OK then 383 | font = gtk:get(dialog, "font") 384 | for i = length(font) to 1 by -1 do 385 | if font[i] = ' ' then 386 | tmp = value(font[i+1..$]) 387 | if tmp[1] = 0 then 388 | font_height = tmp[2] 389 | font_name = font[1..i-1] 390 | --printf(1, "%s %d\n", {font_name, font_height}) 391 | reinit_all_edits() 392 | end if 393 | exit 394 | end if 395 | end for 396 | end if 397 | set(dialog, "hide") 398 | 399 | return 0 400 | end function 401 | 402 | function RunColorDialog(integer color) 403 | object ccd = create(GtkColorChooserDialog, { 404 | {"title", "Select a color"}, 405 | {"transient for", win}, 406 | {"use alpha", FALSE}, 407 | {"rgba", sprintf("#%02x%02x%02x", 408 | and_bits(floor(color/{1,#100,#10000}),#FF))}}) 409 | if gtk:get(ccd, "run") = MB_OK then 410 | color = gtk:get(ccd, "rgba", 2) 411 | color = floor(and_bits(color, #FF0000) / #10000) + 412 | and_bits(color, #FF00) + and_bits(color, #FF) * #10000 413 | end if 414 | set(ccd, "hide") 415 | return color 416 | end function 417 | 418 | function ColorButton(atom ctl, atom w) 419 | if w = 1 then 420 | normal_color = RunColorDialog(normal_color) 421 | elsif w = 2 then 422 | background_color = RunColorDialog(background_color) 423 | elsif w = 3 then 424 | comment_color = RunColorDialog(comment_color) 425 | elsif w = 4 then 426 | string_color = RunColorDialog(string_color) 427 | elsif w = 5 then 428 | keyword_color = RunColorDialog(keyword_color) 429 | elsif w = 6 then 430 | builtin_color = RunColorDialog(builtin_color) 431 | elsif w = 7 then 432 | number_color = RunColorDialog(number_color) 433 | elsif w = 8 then 434 | bracelight_color = RunColorDialog(bracelight_color) 435 | elsif w = 9 then 436 | linenumber_color = RunColorDialog(linenumber_color) 437 | end if 438 | reinit_all_edits() 439 | return 0 440 | end function 441 | 442 | function BoldToggle(atom ctl, atom flag) 443 | if gtk:get(ctl, "active") then 444 | bold_flags = or_bits(bold_flags, flag) 445 | else 446 | bold_flags = and_bits(bold_flags, not_bits(flag)) 447 | end if 448 | reinit_all_edits() 449 | return 0 450 | end function 451 | 452 | constant color_button = callback("ColorButton") 453 | constant bold_toggle = callback("BoldToggle") 454 | 455 | function OptionsColors() 456 | atom dialog, grid 457 | 458 | dialog = create(GtkDialog, { 459 | {"border width", 5}, 460 | {"default size", 200, 300}, 461 | {"add button", "gtk-close", GTK_RESPONSE_CLOSE}, 462 | {"transient for", win}, 463 | {"title", "Colors"}, 464 | {"default response", GTK_RESPONSE_OK}, 465 | {"modal", TRUE}}) 466 | 467 | grid = create(GtkGrid, VERTICAL) 468 | set(grid, "margin bottom", 5) 469 | add(gtk:get(dialog, "content area"), grid) 470 | 471 | set(grid, { 472 | {"row spacing", 2}, 473 | {"column spacing", 2}, 474 | {"attach", create(GtkButton, "Normal", color_button, 1), 1, 2, 1, 1}, 475 | {"attach", create(GtkButton, "Background", color_button, 2), 1, 3, 1, 1}, 476 | {"attach", create(GtkButton, "Comment", color_button, 3), 1, 4, 1, 1}, 477 | {"attach", create(GtkButton, "String", color_button, 4), 1, 5, 1, 1}, 478 | {"attach", create(GtkButton, "Keyword", color_button, 5), 1, 6, 1, 1}, 479 | {"attach", create(GtkButton, "Built-in", color_button, 6), 1, 7, 1, 1}, 480 | {"attach", create(GtkButton, "Number", color_button, 7), 1, 8, 1, 1}, 481 | {"attach", create(GtkButton, "Brace Highlight", color_button, 8), 1, 9, 1, 1}, 482 | {"attach", create(GtkButton, "Line Number", color_button, 9), 1, 10, 1, 1}, 483 | {"attach", create(GtkCheckButton, { 484 | {"label", "Bold"}, {"active", 0 != and_bits(bold_flags, 1)}}, 485 | bold_toggle, 1), 2, 2, 1, 1}, 486 | {"attach", create(GtkCheckButton, { 487 | {"label", "Bold"}, {"active", 0 != and_bits(bold_flags, 2)}}, 488 | bold_toggle, 2), 2, 4, 1, 1}, 489 | {"attach", create(GtkCheckButton, { 490 | {"label", "Bold"}, {"active", 0 != and_bits(bold_flags, 4)}}, 491 | bold_toggle, 4), 2, 5, 1, 1}, 492 | {"attach", create(GtkCheckButton, { 493 | {"label", "Bold"}, {"active", 0 != and_bits(bold_flags, 8)}}, 494 | bold_toggle, 8), 2, 6, 1, 1}, 495 | {"attach", create(GtkCheckButton, { 496 | {"label", "Bold"}, {"active", 0 != and_bits(bold_flags, #10)}}, 497 | bold_toggle, #10), 2, 7, 1, 1}, 498 | {"attach", create(GtkCheckButton, { 499 | {"label", "Bold"}, {"active", 0 != and_bits(bold_flags, #20)}}, 500 | bold_toggle, #20), 2, 8, 1, 1}, 501 | {"attach", create(GtkCheckButton, { 502 | {"label", "Bold"}, {"active", 0 != and_bits(bold_flags, #40)}}, 503 | bold_toggle, #40), 2, 9, 1, 1} 504 | }) 505 | 506 | show_all(dialog) 507 | set(dialog, "run") 508 | set(dialog, "hide") 509 | return 0 510 | end function 511 | 512 | function OptionsLineNumbers(atom handle) 513 | line_numbers = gtk:get(handle, "active") 514 | reinit_all_edits() 515 | return 0 516 | end function 517 | 518 | function OptionsSortedSubs(atom handle) 519 | sorted_subs = gtk:get(handle, "active") 520 | return 0 521 | end function 522 | 523 | function OptionsLineWrap(atom handle) 524 | line_wrap = gtk:get(handle, "active") 525 | reinit_all_edits() 526 | return 0 527 | end function 528 | 529 | function OptionsReopenTabs(atom handle) 530 | reopen_tabs = gtk:get(handle, "active") 531 | return 0 532 | end function 533 | 534 | function OptionsCompleteStatements(atom handle) 535 | complete_statements = gtk:get(handle, "active") 536 | return 0 537 | end function 538 | 539 | function OptionsCompleteBraces(atom handle) 540 | complete_braces = gtk:get(handle, "active") 541 | return 0 542 | end function 543 | 544 | function OptionsErrorIndicators(atom handle) 545 | auto_indicator = gtk:get(handle, "active") 546 | return 0 547 | end function 548 | 549 | function OptionsIndent(atom handle) 550 | atom dialog, panel, hbox, hedit, indent_entry, tabs_entry, chk_guides, chk_usetabs 551 | integer indent_width, tab_width, use_tabs 552 | sequence val 553 | 554 | hedit = tab_hedit() 555 | tab_width = SSM(hedit, SCI_GETTABWIDTH) 556 | indent_width = SSM(hedit, SCI_GETINDENT) 557 | use_tabs = SSM(hedit, SCI_GETUSETABS) 558 | 559 | dialog = create(GtkDialog, { 560 | {"border width", 5}, 561 | {"add button", "gtk-close", GTK_RESPONSE_DELETE_EVENT}, 562 | {"add button", "gtk-ok", GTK_RESPONSE_OK}, 563 | {"transient for", win}, 564 | {"title", "Indent"}, 565 | {"default response", GTK_RESPONSE_OK}, 566 | {"modal", TRUE}}) 567 | 568 | panel = create(GtkBox, VERTICAL, 5) 569 | set(panel, "margin bottom", 5) 570 | add(gtk:get(dialog, "content area"), panel) 571 | 572 | hbox = create(GtkBox, HORIZONTAL, 5) 573 | add(panel, hbox) 574 | add(hbox, create(GtkLabel, "Indent Size")) 575 | 576 | indent_entry = create(GtkEntry, { 577 | {"text", sprintf("%d", {indent_width})}}) 578 | add(hbox, indent_entry) 579 | 580 | chk_guides = create(GtkCheckButton, { 581 | {"label", "Show indentation guides"}, 582 | {"active", indentation_guides}}) 583 | pack(panel, chk_guides) 584 | 585 | chk_usetabs = create(GtkCheckButton, { 586 | {"label", "Use tabs in indentation"}, 587 | {"active", use_tabs}}) 588 | pack(panel, chk_usetabs) 589 | 590 | hbox = create(GtkBox, HORIZONTAL, 5) 591 | add(panel, hbox) 592 | add(hbox, create(GtkLabel, "Tab Size")) 593 | 594 | tabs_entry = create(GtkEntry, { 595 | {"text", sprintf("%d", {tab_width})}}) 596 | add(hbox, tabs_entry) 597 | 598 | show_all(dialog) 599 | while set(dialog, "run") = GTK_RESPONSE_OK do 600 | 601 | val = value(gtk:get(indent_entry, "text")) 602 | if val[1] = 0 and integer(val[2]) and val[2] >= 1 and val[2] <= 8 then 603 | indent_width = val[2] 604 | else 605 | set(indent_entry, "grab focus") 606 | continue 607 | end if 608 | 609 | val = value(gtk:get(tabs_entry, "text")) 610 | if val[1] = 0 and integer(val[2]) and val[2] >= 1 and val[2] <= 8 then 611 | tab_width = val[2] 612 | else 613 | set(tabs_entry, "grab focus") 614 | continue 615 | end if 616 | 617 | use_tabs = gtk:get(chk_usetabs, "active") 618 | indentation_guides = gtk:get(chk_guides, "active") 619 | 620 | SSM(hedit, SCI_SETTABWIDTH, tab_width) 621 | SSM(hedit, SCI_SETINDENT, indent_width) 622 | SSM(hedit, SCI_SETUSETABS, use_tabs) 623 | reinit_all_edits() 624 | exit 625 | 626 | end while 627 | hide(dialog) 628 | return 0 629 | end function 630 | 631 | -- runs the script, maybe in a terminal emulator 632 | procedure Run(sequence script) 633 | sequence tmp_name = sprintf("/tmp/wee_run_%d.sh", {rand(1000000)}) 634 | sequence cmd = tmp_name 635 | if length(terminal_program) then 636 | if run_waitkey then 637 | -- need bash for "read -n" 638 | script = "#!/bin/bash\n" & 639 | -- don't show "Press Enter" on errors 640 | match_replace("eui ", script, "eui -batch ") & 641 | "\nread -n1 -s -p \"Press any key...\"\n" 642 | end if 643 | cmd = terminal_program & ' ' & tmp_name 644 | end if 645 | -- write script file 646 | if write_file(tmp_name, script) = -1 then 647 | printf(2, "Failed to write file %s\n", {tmp_name}) 648 | return 649 | end if 650 | -- remove script after running it 651 | cmd &= "; rm " & tmp_name 652 | if run_background then 653 | -- put the command in background 654 | cmd = "(" & cmd & ") &" 655 | end if 656 | -- make script executable and run it 657 | system("chmod +x " & tmp_name & "; " & cmd) 658 | end procedure 659 | 660 | function RunStart(atom ctl) 661 | object lbl = gtk:get(ctl, "label") 662 | sequence cmd = "" 663 | 664 | if save_if_modified(0) = 0 or length(file_name) = 0 then 665 | return 0 -- cancelled, or no name 666 | end if 667 | 668 | run_file_name = file_name 669 | cmd = "cd " & dirname(run_file_name) & "\n" 670 | if match("Start", lbl) = 1 then 671 | reset_ex_err() 672 | cmd &= get_eu_bin(interpreter) & ' ' & quote_spaces(file_name) 673 | if not equal(lbl, "Start") then -- with arguments 674 | if length(get_tab_arguments()) = 0 then 675 | if RunSetArguments() then 676 | return 0 677 | end if 678 | end if 679 | cmd &= ' ' & get_tab_arguments() 680 | end if 681 | Run(cmd) 682 | check_ex_err() 683 | elsif equal(lbl, "Bind") then 684 | cmd &= get_eu_bin("eubind") & ' ' & quote_spaces(file_name) 685 | cmd &= "\nwhich upx && upx " & filebase(file_name) 686 | if run_testrun then 687 | cmd &= "\n./" & filebase(file_name) 688 | end if 689 | Run(cmd) 690 | elsif equal(lbl, "Shroud") then 691 | cmd &= get_eu_bin("eushroud") & ' ' & quote_spaces(file_name) 692 | if run_testrun then 693 | cmd &= "\n./" & filebase(file_name) & ".il" 694 | end if 695 | Run(cmd) 696 | elsif equal(lbl, "Translate and Compile") then 697 | cmd &= get_eu_bin("euc") & ' ' & quote_spaces(file_name) 698 | cmd &= "\nwhich upx && upx " & filebase(file_name) 699 | if run_testrun then 700 | cmd &= "\n./" & filebase(file_name) 701 | end if 702 | Run(cmd) 703 | elsif equal(lbl, "Run Terminal Emulator") then 704 | Run(cmd & "$SHELL") 705 | else 706 | crash("Unable to get menu label") 707 | end if 708 | return 0 709 | end function 710 | 711 | function RunSetArguments() 712 | atom dialog, content, text_entry, result = -1 713 | 714 | dialog = create(GtkDialog, { 715 | {"border width", 5}, 716 | {"add button", "gtk-close", GTK_RESPONSE_DELETE_EVENT}, 717 | {"add button", "gtk-ok", GTK_RESPONSE_OK}, 718 | {"transient for", win}, 719 | {"title", "Arguments"}, 720 | {"default response", GTK_RESPONSE_OK}, 721 | {"modal", TRUE}}) 722 | content = gtk:get(dialog, "content area") 723 | 724 | text_entry = create(GtkEntry, { 725 | {"activates default", TRUE}, 726 | {"text", get_tab_arguments()}, 727 | {"margin bottom", 5}}) 728 | add(content, text_entry) 729 | 730 | show_all(dialog) 731 | if set(dialog, "run") = GTK_RESPONSE_OK then 732 | set_tab_arguments(gtk:get(text_entry, "text")) 733 | result = 0 734 | end if 735 | hide(dialog) 736 | return result 737 | end function 738 | 739 | function ChooseInterpreter(atom ctl, atom text_entry) 740 | atom dialog 741 | sequence filenames 742 | 743 | dialog = create(GtkFileChooserDialog, { 744 | {"title", "Open..."}, 745 | {"transient for", win}, 746 | {"action", GTK_FILE_CHOOSER_ACTION_OPEN}, 747 | {"add button", "gtk-cancel", GTK_RESPONSE_CLOSE}, 748 | {"add button", "gtk-ok", GTK_RESPONSE_OK}, 749 | {"position", GTK_WIN_POS_MOUSE}, 750 | {"current folder", pathname(canonical_path(interpreter))}}) 751 | 752 | if gtk:get(dialog, "run") = GTK_RESPONSE_OK then 753 | set(text_entry, "prepend text", gtk:get(dialog, "filename")) 754 | set(text_entry, "active", 1) 755 | end if 756 | set(dialog, "hide") 757 | return 0 758 | end function 759 | 760 | constant choose_interpreter = callback("ChooseInterpreter") 761 | 762 | function RunSetInterpreter() 763 | atom dialog, text_entry, panel, row 764 | sequence interpreters = get_interpreters() 765 | integer index 766 | 767 | dialog = create(GtkDialog, { 768 | {"border width", 5}, 769 | {"add button", "gtk-close", GTK_RESPONSE_DELETE_EVENT}, 770 | {"add button", "gtk-ok", GTK_RESPONSE_OK}, 771 | {"transient for", win}, 772 | {"title", "Choose Interpreter"}, 773 | {"default response", GTK_RESPONSE_OK}, 774 | {"modal", TRUE}}) 775 | 776 | panel = create(GtkBox, VERTICAL, 5) 777 | set(panel, "margin bottom", 5) 778 | add(gtk:get(dialog, "content area"), panel) 779 | 780 | pack(panel, create(GtkLabel, 781 | `Enter an interpreter to use to run programs, or select one from the list. 782 | Leave blank to use the default first item in the list.`)) 783 | 784 | row = create(GtkBox, HORIZONTAL, 5) 785 | pack(panel, row, TRUE) 786 | 787 | text_entry = create(GtkComboBoxEntry, { 788 | {"margin bottom", 5}, 789 | {"activates default", TRUE}}) 790 | pack(row, text_entry, TRUE, TRUE) 791 | if length(interpreters) then 792 | add(text_entry, interpreters) 793 | index = find(interpreter, interpreters) 794 | if index then 795 | set(text_entry, "active", index) 796 | end if 797 | end if 798 | pack(row, create(GtkButton, "...", choose_interpreter, text_entry)) 799 | 800 | show_all(dialog) 801 | if set(dialog, "run") = GTK_RESPONSE_OK then 802 | interpreter = gtk:get(text_entry, "active text") 803 | end if 804 | hide(dialog) 805 | return 0 806 | end function 807 | 808 | constant terminals = {"x-terminal-emulator", "urxvt", "rxvt", 809 | "terminator", "Eterm", "aterm", "xterm", "gnome-terminal", 810 | "roxterm", "xfce4-terminal", "termite", "lxterminal", 811 | "mate-terminal", "terminology"} 812 | 813 | function RunSetTerminal() 814 | atom dialog, text_entry, panel 815 | sequence text 816 | integer n = 0 817 | 818 | dialog = create(GtkDialog, { 819 | {"border width", 5}, 820 | {"add button", "gtk-close", GTK_RESPONSE_DELETE_EVENT}, 821 | {"add button", "gtk-ok", GTK_RESPONSE_OK}, 822 | {"transient for", win}, 823 | {"title", "Choose Terminal Emulator"}, 824 | {"default response", GTK_RESPONSE_OK}, 825 | {"modal", TRUE}}) 826 | 827 | panel = create(GtkBox, VERTICAL, 5) 828 | set(panel, "margin bottom", 5) 829 | add(gtk:get(dialog, "content area"), panel) 830 | 831 | pack(panel, create(GtkLabel, 832 | `Enter a terminal emulator to use to run programs, or select one 833 | from the list. Leave blank to run in parent terminal.`)) 834 | 835 | text_entry = create(GtkComboBoxEntry, { 836 | {"margin bottom", 5}, 837 | {"activates default", TRUE}}) 838 | pack(panel, text_entry) 839 | for i = 1 to length(terminals) do 840 | if system_exec("which " & terminals[i] & " >/dev/null 2>&1") = 0 then 841 | text = terminals[i] 842 | if find(text, {"gnome-terminal", "xfce4-terminal"}) then 843 | text &= " -x" 844 | else 845 | text &= " -e" 846 | end if 847 | add(text_entry, {text}) 848 | n += 1 849 | if equal(text, terminal_program) then 850 | set(text_entry, "active", n) 851 | end if 852 | end if 853 | end for 854 | if length(terminal_program) and gtk:get(text_entry, "active") = 0 then 855 | set(text_entry, "prepend text", terminal_program) 856 | set(text_entry, "active", 1) 857 | end if 858 | 859 | show_all(dialog) 860 | if set(dialog, "run") = GTK_RESPONSE_OK then 861 | terminal_program = gtk:get(text_entry, "active text") 862 | end if 863 | hide(dialog) 864 | return 0 865 | end function 866 | 867 | function RunTestRun(atom handle) 868 | run_testrun = gtk:get(handle, "active") 869 | return 0 870 | end function 871 | 872 | function RunBackground(atom handle) 873 | run_background = gtk:get(handle, "active") 874 | return 0 875 | end function 876 | 877 | function RunWaitKey(atom handle) 878 | run_waitkey = gtk:get(handle, "active") 879 | return 0 880 | end function 881 | 882 | function HelpAbout() 883 | set(about_dialog, "run") 884 | set(about_dialog, "hide") 885 | return 0 886 | end function 887 | 888 | function HelpReleaseNotes() 889 | release_notes() 890 | return 0 891 | end function 892 | 893 | function HelpTutorial() 894 | open_tutorial() 895 | return 0 896 | end function 897 | 898 | function HelpHelp() 899 | context_help() 900 | return 0 901 | end function 902 | 903 | -------------------------------------- 904 | -- functions called from window events 905 | 906 | -- this gets called when window is moved or resized 907 | function configure_event(atom w, atom s) 908 | atom left_margin, top_margin -- not used, just for show 909 | {left_margin, top_margin, x_size, y_size} = 910 | gtk:get(gtk:get(w, "window"), "geometry") 911 | {x_pos, y_pos} = gtk:get(w, "position") 912 | return 0 913 | end function 914 | 915 | -- called before window is closed, return TRUE to prevent close, otherwise FALSE 916 | function delete_event() 917 | if save_modified_tabs() then 918 | save_wee_conf(wee_conf_file) 919 | return FALSE 920 | end if 921 | return TRUE 922 | end function 923 | 924 | function window_set_focus(atom widget) 925 | check_externally_modified_tabs() 926 | check_ex_err() 927 | return 0 928 | end function 929 | 930 | ------------------------------------------------------------- 931 | 932 | constant 933 | group = create(GtkAccelGroup), 934 | win = create(GtkWindow, { 935 | {"border width", 0}, 936 | {"add accel group", group}, 937 | {"default size", x_size, y_size}, 938 | {"move", x_pos, y_pos}}), 939 | panel = create(GtkBox, VERTICAL) 940 | 941 | gtk_func("gtk_window_set_icon", {P,P}, {win, wee_icon}) 942 | connect(win, "destroy", main_quit) 943 | connect(win, "configure-event", callback("configure_event")) 944 | connect(win, "delete-event", callback("delete_event")) 945 | connect(win, "focus-in-event", callback("window_set_focus")) 946 | add(win, panel) 947 | 948 | constant 949 | about_dialog = create(GtkAboutDialog, { 950 | {"transient for", win}, 951 | {"name", "about:dialog"}, 952 | {"program name", window_title}, 953 | {"comments", "A small editor for Euphoria programming."}, 954 | {"version", wee:version}, 955 | {"authors", {author, "EuGTK by Irv Mullins http://sites.google.com/site/euphoriagtk/Home/"}}, 956 | {"website", "https://github.com/peberlein/WEE/"}, 957 | {"website label", "Wee on GitHub"}, 958 | {"logo", wee_icon} 959 | }) 960 | 961 | 962 | constant 963 | menubar = create(GtkMenuBar), 964 | menuFile = create(GtkMenuItem, "_File"), 965 | menuEdit = create(GtkMenuItem, "_Edit"), 966 | menuSearch = create(GtkMenuItem, "_Search"), 967 | menuView = create(GtkMenuItem, "_View"), 968 | menuRun = create(GtkMenuItem, "_Run"), 969 | menuOptions = create(GtkMenuItem, "_Options"), 970 | menuHelp = create(GtkMenuItem, "_Help"), 971 | filemenu = create(GtkMenu, {{"accel group", group}}), 972 | editmenu = create(GtkMenu, {{"accel group", group}}), 973 | searchmenu = create(GtkMenu, {{"accel group", group}}), 974 | viewmenu = create(GtkMenu, {{"accel group", group}}), 975 | runmenu = create(GtkMenu, {{"accel group", group}}), 976 | optionsmenu = create(GtkMenu, {{"accel group", group}}), 977 | helpmenu = create(GtkMenu, {{"accel group", group}}), 978 | chooseinterpreter_menu = create(GtkMenu), 979 | tabmenu = create(GtkMenu) 980 | 981 | -- create a menu item with "activate" signal connected to local routine 982 | -- and add parsed accelerator key 983 | function createmenuitem(sequence text, object r, object key = 0, object check = -1) 984 | atom widget, x 985 | if equal(check, -1) or sequence(check) then 986 | if sequence(key) then 987 | widget = create(GtkMenuItem, text, 0, 0, {group, key}) 988 | if sequence(check) then 989 | -- check could be a second accelerator 990 | set(widget, "add accelerator", {group, check}) 991 | end if 992 | else 993 | widget = create(GtkMenuItem, text) 994 | end if 995 | else 996 | widget = create(GtkCheckMenuItem, text) 997 | set(widget, "active", check) 998 | end if 999 | if sequence(r) then 1000 | x = routine_id(r) 1001 | if x <= 0 then 1002 | crash(r &" is not a visible function") 1003 | end if 1004 | r = call_back(x) 1005 | end if 1006 | connect(widget, "activate", r) 1007 | return widget 1008 | end function 1009 | 1010 | add(filemenu, { 1011 | createmenuitem("_New", "FileNew", "N"), 1012 | createmenuitem("_Open...", "FileOpen", "O"), 1013 | createmenuitem("_Save", "FileSave", "S"), 1014 | createmenuitem("Save _As...", "FileSaveAs", "S"), 1015 | createmenuitem("_Close", "FileClose", "W"), 1016 | create(GtkSeparatorMenuItem), 1017 | createmenuitem("_Quit", "FileQuit", "Q") 1018 | }) 1019 | set(menuFile, "submenu", filemenu) 1020 | 1021 | add(editmenu, { 1022 | createmenuitem("_Undo", "EditUndo", "Z"), 1023 | createmenuitem("_Redo", "EditRedo", "Z"), 1024 | create(GtkSeparatorMenuItem), 1025 | createmenuitem("_Cut", "EditCut", "X"), 1026 | createmenuitem("C_opy", "EditCopy", "C"), 1027 | createmenuitem("_Paste", "EditPaste", "V"), 1028 | createmenuitem("Clear", "EditClear"), 1029 | createmenuitem("Select _All", "EditSelectAll", "A"), 1030 | create(GtkSeparatorMenuItem), 1031 | createmenuitem("Toggle Comment", "EditToggleComment", "M") 1032 | }) 1033 | set(menuEdit, "submenu", editmenu) 1034 | 1035 | add(searchmenu, { 1036 | createmenuitem("Find...", "SearchFind", "F", "F3"), 1037 | createmenuitem("Find Next", "SearchFindNext", "G", "F3"), 1038 | createmenuitem("Find Previous", "SearchFindPrevious", "G", "F3"), 1039 | createmenuitem("Replace...", "SearchReplace", "R") 1040 | }) 1041 | set(menuSearch, "submenu", searchmenu) 1042 | 1043 | add(viewmenu, { 1044 | createmenuitem("Subroutines...", "ViewSubs", "F2"), 1045 | createmenuitem("Declaration", "ViewDecl", "D", "F2"), 1046 | createmenuitem("Subroutine Arguments...", "ViewArgs", "F2"), 1047 | createmenuitem("Completions...", "ViewComp", "space"), 1048 | createmenuitem("Goto Error", "ViewError", "F4"), 1049 | createmenuitem("Go Back", "GoBack", "Escape") 1050 | }) 1051 | set(menuView, "submenu", viewmenu) 1052 | 1053 | add(runmenu, { 1054 | createmenuitem("Start", "RunStart", "F5"), 1055 | createmenuitem("Start with Arguments", "RunStart", "F5"), 1056 | createmenuitem("Set Arguments...", "RunSetArguments"), 1057 | createmenuitem("Run In Background", "RunBackground", 0, run_background), 1058 | create(GtkSeparatorMenuItem), 1059 | createmenuitem("Set Interpreter...", "RunSetInterpreter"), 1060 | createmenuitem("Set Terminal Emulator...", "RunSetTerminal"), 1061 | createmenuitem("Run Terminal Emulator", "RunStart"), 1062 | createmenuitem("Wait for Keypress after Run in Terminal", "RunWaitKey", 0, run_waitkey), 1063 | create(GtkSeparatorMenuItem), 1064 | createmenuitem("Bind", "RunStart"), 1065 | createmenuitem("Shroud", "RunStart"), 1066 | createmenuitem("Translate and Compile", "RunStart", "F9"), 1067 | create(GtkSeparatorMenuItem), 1068 | createmenuitem("Test Run after Bind/Shroud/Translate", "RunTestRun", 0, run_testrun) 1069 | }) 1070 | set(menuRun, "submenu", runmenu) 1071 | 1072 | add(optionsmenu, { 1073 | createmenuitem("Font...", "OptionsFont"), 1074 | createmenuitem("Line Numbers", "OptionsLineNumbers", 0, line_numbers), 1075 | createmenuitem("Sort View Subroutines", "OptionsSortedSubs", 0, sorted_subs), 1076 | createmenuitem("Colors...", "OptionsColors"), 1077 | createmenuitem("Line Wrap", "OptionsLineWrap", 0, line_wrap), 1078 | createmenuitem("Reopen Tabs Next Time", "OptionsReopenTabs", 0, reopen_tabs), 1079 | createmenuitem("Complete Statements", "OptionsCompleteStatements", 0, complete_statements), 1080 | createmenuitem("Complete Braces", "OptionsCompleteBraces", 0, complete_braces), 1081 | createmenuitem("Indent...", "OptionsIndent"), 1082 | createmenuitem("Error Indicators", "OptionsErrorIndicators", 0, auto_indicator) 1083 | }) 1084 | set(menuOptions, "submenu", optionsmenu) 1085 | 1086 | add(helpmenu, { 1087 | createmenuitem("About...", "HelpAbout"), 1088 | createmenuitem("Release Notes...", "HelpReleaseNotes"), 1089 | createmenuitem("Tutorial", "HelpTutorial"), 1090 | createmenuitem("Help", "HelpHelp", "F1") 1091 | }) 1092 | set(menuHelp, "submenu", helpmenu) 1093 | 1094 | -- popup menu for tab controls 1095 | add(tabmenu, { 1096 | createmenuitem("Save", "FileSave"), 1097 | createmenuitem("Save As...", "FileSaveAs"), 1098 | createmenuitem("Close", "FileClose") 1099 | }) 1100 | show_all(tabmenu) 1101 | 1102 | add(menubar, { 1103 | menuFile, 1104 | menuEdit, 1105 | menuSearch, 1106 | menuView, 1107 | menuRun, 1108 | menuOptions, 1109 | menuHelp}) 1110 | 1111 | pack(panel, menubar) 1112 | 1113 | ------------------------------------------------- 1114 | function NotebookSwitchPage(atom nb, atom page, atom page_num) 1115 | select_tab(page_num + 1) 1116 | return 0 1117 | end function 1118 | 1119 | function NotebookButtonPressEvent(atom nb, atom event) 1120 | integer button = events:button(event) 1121 | 1122 | -- right click or middle click 1123 | if button = 3 or button = 2 then 1124 | atom x, y, lx, ly, lw, lh 1125 | {x,y} = events:xy(event) -- get mouse coordinates 1126 | atom allocation = allocate(4*4) 1127 | for i = 1 to gtk:get(nb, "n_pages") do 1128 | atom pg = gtk:get(nb, "nth_page", i-1) 1129 | atom lbl = gtk:get(nb, "tab_label", pg) 1130 | 1131 | gtk_func("gtk_widget_get_allocation", {P,P}, {lbl, allocation}) 1132 | {lx, ly, lw, lh} = peek4u({allocation, 4}) -- get label rect 1133 | 1134 | if x >= lx-10 and x <= lx+lw+10 then 1135 | if button = 3 then -- right click 1136 | select_tab(i) 1137 | set(tabmenu, "popup", NULL, NULL, NULL, NULL, 0, events:time(event)) 1138 | elsif button = 2 then -- middle click 1139 | select_tab(i) 1140 | close_tab() 1141 | end if 1142 | exit 1143 | end if 1144 | end for 1145 | free(allocation) 1146 | return 1 1147 | end if 1148 | 1149 | return 0 1150 | end function 1151 | 1152 | -- switch tabs when mouse wheel is scrolled 1153 | function NotebookScrollEvent(atom nb, atom event) 1154 | integer dir = events:scroll_dir(event) 1155 | if dir = 1 then 1156 | select_tab(get_next_tab()) 1157 | elsif dir = 0 then 1158 | select_tab(get_prev_tab()) 1159 | end if 1160 | return 0 1161 | end function 1162 | 1163 | -- detect Tab and Tab 1164 | function NotebookKeyPressEvent(atom nb, atom event) 1165 | integer mod = events:state(event) 1166 | if key(event) = -9 and and_bits(mod, GDK_CONTROL_MASK) then 1167 | if and_bits(mod, GDK_SHIFT_MASK) then 1168 | select_tab(get_prev_tab()) 1169 | else 1170 | select_tab(get_next_tab()) 1171 | end if 1172 | return 1 1173 | end if 1174 | return 0 1175 | end function 1176 | 1177 | 1178 | constant 1179 | status_label = create(GtkLabel, "status"), 1180 | notebook = create(GtkNotebook, { 1181 | {"add_events", GDK_SCROLL_MASK}, 1182 | {"scrollable", TRUE}, 1183 | {"show border", FALSE}, -- seems to have opposite effect? 1184 | {"action widget", status_label, GTK_PACK_END}}) 1185 | 1186 | pack(panel, notebook, TRUE, TRUE) 1187 | show(status_label) 1188 | 1189 | connect(notebook, "switch-page", callback("NotebookSwitchPage")) 1190 | connect(notebook, "button-press-event", callback("NotebookButtonPressEvent")) 1191 | connect(notebook, "scroll-event", callback("NotebookScrollEvent")) 1192 | connect(notebook, "key-press-event", callback("NotebookKeyPressEvent")) 1193 | 1194 | -------------------------------------------------- 1195 | 1196 | sequence ui_hedits 1197 | ui_hedits = {} 1198 | 1199 | function tab_hedit() 1200 | integer tab 1201 | tab = gtk:get(notebook, "current page") 1202 | return ui_hedits[tab+1] 1203 | end function 1204 | 1205 | -------------------------------------------------- 1206 | 1207 | global procedure ui_update_status(sequence status) 1208 | set(status_label, "text", status) 1209 | end procedure 1210 | 1211 | function file_open_recent(atom handle, integer idx) 1212 | open_recent(idx) 1213 | return 0 1214 | end function 1215 | 1216 | sequence filemenu_items = {} 1217 | 1218 | global procedure ui_refresh_file_menu(sequence items) 1219 | atom widget 1220 | if length(filemenu_items) = 0 and length(items) != 0 then 1221 | add(filemenu, create(GtkSeparatorMenuItem)) 1222 | end if 1223 | for i = 1 to length(items) do 1224 | if i > length(filemenu_items) then 1225 | widget = create(GtkMenuItem, items[i]) 1226 | set(widget, "use underline", 0) 1227 | filemenu_items &= widget 1228 | add(filemenu, widget) 1229 | connect(widget, "activate", callback("file_open_recent"), i) 1230 | else 1231 | set(filemenu_items[i], "label", items[i]) 1232 | end if 1233 | end for 1234 | end procedure 1235 | 1236 | global procedure ui_select_tab(integer tab) 1237 | set(notebook, "current page", tab - 1) 1238 | gtk_proc("gtk_widget_grab_focus", {P}, ui_hedits[tab]) 1239 | end procedure 1240 | 1241 | global procedure ui_update_window_title(sequence name) 1242 | set(win, "title", name & " ~ " & window_title) 1243 | end procedure 1244 | 1245 | global procedure ui_update_tab_name(integer tab, sequence name) 1246 | set(notebook, "tab label text", ui_hedits[tab], name) 1247 | set(gtk:get(notebook, "tab label", ui_hedits[tab]), "tooltip text", file_name) 1248 | end procedure 1249 | 1250 | constant sci_notify_cb = callback("sci_notify") 1251 | 1252 | global function ui_new_tab(sequence name) 1253 | atom editor 1254 | 1255 | editor = scintilla_new() 1256 | ui_hedits &= editor 1257 | init_edit(editor) 1258 | gtk_proc("gtk_widget_show", {P}, editor) 1259 | 1260 | set(notebook, "append page", editor, create(GtkLabel, name)) 1261 | 1262 | connect(editor, "sci-notify", sci_notify_cb, 0) 1263 | 1264 | return editor 1265 | end function 1266 | 1267 | global procedure ui_close_tab(integer tab) 1268 | set(notebook, "remove page", tab-1) 1269 | 1270 | -- remove the window handle 1271 | ui_hedits = ui_hedits[1..tab-1] & ui_hedits[tab+1..$] 1272 | end procedure 1273 | 1274 | 1275 | constant filters = { 1276 | create(GtkFileFilter, { 1277 | {"name", "Euphoria files"}, 1278 | {"add pattern", "*.e"}, 1279 | {"add pattern", "*.ex"}, 1280 | {"add pattern", "*.exw"}, 1281 | {"add pattern", "*.ew"}, 1282 | {"add pattern", "ex.err"}, 1283 | {"add pattern", "eu.cfg"}}), 1284 | create(GtkFileFilter, { 1285 | {"name", "Text files"}, 1286 | {"add mime type", "text/*"}}), 1287 | create(GtkFileFilter, { 1288 | {"name", "All files"}, 1289 | {"add pattern", "*"}})} 1290 | atom current_filter = filters[1] 1291 | 1292 | global function ui_get_open_file_name() 1293 | atom dialog 1294 | sequence filename 1295 | 1296 | dialog = create(GtkFileChooserDialog, { 1297 | {"title", "Open..."}, 1298 | {"transient for", win}, 1299 | {"action", GTK_FILE_CHOOSER_ACTION_OPEN}, 1300 | {"select multiple", TRUE}, 1301 | {"add button", "gtk-cancel", GTK_RESPONSE_CLOSE}, 1302 | {"add button", "gtk-ok", GTK_RESPONSE_OK}, 1303 | {"position", GTK_WIN_POS_MOUSE}, 1304 | {"current folder", pathname(canonical_path(file_name))}}) 1305 | add(dialog, filters) 1306 | set(dialog, "filter", current_filter) 1307 | 1308 | if gtk:get(dialog, "run") = GTK_RESPONSE_OK then 1309 | current_filter = gtk:get(dialog, "filter") 1310 | filename = gtk:get(dialog, "filenames") 1311 | if length(filename) = 1 then 1312 | -- single filename selected 1313 | filename = filename[1] 1314 | end if 1315 | else 1316 | filename = "" 1317 | end if 1318 | set(dialog, "hide") 1319 | 1320 | return filename 1321 | end function 1322 | 1323 | global function ui_get_save_file_name(sequence filename) 1324 | atom dialog 1325 | 1326 | dialog = create(GtkFileChooserDialog, { 1327 | {"title", "Save As..."}, 1328 | {"transient for", win}, 1329 | {"action", GTK_FILE_CHOOSER_ACTION_SAVE}, 1330 | {"select multiple", FALSE}, 1331 | {"do overwrite confirmation", TRUE}, 1332 | {"add button", "gtk-cancel", GTK_RESPONSE_CLOSE}, 1333 | {"add button", "gtk-ok", GTK_RESPONSE_OK}, 1334 | {"filename", filename}, 1335 | {"position", GTK_WIN_POS_MOUSE}, 1336 | {"current folder", pathname(canonical_path(file_name))}}) 1337 | add(dialog, filters) 1338 | 1339 | if gtk:get(dialog, "run") = GTK_RESPONSE_OK then 1340 | current_filter = gtk:get(dialog, "filter") 1341 | filename = gtk:get(dialog, "filename") 1342 | else 1343 | filename = "" 1344 | end if 1345 | set(dialog, "hide") 1346 | 1347 | return filename 1348 | end function 1349 | 1350 | -- returns yes=1 no=0 1351 | global function ui_message_box_yes_no(sequence title, sequence message) 1352 | integer result 1353 | result = Question(win, title, "", message) 1354 | return (result = MB_YES) 1355 | end function 1356 | 1357 | -- returns yes=1 no=0 cancel=-1 1358 | global function ui_message_box_yes_no_cancel(sequence title, sequence message) 1359 | atom dialog, result 1360 | dialog = create(GtkMessageDialog, { 1361 | {"title", title}, 1362 | {"transient for", win}, 1363 | {"add button", "gtk-cancel", -1}, 1364 | {"add button", "gtk-no", 0}, 1365 | {"add button", "gtk-yes", 1}, 1366 | {"transient for", win}, 1367 | {"destroy with parent", TRUE}, 1368 | {"text", message}, 1369 | {"position", GTK_WIN_POS_CENTER_ON_PARENT}}) 1370 | 1371 | result = gtk:get(dialog, "run") 1372 | set(dialog, "hide") 1373 | 1374 | return result 1375 | end function 1376 | 1377 | global function ui_message_box_error(sequence title, sequence message) 1378 | Error(win, title, , message, GTK_BUTTONS_OK) 1379 | return 0 1380 | end function 1381 | 1382 | global procedure ui_view_error() 1383 | sequence err 1384 | atom dialog, scroll, list, content, row, lbl 1385 | integer result 1386 | 1387 | err = get_ex_err() 1388 | if length(err) = 0 then return end if 1389 | 1390 | dialog = create(GtkDialog, { 1391 | {"border width", 5}, 1392 | {"default size", 200, 400}, 1393 | {"add button", "gtk-close", GTK_RESPONSE_CLOSE}, 1394 | {"add button", "Open Ex.Err", GTK_RESPONSE_YES}, 1395 | {"add button", "Goto Error", GTK_RESPONSE_OK}, 1396 | {"transient for", win}, 1397 | {"title", "View Error"}, 1398 | {"default response", GTK_RESPONSE_OK}, 1399 | {"modal", TRUE}}) 1400 | content = gtk:get(dialog, "content area") 1401 | 1402 | lbl = create(GtkLabel, err[2]) 1403 | pack(content, lbl) 1404 | 1405 | content = gtk:get(dialog, "content area") 1406 | scroll = create(GtkScrolledWindow) 1407 | pack(content, scroll, TRUE, TRUE) 1408 | 1409 | list = create(GtkListBox) 1410 | add(scroll, list) 1411 | for i = 3 to length(err) do 1412 | lbl = create(GtkLabel, err[i]) 1413 | set(lbl, "halign", GTK_ALIGN_START) 1414 | set(list, "insert", lbl, -1) 1415 | end for 1416 | 1417 | show_all(dialog) 1418 | result = set(dialog, "run") 1419 | if result = GTK_RESPONSE_OK then 1420 | row = gtk:get(list, "selected row") 1421 | --result = gtk:get(row, "index") -- doesn't work? 1422 | for i = 0 to length(err)-3 do 1423 | if row = gtk:get(list, "row at index", i) then 1424 | goto_error(err, i+1) 1425 | exit 1426 | end if 1427 | end for 1428 | elsif result = GTK_RESPONSE_YES then 1429 | open_file(ex_err_name, 1) 1430 | end if 1431 | hide(dialog) 1432 | end procedure 1433 | 1434 | -------------------------------------------------- 1435 | -- help window 1436 | 1437 | function HelpActivateLink(atom handle, atom uri, atom userdata) 1438 | puts(1, peek_string(uri)&"\n") 1439 | return 1 1440 | end function 1441 | 1442 | function Hide(atom handle) 1443 | set(handle,"visible",FALSE) 1444 | return 1 1445 | end function 1446 | 1447 | constant helpwin = create(GtkWindow, { 1448 | {"transient for", win}, 1449 | {"title", "Help"}, 1450 | {"default size", 400, 400}, 1451 | {"border width", 10}, 1452 | {"deletable", FALSE}, --! 1453 | {"resizable", FALSE}}) 1454 | connect(helpwin, "delete-event", callback("Hide")) 1455 | 1456 | constant helplbl = create(GtkLabel) 1457 | add(helpwin,helplbl) 1458 | connect(helplbl, "activate-link", callback("HelpActivateLink")) 1459 | 1460 | function re(sequence txt, sequence rx, sequence rep) 1461 | return regex:find_replace(regex:new(rx), txt, rep) 1462 | end function 1463 | 1464 | -- FIXME this doesn't work very well 1465 | function html_to_markup(sequence html) 1466 | html = re(html, `([A-Za-z0-9. ]*)`, `\1`) 1467 | html = re(html, `

?`, ``) 1468 | html = re(html, `

`, ``) 1469 | html = re(html, ``, `
`) 1471 | html = re(html, `
`, ``)
1472 |     html = re(html, `
`, ``) 1473 | html = re(html, `
`, ``) 1474 | html = re(html, `
`, ``) 1475 | html = re(html, `
    `, `\n`) 1476 | html = re(html, `
`, ``) 1477 | html = re(html, `
  • `, ` 1. `) 1478 | html = re(html, `
  • `, `\n`) 1479 | html = re(html, `
      `, `\n`) 1480 | html = re(html, `
    `, ``) 1481 | html = re(html, `\n\n+`, `\n\n`) 1482 | puts(1, html) 1483 | return html 1484 | end function 1485 | 1486 | global function ui_show_help(sequence html) 1487 | set(helplbl,"markup",html_to_markup(html)) 1488 | show_all(helpwin) 1489 | return 0 1490 | end function 1491 | 1492 | global procedure ui_show_uri(sequence uri) 1493 | show_uri(uri) 1494 | end procedure 1495 | 1496 | -------------------------------------------------- 1497 | 1498 | ui_refresh_file_menu(recent_files) 1499 | 1500 | -- open files from last time and on command line 1501 | open_tabs() 1502 | 1503 | show_all(win) 1504 | main() 1505 | -------------------------------------------------------------------------------- /ui_win.e: -------------------------------------------------------------------------------- 1 | -- ui_win.e 2 | 3 | include window.ew 4 | include wee.exw 5 | include std/text.e 6 | include std/filesys.e 7 | include std/sort.e 8 | include std/machine.e 9 | include std/dll.e 10 | include std/get.e 11 | 12 | -- MenuItem constants 13 | constant 14 | File_New = 101, 15 | File_Open = 102, 16 | File_Save = 103, 17 | File_SaveAs = 104, 18 | File_Close = 105, 19 | File_PageSetup = 106, 20 | File_Print = 107, 21 | File_Exit = 108, 22 | File_Recent = 110, 23 | Edit_Undo = 201, 24 | Edit_Cut = 202, 25 | Edit_Copy = 203, 26 | Edit_Paste = 204, 27 | Edit_Clear = 205, 28 | Edit_SelectAll = 206, 29 | Edit_Redo = 207, 30 | Edit_ToggleComment = 208, 31 | Search_Find = 301, 32 | Search_Find_Next = 302, 33 | Search_Find_Prev = 303, 34 | Search_Replace = 304, 35 | View_Subs = 401, 36 | View_Error = 402, 37 | View_Completions = 404, 38 | View_Declaration = 405, 39 | View_GoBack = 406, 40 | View_SubArgs = 407, 41 | Run_Start = 501, 42 | Run_WithArgs = 502, 43 | Run_Arguments = 503, 44 | Run_Interpreter = 507, 45 | Run_Bind = 504, 46 | Run_Shroud = 505, 47 | Run_Translate = 506, 48 | Options_Font = 601, 49 | Options_LineNumbers = 602, 50 | Options_SortedSubs = 603, 51 | Options_Colors = 604, 52 | Options_LineWrap = 605, 53 | Options_ReopenTabs = 606, 54 | Options_CompleteStatements = 607, 55 | Options_CompleteBraces = 608, 56 | Options_Indent = 609, 57 | Options_ErrorIndicators = 610, 58 | Help_About = 701, 59 | Help_ReleaseNotes = 702, 60 | Help_Tutorial = 703, 61 | Help_Context = 704, 62 | Select_Tab = 801, 63 | Select_Next_Tab = 811, 64 | Select_Prev_Tab = 812 65 | 66 | constant file_filters = allocate_string( 67 | "Euphoria files (*.ex,*.exw,*.e,*.ew)"&0&"*.EX;*.EXW;*.E;*.EW;ex.err;eu.cfg"&0& 68 | "Text or Document files (*.txt,*.doc)"&0&"*.TXT;*.DOC"&0& 69 | "All files (*.*)"&0&"*.*"&0&0) 70 | 71 | 72 | atom hMainWnd, hFindDlg, hDlg, class, 73 | hmenu, hfilemenu, heditmenu, hsearchmenu, hviewmenu, 74 | hrunmenu, hoptionsmenu, hhelpmenu, htabmenu, 75 | hstatus, htabs, hcode, hedit, htooltip, 76 | WM_FIND 77 | 78 | sequence ui_hedits 79 | ui_hedits = {} 80 | 81 | class = 0 82 | WM_FIND = 0 83 | hMainWnd = 0 -- the main window 84 | hFindDlg = 0 85 | hDlg = 0 86 | hedit = 0 -- the richedit control 87 | hstatus = 0 -- the static control showing cursor position 88 | htabs = 0 -- the tab control 89 | hcode = 0 -- the listbox control for code completions 90 | hedit = 0 91 | 92 | constant tab_h = 24 93 | 94 | 95 | x_pos = CW_USEDEFAULT 96 | y_pos = CW_USEDEFAULT 97 | x_size = CW_USEDEFAULT 98 | y_size = CW_USEDEFAULT 99 | 100 | constant 101 | ansi_var_font = c_func(GetStockObject, {ANSI_VAR_FONT}), 102 | ansi_fixed_font = c_func(GetStockObject, {ANSI_FIXED_FONT}) 103 | 104 | atom captionFont, smCaptionFont, menuFont, statusFont, messageFont 105 | 106 | 107 | -- nifty shortcut, thanks Greg Haberek 108 | function callback(sequence name, atom rid = routine_id(name)) 109 | return call_back(rid) 110 | end function 111 | 112 | 113 | global procedure ui_update_window_title(sequence name) 114 | atom result 115 | result = c_func(SendMessage, {hMainWnd, WM_SETTEXT, 0, 116 | alloc_string(name & " ~ " & window_title)}) 117 | free_strings() 118 | end procedure 119 | 120 | global procedure ui_update_status(sequence status) 121 | atom txt, junk 122 | txt = allocate_string(status) 123 | junk = c_func(SendMessage, {hstatus, WM_SETTEXT, 0, txt}) 124 | free(txt) 125 | end procedure 126 | 127 | global procedure ui_refresh_file_menu(sequence recent_files) 128 | atom junk, count 129 | count = c_func(GetMenuItemCount, {hfilemenu}) - 7 130 | if count = 0 and length(recent_files) > 0 then 131 | junk = c_func(AppendMenu, {hfilemenu, MF_BYPOSITION + MF_SEPARATOR, 0, 0}) 132 | end if 133 | for i = 1 to length(recent_files) do 134 | if i >= count then 135 | junk = c_func(AppendMenu, {hfilemenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 136 | File_Recent+i, alloc_string(recent_files[i])}) 137 | else 138 | junk = c_func(ModifyMenu, {hfilemenu, i+7, MF_BYPOSITION + MF_STRING + MF_ENABLED, 139 | File_Recent+i, alloc_string(recent_files[i])}) 140 | end if 141 | end for 142 | free_strings() 143 | end procedure 144 | 145 | global procedure ui_update_tab_name(integer tab, sequence name) 146 | atom junk, tcitem 147 | tcitem = allocate_pack("dddsiip", {TCIF_TEXT, 0, 0, name, 0, 0, 0}) 148 | junk = c_func(SendMessage, {htabs, TCM_SETITEMA, tab-1, tcitem}) 149 | free(tcitem) 150 | free_strings() 151 | end procedure 152 | 153 | 154 | -- select the tab and show the hedit 155 | global procedure ui_select_tab(integer tab) 156 | atom junk, rect 157 | integer w, h 158 | 159 | -- change tab, and highlight it to make it stand out 160 | junk = c_func(SendMessage, {htabs, TCM_HIGHLIGHTITEM, 161 | c_func(SendMessage, {htabs, TCM_GETCURSEL, 0, 0}), 0}) 162 | junk = c_func(SendMessage, {htabs, TCM_SETCURSEL, tab-1, 0}) 163 | junk = c_func(SendMessage, {htabs, TCM_HIGHLIGHTITEM, tab-1, 1}) 164 | 165 | if hedit then 166 | -- hide the previous hedit 167 | c_proc(ShowWindow, {hedit, SW_HIDE}) 168 | end if 169 | 170 | hedit = ui_hedits[tab] 171 | 172 | -- update the richedit control to the window size 173 | rect = allocate(16) 174 | c_proc(GetClientRect, {hMainWnd, rect}) 175 | c_proc(MoveWindow, {hedit, 0, tab_h, peek4u(rect+8), peek4u(rect+12)-tab_h, 1}) 176 | free(rect) 177 | c_proc(ShowWindow, {hedit, SW_SHOW}) 178 | junk = c_func(SetFocus, {hedit}) 179 | 180 | junk = allocate_pack("zdppddddps", { -- TOOLINFO 181 | TTF_IDISHWND + TTF_SUBCLASS, -- uFlags 182 | hMainWnd, -- hwnd 183 | htabs, -- uId 184 | 0,0,0,0, -- rect 185 | 0, -- hinst 186 | file_name -- lpszText 187 | }) 188 | c_func(SendMessage, {htooltip, TTM_UPDATETIPTEXT, 0, junk}) 189 | free(junk) 190 | 191 | end procedure 192 | 193 | global function ui_new_tab(sequence name) 194 | atom junk, tcitem, tab, hedit 195 | tab = c_func(SendMessage, {htabs, TCM_GETITEMCOUNT, 0, 0}) 196 | 197 | tcitem = allocate_pack("dddsiip", {TCIF_TEXT, 0, 0, name, 0, 0, 0}) 198 | junk = c_func(SendMessage, {htabs, TCM_INSERTITEMA, tab+(tab!=0), tcitem}) 199 | free(tcitem) 200 | free_strings() 201 | 202 | hedit = CreateWindow({ 203 | 0, 204 | "Scintilla", 205 | "", 206 | {WS_CHILD, WS_VISIBLE, WS_TABSTOP, WS_CLIPCHILDREN}, 207 | 0,0,0,0, -- position and size set later by hMainWnd 208 | hMainWnd, NULL, 0, NULL}) 209 | 210 | -- save the window handle 211 | ui_hedits = append(ui_hedits, hedit) 212 | return c_func(SendMessage, {hedit, SCI_GETDIRECTPOINTER, 0, 0}) 213 | end function 214 | 215 | global procedure ui_close_tab(integer tab) 216 | atom junk 217 | 218 | -- get the edit window handle and destroy it 219 | junk = c_func(DestroyWindow, {hedit}) 220 | hedit = 0 221 | -- delete the tab 222 | junk = c_func(SendMessage, {htabs, TCM_DELETEITEM, tab-1, 0}) 223 | -- remove the window handle 224 | ui_hedits = ui_hedits[1..tab-1] & ui_hedits[tab+1..$] 225 | end procedure 226 | 227 | procedure rightclick_tab() 228 | atom point, x, y 229 | integer tab 230 | point = allocate(12) 231 | c_func(GetCursorPos, {point}) 232 | x = peek4s(point) 233 | y = peek4s(point+4) 234 | c_func(ScreenToClient, {hMainWnd, point}) 235 | tab = c_func(SendMessage, {htabs, TCM_HITTEST, 0, point}) 236 | if tab >= 0 then 237 | select_tab(tab + 1) 238 | c_func(TrackPopupMenu, {htabmenu, TPM_LEFTALIGN, x, y, 0, hMainWnd, 0}) 239 | end if 240 | free(point) 241 | end procedure 242 | 243 | 244 | integer current_filter 245 | current_filter = 1 246 | 247 | global function ui_get_open_file_name(integer multiple = 1) 248 | sequence temp 249 | temp = GetOpenFileName({hMainWnd, 0, file_filters, current_filter, 250 | "", 0, 0, 251 | OFN_EXPLORER + OFN_PATHMUSTEXIST + OFN_FILEMUSTEXIST + OFN_HIDEREADONLY 252 | + (multiple != 0) * OFN_ALLOWMULTISELECT 253 | , 0}) 254 | if length(temp) < 2 then return "" end if 255 | current_filter = temp[1] 256 | return temp[2] 257 | end function 258 | 259 | global function ui_get_save_file_name(sequence file_name) 260 | sequence temp 261 | temp = GetSaveFileName({hMainWnd, 0, file_filters, current_filter, 262 | file_name, 0, 0, OFN_EXPLORER + OFN_PATHMUSTEXIST + OFN_HIDEREADONLY, 0}) 263 | if length(temp) < 2 then return "" end if 264 | current_filter = temp[1] 265 | return temp[2] 266 | end function 267 | 268 | -- returns yes=1 no=0 269 | global function ui_message_box_yes_no(sequence title, sequence message) 270 | atom result 271 | result = c_func(MessageBox, {hMainWnd, 272 | alloc_string(message), 273 | alloc_string(title), 274 | or_all({MB_APPLMODAL, MB_ICONINFORMATION, MB_YESNO})}) 275 | free_strings() 276 | return result = IDYES 277 | end function 278 | 279 | -- returns yes=1 no=0 cancel=-1 280 | global function ui_message_box_yes_no_cancel(sequence title, sequence message) 281 | atom result 282 | result = c_func(MessageBox, {hMainWnd, 283 | alloc_string(message), 284 | alloc_string(title), 285 | or_all({MB_APPLMODAL, MB_ICONINFORMATION, MB_YESNOCANCEL})}) 286 | free_strings() 287 | return (result = IDYES) - (result = IDCANCEL) 288 | end function 289 | 290 | global function ui_message_box_error(sequence title, sequence message) 291 | atom result 292 | result = c_func(MessageBox, {hMainWnd, 293 | alloc_string(message), 294 | alloc_string(title), 295 | or_all({MB_APPLMODAL, MB_ICONSTOP, MB_OK})}) 296 | free_strings() 297 | return result 298 | end function 299 | 300 | procedure get_window_size() 301 | atom rect 302 | rect = allocate(16) 303 | c_proc(GetWindowRect, {hMainWnd, rect}) 304 | x_pos = peek4s(rect) 305 | y_pos = peek4s(rect+4) 306 | x_size = peek4s(rect+8) - x_pos 307 | y_size = peek4s(rect+12) - y_pos 308 | free(rect) 309 | end procedure 310 | 311 | 312 | procedure about_box() 313 | atom result 314 | result = c_func(MessageBox, {hMainWnd, 315 | alloc_string(window_title&"\n\nVersion "&version&"\n\nBy "&author), 316 | alloc_string("About "&window_title), 317 | or_all({MB_APPLMODAL, MB_ICONINFORMATION, MB_OK})}) 318 | free_strings() 319 | end procedure 320 | 321 | constant 322 | DialogListID = 1000, 323 | DialogLabelID = 1001, 324 | DialogEditID = 1002, 325 | DialogOpenID = 1003 326 | sequence subs 327 | 328 | function SubsDialogProc(atom hdlg, atom iMsg, atom wParam, atom lParam) 329 | atom junk, hList, pos 330 | sequence text, word, tmp 331 | 332 | --? {hdlg, iMsg, wParam, HIWORD(lParam), LOWORD(lParam)} 333 | 334 | if iMsg = WM_INITDIALOG then 335 | junk = c_func(SendMessage, {c_func(GetDlgItem, {hdlg, IDOK}), 336 | WM_SETFONT, captionFont, 0}) 337 | junk = c_func(SendMessage, {c_func(GetDlgItem, {hdlg, IDCANCEL}), 338 | WM_SETFONT, captionFont, 0}) 339 | hList = c_func(GetDlgItem, {hdlg, DialogListID}) 340 | junk = c_func(SendMessage, {hList, WM_SETFONT, messageFont, 0}) 341 | text = get_edit_text() 342 | pos = get_pos() 343 | word = word_pos(text, pos) 344 | subs = get_subroutines(parse(text, file_name)) 345 | if sorted_subs then 346 | subs = sort(subs) 347 | end if 348 | 349 | for i = 1 to length(subs) do 350 | junk = c_func(SendMessage, {hList, LB_ADDSTRING, 0, alloc_string(subs[i][1])}) 351 | if equal(word[1], subs[i][1]) then 352 | junk = c_func(SendMessage, {hList, LB_SETCURSEL, i-1, 0}) 353 | end if 354 | end for 355 | free_strings() 356 | 357 | elsif iMsg = WM_COMMAND then 358 | if LOWORD(wParam) = DialogListID and HIWORD(wParam) = LBN_DBLCLK then 359 | wParam = IDOK -- double clicked item in list 360 | end if 361 | if LOWORD(wParam) = IDOK then 362 | hList = c_func(GetDlgItem, {hdlg, DialogListID}) 363 | pos = c_func(SendMessage, {hList, LB_GETCURSEL, 0, 0})+1 364 | if pos >= 1 and pos <= length(subs) then 365 | word = subs[pos][1] 366 | pos = subs[pos][2]-1 367 | --printf(1, "%s: pos=%d line=%d\n", {word, pos, 368 | -- c_func(SendMessage, {hedit, SCI_LINEFROMPOSITION, pos, 0})}) 369 | junk = c_func(SendMessage, {hedit, SCI_SETSEL, pos, pos+length(word)}) 370 | set_top_line(-1) -- set the top visible line to the current line 371 | end if 372 | junk = c_func(EndDialog, {hdlg, 1}) 373 | return 1 374 | elsif LOWORD(wParam) = IDCANCEL then 375 | junk = c_func(EndDialog, {hdlg, 0}) 376 | return 1 377 | end if 378 | 379 | elsif iMsg = WM_CLOSE then --closing dialog 380 | junk = c_func(EndDialog, {hdlg, 0}) 381 | end if 382 | 383 | return 0 384 | end function 385 | 386 | constant SubsDialogCallback = callback("SubsDialogProc") 387 | 388 | -- used for struct DLGITEMTEMPLATE 389 | constant 390 | DIALOG_CLASS_BUTTON = #0080, 391 | DIALOG_CLASS_EDIT = #0081, 392 | DIALOG_CLASS_STATIC = #0082, 393 | DIALOG_CLASS_LIST = #0083, 394 | DIALOG_CLASS_SCROLLBAR = #0084, 395 | DIALOG_CLASS_COMBOBOX = #0085 396 | 397 | procedure view_subroutines() 398 | atom junk 399 | junk = DialogBoxIndirectParam(c_func(GetModuleHandle, {NULL}), { 400 | --DLGTEMPLATE{style, exstyle, x, y, cx, cy, menu, wndclass, text} 401 | {{WS_POPUP, WS_BORDER, WS_SYSMENU, DS_MODALFRAME, WS_CAPTION}, 0, 402 | 50,50, 100,124, 0, 0, "Subroutines"}, 403 | --DLGITEMTEMPLATE{style, exstyle, x, y, cx, cy, id, dlgclass, text} 404 | {{WS_CHILD, WS_VISIBLE, WS_VSCROLL, LBS_NOTIFY}, WS_EX_CLIENTEDGE, 405 | 4,4, 92,110, DialogListID, DIALOG_CLASS_LIST, "ListBox"}, 406 | {{WS_CHILD, WS_VISIBLE, BS_PUSHBUTTON}, 0, 407 | 4,108, 44,12, IDCANCEL, DIALOG_CLASS_BUTTON, "Cancel"}, 408 | {{WS_CHILD, WS_VISIBLE, BS_DEFPUSHBUTTON}, 0, 409 | 52,108, 44,12, IDOK, DIALOG_CLASS_BUTTON, "OK"} 410 | }, 411 | hMainWnd, 412 | SubsDialogCallback, 413 | 0) 414 | subs = {} 415 | end procedure 416 | 417 | 418 | sequence err 419 | 420 | function ViewErrorProc(atom hdlg, atom iMsg, atom wParam, atom lParam) 421 | atom junk, hList, hLabel, pos, len, item 422 | 423 | --? {hdlg, iMsg, wParam, HIWORD(lParam), LOWORD(lParam)} 424 | 425 | if iMsg = WM_INITDIALOG then 426 | junk = c_func(SendMessage, {c_func(GetDlgItem, {hdlg, IDOK}), 427 | WM_SETFONT, captionFont, 0}) 428 | junk = c_func(SendMessage, {c_func(GetDlgItem, {hdlg, IDCANCEL}), 429 | WM_SETFONT, captionFont, 0}) 430 | junk = c_func(SendMessage, {c_func(GetDlgItem, {hdlg, IDRETRY}), 431 | WM_SETFONT, captionFont, 0}) 432 | hList = c_func(GetDlgItem, {hdlg, DialogListID}) 433 | junk = c_func(SendMessage, {hList, WM_SETFONT, messageFont, 0}) 434 | hLabel = c_func(GetDlgItem, {hdlg, DialogLabelID}) 435 | junk = c_func(SendMessage, {hLabel, WM_SETFONT, messageFont, 0}) 436 | 437 | err = get_ex_err() 438 | if length(err) = 0 then 439 | junk = c_func(EndDialog, {hdlg, 0}) 440 | return 1 441 | end if 442 | junk = c_func(SendMessage, {hLabel, WM_SETTEXT, 0, alloc_string(err[2])}) 443 | 444 | for i = 3 to length(err) do 445 | junk = c_func(SendMessage, {hList, LB_ADDSTRING, 0, alloc_string(err[i])}) 446 | end for 447 | junk = c_func(SendMessage, {hList, LB_SETCURSEL, 0, 0}) 448 | junk = c_func(SetFocus, {hList}) 449 | 450 | elsif iMsg = WM_COMMAND then 451 | if LOWORD(wParam) = IDOK then 452 | hList = c_func(GetDlgItem, {hdlg, DialogListID}) 453 | pos = c_func(SendMessage, {hList, LB_GETCURSEL, 0, 0}) 454 | if pos != -1 then 455 | goto_error(err, pos+1) 456 | end if 457 | junk = c_func(EndDialog, {hdlg, 1}) 458 | return 1 459 | elsif LOWORD(wParam) = IDRETRY then 460 | open_file(ex_err_name, 1) 461 | junk = c_func(EndDialog, {hdlg, 0}) 462 | return 1 463 | elsif LOWORD(wParam) = IDCANCEL then 464 | junk = c_func(EndDialog, {hdlg, 0}) 465 | return 1 466 | end if 467 | 468 | elsif iMsg = WM_CLOSE then --closing dialog 469 | junk = c_func(EndDialog, {hdlg, 0}) 470 | end if 471 | 472 | return 0 473 | end function 474 | 475 | constant ViewErrorCallback = callback("ViewErrorProc") 476 | 477 | global procedure ui_view_error() 478 | integer junk 479 | junk = DialogBoxIndirectParam(c_func(GetModuleHandle, {NULL}), { 480 | --DLGTEMPLATE{style, exstyle, x, y, cx, cy, menu, wndclass, text} 481 | {{WS_POPUP, WS_CAPTION, WS_SYSMENU, DS_MODALFRAME}, 0, 482 | 50, 50, 200,150, 0, 0, "View Error"}, 483 | --DLGITEMTEMPLATE{style, exstyle, x, y, cx, cy, id, dlgclass, text} 484 | {{WS_CHILD, WS_VISIBLE, WS_VSCROLL}, WS_EX_CLIENTEDGE, 485 | 4,24, 192,108, DialogListID, DIALOG_CLASS_LIST, "ListBox"}, 486 | {{WS_CHILD, WS_VISIBLE}, 0, 487 | 4,4, 192,20, DialogLabelID, DIALOG_CLASS_STATIC, "Static"}, 488 | {{WS_CHILD, WS_VISIBLE, BS_PUSHBUTTON}, 0, 489 | 54,132, 44,12, IDCANCEL, DIALOG_CLASS_BUTTON, "Cancel"}, 490 | {{WS_CHILD, WS_VISIBLE, BS_PUSHBUTTON}, 0, 491 | 102,132, 44,12, IDRETRY, DIALOG_CLASS_BUTTON, "Open ex.err"}, 492 | {{WS_CHILD, WS_VISIBLE, BS_DEFPUSHBUTTON}, 0, 493 | 150,132, 44,12, IDOK, DIALOG_CLASS_BUTTON, "Goto Error"} 494 | }, 495 | hMainWnd, 496 | ViewErrorCallback, 497 | 0) 498 | end procedure 499 | 500 | global procedure ui_show_help(sequence html) 501 | -- TODO 502 | end procedure 503 | 504 | global procedure ui_show_uri(sequence uri) 505 | atom result 506 | -- TODO: get default browser from 507 | -- HKEY_LOCAL_MACHINE\SOFTWARE\Classes\http\shell\open\command 508 | -- note: just opening the uri won't work, since shellexecute will 509 | -- strip off any #anchor text, so using iexplore.exe for now 510 | result = c_func(ShellExecute, { 511 | hMainWnd, NULL, 512 | alloc_string("iexplore.exe"), 513 | alloc_string(uri), 514 | NULL, 515 | SW_SHOWNORMAL}) 516 | free_strings() 517 | end procedure 518 | 519 | 520 | procedure process_find(atom struc) 521 | atom flags, junk, result 522 | integer backward 523 | 524 | flags = GetFindFlags(struc) 525 | if and_bits(flags, FR_DIALOGTERM) then 526 | find_phrase = GetFindWhat(struc) 527 | replace_phrase = GetReplaceWith(struc) 528 | --puts(1, find_phrase&" "&replace_phrase&"\n") 529 | hFindDlg = 0 530 | return 531 | end if 532 | --printf(1, "flags=%x\n", {flags}) 533 | 534 | backward = not and_bits(flags, FR_DOWN) 535 | result = 0 536 | if and_bits(flags, FR_MATCHCASE) then 537 | result += SCFIND_MATCHCASE 538 | end if 539 | if and_bits(flags, FR_WHOLEWORD) then 540 | result += SCFIND_WHOLEWORD 541 | end if 542 | junk = c_func(SendMessage, {hedit, SCI_SETSEARCHFLAGS, result, 0}) 543 | 544 | if and_bits(flags, FR_FINDNEXT) then 545 | if search_find(GetFindWhat(struc), backward) = 0 then 546 | result = c_func(MessageBox, {hFindDlg, 547 | alloc_string("Unable to find a match."), 548 | alloc_string("Find"), 549 | or_all({MB_APPLMODAL, MB_ICONINFORMATION, MB_OK})}) 550 | end if 551 | elsif and_bits(flags, FR_REPLACE) then 552 | result = search_replace(GetReplaceWith(struc)) 553 | if search_find(GetFindWhat(struc), backward) = 0 and result = 0 then 554 | result = c_func(MessageBox, {hFindDlg, 555 | alloc_string("Unable to find a match."), 556 | alloc_string("Replace"), 557 | or_all({MB_APPLMODAL, MB_ICONINFORMATION, MB_OK})}) 558 | end if 559 | elsif and_bits(flags, FR_REPLACEALL) then 560 | result = search_replace_all(GetFindWhat(struc), GetReplaceWith(struc)) 561 | if result then 562 | result = c_func(MessageBox, {hFindDlg, 563 | alloc_string(sprintf("%d replacements.", {result})), 564 | alloc_string("Replace All"), 565 | or_all({MB_APPLMODAL, MB_ICONINFORMATION, MB_OK})}) 566 | else 567 | result = c_func(MessageBox, {hFindDlg, 568 | alloc_string("Unable to find a match."), 569 | alloc_string("Replace All"), 570 | or_all({MB_APPLMODAL, MB_ICONINFORMATION, MB_OK})}) 571 | end if 572 | end if 573 | free_strings() 574 | end procedure 575 | 576 | 577 | function RunArgsProc(atom hdlg, atom iMsg, atom wParam, atom lParam) 578 | atom junk, hEdit, len, buf 579 | 580 | --? {hdlg, iMsg, wParam, HIWORD(lParam), LOWORD(lParam)} 581 | 582 | if iMsg = WM_INITDIALOG then 583 | junk = c_func(SendMessage, {c_func(GetDlgItem, {hdlg, IDOK}), 584 | WM_SETFONT, captionFont, 0}) 585 | junk = c_func(SendMessage, {c_func(GetDlgItem, {hdlg, IDCANCEL}), 586 | WM_SETFONT, captionFont, 0}) 587 | hEdit = c_func(GetDlgItem, {hdlg, DialogEditID}) 588 | junk = c_func(SendMessage, {hEdit, WM_SETFONT, messageFont, 0}) 589 | 590 | junk = c_func(SendMessage, {hEdit, WM_SETTEXT, 0, alloc_string(get_tab_arguments())}) 591 | junk = c_func(SetFocus, {hEdit}) 592 | junk = c_func(SendMessage, {hEdit, EM_SETSEL, 0, -1}) 593 | 594 | elsif iMsg = WM_COMMAND then 595 | if LOWORD(wParam) = IDOK then 596 | hEdit = c_func(GetDlgItem, {hdlg, DialogEditID}) 597 | len = 1 + c_func(SendMessage, {hEdit, WM_GETTEXTLENGTH, 0, 0}) 598 | buf = allocate(len) 599 | junk = c_func(SendMessage, {hEdit, WM_GETTEXT, len, buf}) 600 | junk = c_func(EndDialog, {hdlg, buf}) 601 | return 1 602 | elsif LOWORD(wParam) = IDCANCEL then 603 | junk = c_func(EndDialog, {hdlg, 0}) 604 | return 1 605 | end if 606 | 607 | elsif iMsg = WM_CLOSE then --closing dialog 608 | junk = c_func(EndDialog, {hdlg, 0}) 609 | end if 610 | 611 | return 0 612 | end function 613 | 614 | constant RunArgsCallback = callback("RunArgsProc") 615 | 616 | global procedure run_arguments() 617 | integer junk 618 | junk = DialogBoxIndirectParam(c_func(GetModuleHandle, {NULL}), { 619 | --DLGTEMPLATE{style, exstyle, x, y, cx, cy, menu, wndclass, text} 620 | {{WS_POPUP, WS_CAPTION, WS_SYSMENU, DS_MODALFRAME}, 0, 621 | 50,50, 200,36, 0, 0, "Set Arguments"}, 622 | --DLGITEMTEMPLATE{style, exstyle, x, y, cx, cy, id, dlgclass, text} 623 | {{WS_CHILD, WS_VISIBLE, WS_BORDER, ES_AUTOHSCROLL}, 0, 624 | 4,4, 192,12, DialogEditID, DIALOG_CLASS_EDIT, "tab arguments"}, 625 | {{WS_CHILD, WS_VISIBLE, BS_PUSHBUTTON}, 0, 626 | 104,20, 44,12, IDCANCEL, DIALOG_CLASS_BUTTON, "Cancel"}, 627 | {{WS_CHILD, WS_VISIBLE, BS_DEFPUSHBUTTON}, 0, 628 | 152,20, 44,12, IDOK, DIALOG_CLASS_BUTTON, "OK"} 629 | }, 630 | hMainWnd, 631 | RunArgsCallback, 632 | 0) 633 | if junk then 634 | set_tab_arguments(peek_string(junk)) 635 | free(junk) 636 | end if 637 | end procedure 638 | 639 | 640 | function RunInterpreterProc(atom hdlg, atom iMsg, atom wParam, atom lParam) 641 | atom junk, hEdit, hLabel, len, buf 642 | sequence interpreters 643 | integer index 644 | 645 | --? {hdlg, iMsg, wParam, HIWORD(lParam), LOWORD(lParam)} 646 | 647 | if iMsg = WM_INITDIALOG then 648 | junk = c_func(SendMessage, {c_func(GetDlgItem, {hdlg, IDOK}), 649 | WM_SETFONT, captionFont, 0}) 650 | junk = c_func(SendMessage, {c_func(GetDlgItem, {hdlg, IDCANCEL}), 651 | WM_SETFONT, captionFont, 0}) 652 | junk = c_func(SendMessage, {c_func(GetDlgItem, {hdlg, DialogOpenID}), 653 | WM_SETFONT, captionFont, 0}) 654 | hLabel = c_func(GetDlgItem, {hdlg, DialogLabelID}) 655 | junk = c_func(SendMessage, {hLabel, WM_SETFONT, messageFont, 0}) 656 | hEdit = c_func(GetDlgItem, {hdlg, DialogEditID}) 657 | junk = c_func(SendMessage, {hEdit, WM_SETFONT, messageFont, 0}) 658 | 659 | interpreters = get_interpreters() 660 | for i = 1 to length(interpreters) do 661 | junk = c_func(SendMessage, {hEdit, CB_ADDSTRING, 0, alloc_string(interpreters[i])}) 662 | end for 663 | index = find(interpreter, interpreters) 664 | if index then 665 | junk = c_func(SendMessage, {hEdit, CB_SETCURSEL, index-1, 0}) 666 | end if 667 | 668 | junk = c_func(SetFocus, {hEdit}) 669 | junk = c_func(SendMessage, {hEdit, EM_SETSEL, 0, -1}) 670 | 671 | elsif iMsg = WM_COMMAND then 672 | if LOWORD(wParam) = DialogOpenID then 673 | sequence temp = GetOpenFileName({hMainWnd, 0, alloc_string("Executable Files (*.exe)"&0&"*.EXE"&0&0), 0, 674 | "", 0, 0, 675 | OFN_EXPLORER + OFN_PATHMUSTEXIST + OFN_FILEMUSTEXIST + OFN_HIDEREADONLY 676 | , 0}) 677 | if length(temp) then 678 | temp = temp[2] -- just the filename 679 | hEdit = c_func(GetDlgItem, {hdlg, DialogEditID}) 680 | junk = c_func(SendMessage, {hEdit, CB_SELECTSTRING, -1, alloc_string(temp)}) 681 | if junk = CB_ERR then 682 | -- add a new filename since it wasn't found 683 | junk = c_func(SendMessage, {hEdit, CB_INSERTSTRING, 0, alloc_string(temp)}) 684 | junk = c_func(SendMessage, {hEdit, CB_SETCURSEL, 0, 0}) 685 | end if 686 | end if 687 | free_strings() 688 | elsif LOWORD(wParam) = IDOK then 689 | hEdit = c_func(GetDlgItem, {hdlg, DialogEditID}) 690 | len = 1 + c_func(SendMessage, {hEdit, WM_GETTEXTLENGTH, 0, 0}) 691 | buf = allocate(len) 692 | junk = c_func(SendMessage, {hEdit, WM_GETTEXT, len, buf}) 693 | junk = c_func(EndDialog, {hdlg, buf}) 694 | return 1 695 | elsif LOWORD(wParam) = IDCANCEL then 696 | junk = c_func(EndDialog, {hdlg, 0}) 697 | return 1 698 | end if 699 | 700 | elsif iMsg = WM_CLOSE then --closing dialog 701 | junk = c_func(EndDialog, {hdlg, 0}) 702 | end if 703 | 704 | return 0 705 | end function 706 | 707 | constant RunInterpreterCallback = callback("RunInterpreterProc") 708 | 709 | global procedure run_interpreter() 710 | integer junk 711 | junk = DialogBoxIndirectParam(c_func(GetModuleHandle, {NULL}), { 712 | --DLGTEMPLATE{style, exstyle, x, y, cx, cy, menu, wndclass, text} 713 | {{WS_POPUP, WS_CAPTION, WS_SYSMENU, DS_MODALFRAME}, 0, 714 | 50,50, 200,56, 0, 0, "Set Interpreter"}, 715 | --DLGITEMTEMPLATE{style, exstyle, x, y, cx, cy, id, dlgclass, text} 716 | {{WS_CHILD, WS_VISIBLE}, 0, 717 | 4,4, 192,20, DialogLabelID, DIALOG_CLASS_STATIC, 718 | "Enter an interpreter to use to run programs, or select one from the list.\n"& 719 | "Leave blank to use the default first item in the list."}, 720 | {{WS_CHILD, WS_VISIBLE, WS_BORDER, WS_HSCROLL, CBS_AUTOHSCROLL, CBS_DROPDOWN}, 0, 721 | 4,24, 176,12, DialogEditID, DIALOG_CLASS_COMBOBOX, "interpreter"}, 722 | {{WS_CHILD, WS_VISIBLE, BS_PUSHBUTTON}, 0, 723 | 184,24, 12,12, DialogOpenID, DIALOG_CLASS_BUTTON, "..."}, 724 | {{WS_CHILD, WS_VISIBLE, BS_PUSHBUTTON}, 0, 725 | 104,40, 44,12, IDCANCEL, DIALOG_CLASS_BUTTON, "Cancel"}, 726 | {{WS_CHILD, WS_VISIBLE, BS_DEFPUSHBUTTON}, 0, 727 | 152,40, 44,12, IDOK, DIALOG_CLASS_BUTTON, "OK"} 728 | }, 729 | hMainWnd, 730 | RunInterpreterCallback, 731 | 0) 732 | if junk then 733 | interpreter = peek_string(junk) 734 | free(junk) 735 | end if 736 | end procedure 737 | 738 | procedure run_start(integer with_args) 739 | atom result 740 | sequence args 741 | 742 | -- save, no confirm 743 | if save_if_modified(0) = 0 or length(file_name) = 0 then 744 | return -- cancelled, or no name 745 | end if 746 | 747 | run_file_name = file_name 748 | reset_ex_err() 749 | 750 | args = quote_spaces(run_file_name) 751 | if with_args then 752 | if length(get_tab_arguments()) = 0 then 753 | run_arguments() 754 | end if 755 | args &= ' ' & get_tab_arguments() 756 | end if 757 | 758 | -- if interpreter is set, use it 759 | -- elsif Eu file and eu.cfg points to eudir use it (.exw,.ew->euiw,exw, .ex,.e->eui,ex) 760 | -- else let OS handle it 761 | -- and if that fails use EUDIR or include_paths 762 | 763 | result = c_func(ShellExecute, { 764 | hMainWnd, NULL, 765 | alloc_string(get_eu_bin("")), 766 | alloc_string(args), 767 | alloc_string(dirname(run_file_name)), 768 | SW_SHOWNORMAL}) 769 | if result < 33 then 770 | -- shellexecute failed 771 | if match(".exw", lower(run_file_name)) or 772 | match(".ew", lower(run_file_name)) then 773 | system(quote_spaces(get_eu_bin("euiw")) & ' ' & args) 774 | else 775 | system(quote_spaces(get_eu_bin("eui")) & ' ' & args) 776 | end if 777 | end if 778 | free_strings() 779 | end procedure 780 | 781 | procedure run_convert(sequence name, sequence cmd) 782 | atom result 783 | 784 | -- save, no confirm 785 | if save_if_modified(0) = 0 or length(file_name) = 0 then 786 | return -- cancelled, or no name 787 | end if 788 | result = c_func(ShellExecute, { 789 | hMainWnd, NULL, 790 | alloc_string(get_eu_bin(cmd)), 791 | alloc_string(quote_spaces(file_name)), 792 | alloc_string(dirname(file_name)), 793 | SW_SHOWNORMAL}) 794 | if result < 33 then 795 | ui_message_box_error(name, cmd & " failed") 796 | end if 797 | end procedure 798 | 799 | function get_appdata_path() 800 | atom junk, path 801 | sequence appdata 802 | path = allocate(MAX_PATH) 803 | junk = c_func(SHGetFolderPath, { 804 | NULL, 805 | CSIDL_LOCAL_APPDATA + CSIDL_FLAG_CREATE, 806 | NULL, 807 | 0, 808 | path}) 809 | appdata = peek_string(path) 810 | free(path) 811 | return appdata 812 | end function 813 | 814 | constant wee_conf_filename = get_appdata_path() & "\\wee_conf.txt" 815 | 816 | 817 | function ColorsDialogProc(atom hdlg, atom iMsg, atom wParam, atom lParam) 818 | atom junk, hEdit, len, buf 819 | integer id 820 | 821 | --? {hdlg, iMsg, wParam, HIWORD(lParam), LOWORD(lParam)} 822 | 823 | if iMsg = WM_INITDIALOG then 824 | junk = c_func(SendMessage, {c_func(GetDlgItem, {hdlg, IDOK}), 825 | WM_SETFONT, captionFont, 0}) 826 | for i = 1000 to 1016 do 827 | junk = c_func(SendMessage, {c_func(GetDlgItem, {hdlg, i}), 828 | WM_SETFONT, captionFont, 0}) 829 | end for 830 | for i = 0 to 6 do 831 | if and_bits(bold_flags, power(2, i)) then 832 | junk = BST_CHECKED 833 | else 834 | junk = BST_UNCHECKED 835 | end if 836 | junk = c_func(SendMessage, {c_func(GetDlgItem, {hdlg, 1010+i}), 837 | BM_SETCHECK, junk, 0}) 838 | end for 839 | 840 | elsif iMsg = WM_COMMAND then 841 | id = LOWORD(wParam) 842 | if id = IDOK then 843 | junk = c_func(EndDialog, {hdlg, 1}) 844 | return 1 845 | elsif id = IDCANCEL then 846 | junk = c_func(EndDialog, {hdlg, 0}) 847 | return 1 848 | elsif id = 1000 then 849 | normal_color = ChooseColor(hMainWnd, normal_color) 850 | reinit_all_edits() 851 | return 0 852 | elsif id = 1001 then 853 | background_color = ChooseColor(hMainWnd, background_color) 854 | reinit_all_edits() 855 | return 0 856 | elsif id = 1002 then 857 | comment_color = ChooseColor(hMainWnd, comment_color) 858 | reinit_all_edits() 859 | return 0 860 | elsif id = 1003 then 861 | string_color = ChooseColor(hMainWnd, string_color) 862 | reinit_all_edits() 863 | return 0 864 | elsif id = 1004 then 865 | keyword_color = ChooseColor(hMainWnd, keyword_color) 866 | reinit_all_edits() 867 | return 0 868 | elsif id = 1005 then 869 | builtin_color = ChooseColor(hMainWnd, builtin_color) 870 | reinit_all_edits() 871 | return 0 872 | elsif id = 1006 then 873 | number_color = ChooseColor(hMainWnd, number_color) 874 | reinit_all_edits() 875 | return 0 876 | elsif id = 1007 then 877 | bracelight_color = ChooseColor(hMainWnd, bracelight_color) 878 | reinit_all_edits() 879 | return 0 880 | elsif id = 1008 then 881 | linenumber_color = ChooseColor(hMainWnd, linenumber_color) 882 | reinit_all_edits() 883 | return 0 884 | elsif id >= 1010 and id <= 1016 then 885 | junk = power(2, id - 1010) 886 | if and_bits(bold_flags, junk) then 887 | bold_flags = and_bits(bold_flags, not_bits(junk)) 888 | junk = BST_UNCHECKED 889 | else 890 | bold_flags = or_bits(bold_flags, junk) 891 | junk = BST_CHECKED 892 | end if 893 | junk = c_func(SendMessage, { 894 | c_func(GetDlgItem, {hdlg, id}), BM_SETCHECK, junk, 0}) 895 | reinit_all_edits() 896 | return 0 897 | end if 898 | 899 | elsif iMsg = WM_CLOSE then --closing dialog 900 | junk = c_func(EndDialog, {hdlg, 0}) 901 | end if 902 | 903 | return 0 904 | end function 905 | 906 | constant ColorsDialogCallback = callback("ColorsDialogProc") 907 | 908 | global procedure choose_colors() 909 | integer junk 910 | junk = DialogBoxIndirectParam(c_func(GetModuleHandle, {NULL}), { 911 | --DLGTEMPLATE{style, exstyle, x, y, cx, cy, menu, wndclass, text} 912 | {{WS_POPUP, WS_CAPTION, WS_SYSMENU, DS_MODALFRAME}, 0, 913 | 50,50, 100,166, 0, 0, "Colors"}, 914 | --DLGITEMTEMPLATE{style, exstyle, x, y, cx, cy, id, dlgclass, text} 915 | {{WS_CHILD, WS_VISIBLE, BS_PUSHBUTTON}, 0, 916 | 4,4, 64,12, 1000, DIALOG_CLASS_BUTTON, "Normal"}, 917 | {{WS_CHILD, WS_VISIBLE, BS_PUSHBUTTON}, 0, 918 | 4,20, 64,12, 1001, DIALOG_CLASS_BUTTON, "Background"}, 919 | {{WS_CHILD, WS_VISIBLE, BS_PUSHBUTTON}, 0, 920 | 4,36, 64,12, 1002, DIALOG_CLASS_BUTTON, "Comment"}, 921 | {{WS_CHILD, WS_VISIBLE, BS_PUSHBUTTON}, 0, 922 | 4,52, 64,12, 1003, DIALOG_CLASS_BUTTON, "String"}, 923 | {{WS_CHILD, WS_VISIBLE, BS_PUSHBUTTON}, 0, 924 | 4,68, 64,12, 1004, DIALOG_CLASS_BUTTON, "Keyword"}, 925 | {{WS_CHILD, WS_VISIBLE, BS_PUSHBUTTON}, 0, 926 | 4,84, 64,12, 1005, DIALOG_CLASS_BUTTON, "Built-in"}, 927 | {{WS_CHILD, WS_VISIBLE, BS_PUSHBUTTON}, 0, 928 | 4,100, 64,12, 1006, DIALOG_CLASS_BUTTON, "Number"}, 929 | {{WS_CHILD, WS_VISIBLE, BS_PUSHBUTTON}, 0, 930 | 4,116, 64,12, 1007, DIALOG_CLASS_BUTTON, "Brace Highlight"}, 931 | {{WS_CHILD, WS_VISIBLE, BS_PUSHBUTTON}, 0, 932 | 4,132, 64,12, 1008, DIALOG_CLASS_BUTTON, "Line Number"}, 933 | 934 | 935 | {{WS_CHILD, WS_VISIBLE, BS_CHECKBOX}, 0, 936 | 72,4, 32,12, 1010, DIALOG_CLASS_BUTTON, "Bold"}, 937 | {{WS_CHILD, WS_VISIBLE, BS_CHECKBOX}, 0, 938 | 72,36, 32,12, 1011, DIALOG_CLASS_BUTTON, "Bold"}, 939 | {{WS_CHILD, WS_VISIBLE, BS_CHECKBOX}, 0, 940 | 72,52, 32,12, 1012, DIALOG_CLASS_BUTTON, "Bold"}, 941 | {{WS_CHILD, WS_VISIBLE, BS_CHECKBOX}, 0, 942 | 72,68, 32,12, 1013, DIALOG_CLASS_BUTTON, "Bold"}, 943 | {{WS_CHILD, WS_VISIBLE, BS_CHECKBOX}, 0, 944 | 72,84, 32,12, 1014, DIALOG_CLASS_BUTTON, "Bold"}, 945 | {{WS_CHILD, WS_VISIBLE, BS_CHECKBOX}, 0, 946 | 72,100, 32,12, 1015, DIALOG_CLASS_BUTTON, "Bold"}, 947 | {{WS_CHILD, WS_VISIBLE, BS_CHECKBOX}, 0, 948 | 72,116, 32,12, 1016, DIALOG_CLASS_BUTTON, "Bold"}, 949 | 950 | {{WS_CHILD, WS_VISIBLE, BS_DEFPUSHBUTTON}, 0, 951 | 4,150, 44,12, IDOK, DIALOG_CLASS_BUTTON, "Close"} 952 | }, 953 | hMainWnd, 954 | ColorsDialogCallback, 955 | 0) 956 | end procedure 957 | 958 | function icon_from_xpm(sequence xpm) 959 | sequence colors = repeat(0,255), pixels = {}, andbits = {} 960 | integer w = 0, h = 0, clear = 0 961 | atom buf, handle, mask, iconinfo, hbmMask, hbmColor 962 | 963 | for i = 2 to length(xpm) do 964 | if length(xpm[i]) >= 6 and xpm[i][3] = 'c' then 965 | if equal(xpm[i][5..$], "None") then 966 | clear = xpm[i][1] 967 | else 968 | colors[xpm[i][1]] = value(xpm[i][5..$]) 969 | end if 970 | else 971 | w = length(xpm[i]) 972 | h += 1 973 | for j = 1 to length(xpm[i]) do 974 | if remainder(j, 8) = 1 then 975 | andbits &= 0 976 | end if 977 | if xpm[i][j] = clear then 978 | andbits[$] = or_bits(andbits[$], power(2, 7-and_bits(j-1,7))) 979 | pixels &= 0 980 | else 981 | pixels &= #FF000000 + colors[xpm[i][j]][2] 982 | end if 983 | end for 984 | end if 985 | end for 986 | mask = allocate(length(andbits)) 987 | poke(mask, andbits) 988 | buf = allocate(length(pixels)*4) 989 | poke4(buf, pixels) 990 | hbmMask = c_func(CreateBitmap, {w, h, 1, 1, mask}) 991 | hbmColor = c_func(CreateBitmap, {w, h, 1, 32, buf}) 992 | iconinfo = allocate_pack("iddpp", {1,0,0,hbmMask,hbmColor}) 993 | handle = c_func(CreateIconIndirect, {iconinfo}) 994 | c_func(DeleteObject, {hbmMask}) 995 | c_func(DeleteObject, {hbmColor}) 996 | free(buf) 997 | free(mask) 998 | free(iconinfo) 999 | 1000 | return handle 1001 | end function 1002 | 1003 | include weeicon.e 1004 | constant wee_icon = icon_from_xpm(wee_xpm) 1005 | 1006 | function IndentDialogProc(atom hdlg, atom iMsg, atom wParam, atom lParam) 1007 | atom junk, len, buf 1008 | integer id, tab_width, indent_width, use_tabs, check 1009 | sequence val 1010 | 1011 | --? {hdlg, iMsg, wParam, HIWORD(lParam), LOWORD(lParam)} 1012 | 1013 | if iMsg = WM_INITDIALOG then 1014 | junk = c_func(SendMessage, {c_func(GetDlgItem, {hdlg, IDOK}), 1015 | WM_SETFONT, captionFont, 0}) 1016 | junk = c_func(SendMessage, {c_func(GetDlgItem, {hdlg, IDCANCEL}), 1017 | WM_SETFONT, captionFont, 0}) 1018 | for i = 1000 to 1005 do 1019 | junk = c_func(SendMessage, {c_func(GetDlgItem, {hdlg, i}), 1020 | WM_SETFONT, captionFont, 0}) 1021 | end for 1022 | hDlg = hdlg 1023 | 1024 | tab_width = c_func(SendMessage, {hedit, SCI_GETTABWIDTH, 0, 0}) 1025 | indent_width = c_func(SendMessage, {hedit, SCI_GETINDENT, 0, 0}) 1026 | use_tabs = c_func(SendMessage, {hedit, SCI_GETUSETABS, 0, 0}) 1027 | junk = c_func(SendMessage, {c_func(GetDlgItem, {hdlg, 1001}), 1028 | WM_SETTEXT, 0, alloc_string(sprintf("%d", {tab_width}))}) 1029 | junk = c_func(SendMessage, {c_func(GetDlgItem, {hdlg, 1003}), 1030 | WM_SETTEXT, 0, alloc_string(sprintf("%d", {indent_width}))}) 1031 | 1032 | if use_tabs then 1033 | check = BST_CHECKED 1034 | else 1035 | check = BST_UNCHECKED 1036 | end if 1037 | junk = c_func(SendMessage, {c_func(GetDlgItem, {hdlg, 1004}), 1038 | BM_SETCHECK, check, 0}) 1039 | if indentation_guides then 1040 | check = BST_CHECKED 1041 | else 1042 | check = BST_UNCHECKED 1043 | end if 1044 | junk = c_func(SendMessage, {c_func(GetDlgItem, {hdlg, 1005}), 1045 | BM_SETCHECK, check, 0}) 1046 | 1047 | elsif iMsg = WM_COMMAND then 1048 | id = LOWORD(wParam) 1049 | if id = IDOK then 1050 | buf = allocate(16) 1051 | junk = c_func(SendMessage, {c_func(GetDlgItem, {hdlg, 1001}), 1052 | WM_GETTEXT, 16, buf}) 1053 | val = value(peek_string(buf)) 1054 | if val[1] = 0 and integer(val[2]) then 1055 | tab_width = val[2] 1056 | else 1057 | tab_width = 0 1058 | end if 1059 | junk = c_func(SendMessage, {c_func(GetDlgItem, {hdlg, 1003}), 1060 | WM_GETTEXT, 16, buf}) 1061 | val = value(peek_string(buf)) 1062 | if val[1] = 0 and integer(val[2]) then 1063 | indent_width = val[2] 1064 | else 1065 | indent_width = 0 1066 | end if 1067 | free(buf) 1068 | 1069 | if indent_width < 1 or indent_width > 8 or 1070 | tab_width < 1 or tab_width > 8 then 1071 | return 0 1072 | end if 1073 | 1074 | use_tabs = BST_CHECKED = c_func(SendMessage, { 1075 | c_func(GetDlgItem, {hdlg, 1004}), BM_GETCHECK, 0, 0}) 1076 | indentation_guides = BST_CHECKED = c_func(SendMessage, { 1077 | c_func(GetDlgItem, {hdlg, 1005}), BM_GETCHECK, 0, 0}) 1078 | 1079 | junk = c_func(SendMessage, {hedit, SCI_SETTABWIDTH, tab_width, 0}) 1080 | junk = c_func(SendMessage, {hedit, SCI_SETINDENT, indent_width, 0}) 1081 | junk = c_func(SendMessage, {hedit, SCI_SETUSETABS, use_tabs, 0}) 1082 | reinit_all_edits() 1083 | 1084 | junk = c_func(EndDialog, {hdlg, 1}) 1085 | return 1 1086 | elsif id = IDCANCEL then 1087 | junk = c_func(EndDialog, {hdlg, 0}) 1088 | return 1 1089 | elsif id = 1004 or id = 1005 then 1090 | junk = c_func(SendMessage, { 1091 | c_func(GetDlgItem, {hdlg, id}), BM_GETCHECK, 0, 0}) 1092 | if junk = BST_CHECKED then 1093 | junk = BST_UNCHECKED 1094 | else 1095 | junk = BST_CHECKED 1096 | end if 1097 | junk = c_func(SendMessage, { 1098 | c_func(GetDlgItem, {hdlg, id}), BM_SETCHECK, junk, 0}) 1099 | end if 1100 | 1101 | elsif iMsg = WM_CLOSE then --closing dialog 1102 | junk = c_func(EndDialog, {hdlg, 0}) 1103 | hDlg = 0 1104 | end if 1105 | 1106 | return 0 1107 | end function 1108 | 1109 | constant IndentDialogCallback = callback("IndentDialogProc") 1110 | 1111 | global procedure indent_dialog() 1112 | integer junk 1113 | junk = DialogBoxIndirectParam(c_func(GetModuleHandle, {NULL}), { 1114 | --DLGTEMPLATE{style, exstyle, x, y, cx, cy, menu, wndclass, text} 1115 | {{WS_POPUP, WS_CAPTION, WS_SYSMENU, DS_MODALFRAME}, 0, 1116 | 50,50, 100,82, 0, 0, "Indent"}, 1117 | --DLGITEMTEMPLATE{style, exstyle, x, y, cx, cy, id, dlgclass, text} 1118 | 1119 | {{WS_CHILD, WS_VISIBLE}, 0, 1120 | 4,4, 44,12, 1002, DIALOG_CLASS_STATIC, "Indent size"}, 1121 | {{WS_CHILD, WS_VISIBLE, WS_BORDER, ES_AUTOHSCROLL, ES_NUMBER}, 0, 1122 | 52,4, 44,12, 1003, DIALOG_CLASS_EDIT, ""}, 1123 | 1124 | {{WS_CHILD, WS_VISIBLE, BS_CHECKBOX}, 0, 1125 | 4,20, 92,12, 1005, DIALOG_CLASS_BUTTON, "Show indentation guides"}, 1126 | 1127 | {{WS_CHILD, WS_VISIBLE, BS_CHECKBOX}, 0, 1128 | 4,34, 92,12, 1004, DIALOG_CLASS_BUTTON, "Use tabs in indentation"}, 1129 | 1130 | {{WS_CHILD, WS_VISIBLE}, 0, 1131 | 4,50, 44,12, 1000, DIALOG_CLASS_STATIC, "Tab size"}, 1132 | {{WS_CHILD, WS_VISIBLE, WS_BORDER, ES_AUTOHSCROLL, ES_NUMBER}, 0, 1133 | 52,50, 44,12, 1001, DIALOG_CLASS_EDIT, ""}, 1134 | 1135 | {{WS_CHILD, WS_VISIBLE, BS_PUSHBUTTON}, 0, 1136 | 4,66, 44,12, IDCANCEL, DIALOG_CLASS_BUTTON, "Cancel"}, 1137 | {{WS_CHILD, WS_VISIBLE, BS_DEFPUSHBUTTON}, 0, 1138 | 52,66, 44,12, IDOK, DIALOG_CLASS_BUTTON, "OK"} 1139 | }, 1140 | hMainWnd, 1141 | IndentDialogCallback, 1142 | 0) 1143 | end procedure 1144 | 1145 | 1146 | 1147 | procedure init_fonts() 1148 | atom junk, lf_facesize, lf_size, size, ncm, lf, 1149 | lfCaptionFont, lfSmCaptionFont, lfMenuFont, lfStatusFont, lfMessageFont 1150 | 1151 | lf_facesize = 32 1152 | lf_size = 4*5 + 8 + lf_facesize 1153 | size = 4 + 4*5 1154 | lfCaptionFont = size 1155 | size += lf_size + 4*2 1156 | lfSmCaptionFont = size 1157 | size += lf_size + 4*2 1158 | lfMenuFont = size 1159 | size += lf_size 1160 | lfStatusFont = size 1161 | size += lf_size 1162 | lfMessageFont = size 1163 | size += lf_size 1164 | ncm = allocate(size) 1165 | 1166 | poke4(ncm, size) 1167 | poke4(ncm+lfCaptionFont, -1) 1168 | poke4(ncm+lfSmCaptionFont, -1) 1169 | poke4(ncm+lfMenuFont, -1) 1170 | poke4(ncm+lfStatusFont, -1) 1171 | poke4(ncm+lfMessageFont, -1) 1172 | 1173 | junk = c_func(SystemParametersInfo, {SPI_GETNONCLIENTMETRICS, size, ncm, 0}) 1174 | 1175 | captionFont = c_func(CreateFontIndirect, {ncm+lfCaptionFont}) 1176 | smCaptionFont = c_func(CreateFontIndirect, {ncm+lfSmCaptionFont}) 1177 | menuFont = c_func(CreateFontIndirect, {ncm+lfMenuFont}) 1178 | statusFont = c_func(CreateFontIndirect, {ncm+lfStatusFont}) 1179 | messageFont = c_func(CreateFontIndirect, {ncm+lfMessageFont}) 1180 | free(ncm) 1181 | end procedure 1182 | 1183 | procedure process_dropfiles(atom hDrop) 1184 | integer count, len, size 1185 | atom buf, junk 1186 | 1187 | -- get the number of files dropped 1188 | count = c_func(DragQueryFile, {hDrop, #FFFFFFFF, NULL, 0}) 1189 | for i = 0 to count-1 do 1190 | -- get the length of the indexed filename and null-terminator 1191 | size = c_func(DragQueryFile, {hDrop, i, NULL, 0}) + 1 1192 | buf = allocate(size) 1193 | -- get the indexed filename into our buffer and open it 1194 | junk = c_func(DragQueryFile, {hDrop, i, buf, size}) 1195 | open_file(peek_string(buf), 0) 1196 | free(buf) 1197 | end for 1198 | c_proc(DragFinish, {hDrop}) 1199 | end procedure 1200 | 1201 | 1202 | integer doing_setfocus_checks 1203 | doing_setfocus_checks = 0 1204 | 1205 | global function WndProc(atom hwnd, atom iMsg, atom wParam, atom lParam) 1206 | -- callback routine to handle Window class 1207 | atom junk, hwndFrom, code 1208 | integer rc 1209 | rc = 0 1210 | 1211 | if hwnd != hMainWnd then 1212 | --? {hwnd, iMsg, wParam, lParam} 1213 | return c_func(DefWindowProc, {hwnd, iMsg, wParam, lParam}) 1214 | end if 1215 | if iMsg = WM_NOTIFY then 1216 | sequence nmhdr = unpack(lParam, "ppi") 1217 | -- lParam is pointer to NMHDR { HWND hwndFrom; UINT_PTR idFrom; UINT code; } 1218 | hwndFrom = nmhdr[1] 1219 | code = nmhdr[3] 1220 | --printf(1, "hwndFrom=%x idFrom=%x code=%x %x %x\n", nmhdr & {LOWORD(code), HIWORD(code)}) 1221 | 1222 | if hwndFrom = hedit then 1223 | sci_notify(c_func(SendMessage, {hedit, SCI_GETDIRECTPOINTER, 0, 0}), 0, lParam, 0) 1224 | return rc 1225 | 1226 | elsif hwndFrom = htabs then 1227 | if code = TCN_SELCHANGE then 1228 | select_tab(1 + c_func(SendMessage, {htabs, TCM_GETCURSEL, 0, 0})) 1229 | elsif code = TCN_SELCHANGING then 1230 | -- unhighlight the current tab 1231 | junk = c_func(SendMessage, {htabs, TCM_HIGHLIGHTITEM, 1232 | c_func(SendMessage, {htabs, TCM_GETCURSEL, 0, 0}), 0}) 1233 | elsif code = NM_RCLICK then 1234 | rightclick_tab() 1235 | end if 1236 | elsif hwndFrom = htooltip and code = TTN_NEEDTEXT then 1237 | junk = allocate_pack("zdppddddps", { -- TOOLINFO 1238 | TTF_IDISHWND + TTF_SUBCLASS, -- uFlags 1239 | hMainWnd, -- hwnd 1240 | htabs, -- uId 1241 | 0,0,0,0, -- rect 1242 | 0, -- hinst 1243 | file_name -- lpszText 1244 | }) 1245 | c_func(SendMessage, {htooltip, TTM_UPDATETIPTEXT, 0, junk}) 1246 | free(junk) 1247 | end if 1248 | end if 1249 | 1250 | if iMsg = WM_CREATE then 1251 | return rc 1252 | elsif iMsg = WM_DESTROY then 1253 | c_proc(PostQuitMessage, {0}) 1254 | get_window_size() 1255 | save_wee_conf(wee_conf_filename) 1256 | return rc 1257 | elsif iMsg = WM_SIZE then --resize the rich edit control to fit the window 1258 | c_proc(MoveWindow, {hedit, 0, tab_h, LOWORD(lParam), HIWORD(lParam)-tab_h, 1}) 1259 | c_proc(MoveWindow, {hstatus, LOWORD(lParam)-64, 2, 64, tab_h-4, 1}) 1260 | c_proc(MoveWindow, {htabs, 0, 0, LOWORD(lParam), tab_h, 1}) 1261 | return rc 1262 | elsif iMsg = WM_CLOSE then --closing window 1263 | if save_modified_tabs() then 1264 | junk = c_func(DestroyWindow, {hwnd}) 1265 | end if 1266 | return rc 1267 | elsif iMsg = WM_SETFOCUS then --always pass focus on to rich edit control 1268 | if not doing_setfocus_checks then 1269 | doing_setfocus_checks = 1 1270 | check_ex_err() 1271 | check_externally_modified_tabs() 1272 | junk = c_func(SetFocus, {hedit}) 1273 | doing_setfocus_checks = 0 1274 | end if 1275 | return rc 1276 | elsif iMsg = WM_COMMAND then 1277 | if lParam = 0 then 1278 | if wParam = File_New then 1279 | new_file() 1280 | return rc 1281 | elsif wParam = File_Open then 1282 | open_file("", 0) 1283 | return rc 1284 | elsif wParam = File_Save then 1285 | save_if_modified(0) -- no confirm 1286 | return rc 1287 | elsif wParam = File_SaveAs then 1288 | junk = save_file_as() 1289 | return rc 1290 | elsif wParam = File_Close then 1291 | close_tab() 1292 | return rc 1293 | elsif wParam = File_Exit then 1294 | return c_func(SendMessage, {hwnd, WM_CLOSE, 0, 0}) 1295 | elsif wParam = Edit_Undo then 1296 | return c_func(SendMessage, {hedit, WM_UNDO, 0, 0}) 1297 | elsif wParam = Edit_Redo then 1298 | return c_func(SendMessage, {hedit, SCI_REDO, 0, 0}) 1299 | elsif wParam = Edit_Cut then 1300 | return c_func(SendMessage, {hedit, WM_CUT, 0, 0}) 1301 | elsif wParam = Edit_Copy then 1302 | return c_func(SendMessage, {hedit, WM_COPY, 0, 0}) 1303 | elsif wParam = Edit_Paste then 1304 | return c_func(SendMessage, {hedit, WM_PASTE, 0, 0}) 1305 | elsif wParam = Edit_Clear then 1306 | return c_func(SendMessage, {hedit, WM_CLEAR, 0, 0}) 1307 | elsif wParam = Edit_SelectAll then 1308 | return c_func(SendMessage, {hedit, EM_SETSEL, 0, -1}) 1309 | elsif wParam = Edit_ToggleComment then 1310 | toggle_comment() 1311 | return rc 1312 | elsif wParam = Search_Find then 1313 | sequence s = get_selection() 1314 | if length(s) then 1315 | find_phrase = s 1316 | end if 1317 | hFindDlg = FindText(hMainWnd,0,FR_DOWN,find_phrase) 1318 | return rc 1319 | elsif wParam = Search_Find_Next then 1320 | if length(find_phrase) = 0 then 1321 | sequence s = get_selection() 1322 | if length(s) then 1323 | find_phrase = s 1324 | end if 1325 | hFindDlg = FindText(hMainWnd,0,FR_DOWN,find_phrase) 1326 | else 1327 | search_find(find_phrase, 0) 1328 | end if 1329 | return rc 1330 | elsif wParam = Search_Find_Prev then 1331 | search_find(find_phrase, 1) 1332 | return rc 1333 | elsif wParam = Search_Replace then 1334 | sequence s = get_selection() 1335 | if length(s) then 1336 | find_phrase = s 1337 | end if 1338 | hFindDlg = ReplaceText(hMainWnd,0,FR_DOWN,find_phrase,replace_phrase) 1339 | return rc 1340 | elsif wParam = View_Subs then 1341 | view_subroutines() 1342 | return rc 1343 | elsif wParam = View_Error then 1344 | ui_view_error() 1345 | return rc 1346 | elsif wParam = View_Completions then 1347 | view_completions() 1348 | return rc 1349 | elsif wParam = View_Declaration then 1350 | view_declaration() 1351 | return rc 1352 | elsif wParam = View_SubArgs then 1353 | view_subroutine_arguments() 1354 | return rc 1355 | elsif wParam = View_GoBack then 1356 | go_back() 1357 | return rc 1358 | elsif wParam = Run_Start then 1359 | run_start(0) 1360 | return rc 1361 | elsif wParam = Run_WithArgs then 1362 | run_start(1) 1363 | return rc 1364 | elsif wParam = Run_Arguments then 1365 | run_arguments() 1366 | return rc 1367 | elsif wParam = Run_Interpreter then 1368 | run_interpreter() 1369 | elsif wParam = Run_Bind then 1370 | run_convert("Bind", "eubind") 1371 | return rc 1372 | elsif wParam = Run_Shroud then 1373 | run_convert("Shroud", "eushroud") 1374 | return rc 1375 | elsif wParam = Run_Translate then 1376 | run_convert("Translate", "euc") 1377 | return rc 1378 | elsif wParam = Options_Font then 1379 | sequence s = ChooseFont(hMainWnd, font_name, font_height) 1380 | if length(s) then 1381 | font_name = s[1] 1382 | font_height = s[2] 1383 | reinit_all_edits() 1384 | end if 1385 | return rc 1386 | elsif wParam = Options_LineNumbers then 1387 | line_numbers = not line_numbers 1388 | reinit_all_edits() 1389 | return c_func(CheckMenuItem, {hoptionsmenu, Options_LineNumbers, MF_CHECKED*line_numbers}) 1390 | elsif wParam = Options_SortedSubs then 1391 | sorted_subs = not sorted_subs 1392 | return c_func(CheckMenuItem, {hoptionsmenu, Options_SortedSubs, MF_CHECKED*sorted_subs}) 1393 | elsif wParam = Options_Colors then 1394 | choose_colors() 1395 | return rc 1396 | elsif wParam = Options_LineWrap then 1397 | line_wrap = not line_wrap 1398 | reinit_all_edits() 1399 | return c_func(CheckMenuItem, {hoptionsmenu, Options_LineWrap, MF_CHECKED*line_wrap}) 1400 | elsif wParam = Options_ReopenTabs then 1401 | reopen_tabs = not reopen_tabs 1402 | return c_func(CheckMenuItem, {hoptionsmenu, Options_ReopenTabs, MF_CHECKED*reopen_tabs}) 1403 | elsif wParam = Options_CompleteStatements then 1404 | complete_statements = not complete_statements 1405 | return c_func(CheckMenuItem, {hoptionsmenu, Options_CompleteStatements, MF_CHECKED*complete_statements}) 1406 | elsif wParam = Options_CompleteBraces then 1407 | complete_braces = not complete_braces 1408 | return c_func(CheckMenuItem, {hoptionsmenu, Options_CompleteBraces, MF_CHECKED*complete_braces}) 1409 | elsif wParam = Options_ErrorIndicators then 1410 | auto_indicator = not auto_indicator 1411 | return c_func(CheckMenuItem, {hoptionsmenu, Options_ErrorIndicators, MF_CHECKED*auto_indicator}) 1412 | elsif wParam = Options_Indent then 1413 | indent_dialog() 1414 | return rc 1415 | elsif wParam = Help_About then 1416 | about_box() 1417 | return rc 1418 | elsif wParam = Help_Tutorial then 1419 | open_tutorial() 1420 | return rc 1421 | elsif wParam = Help_ReleaseNotes then 1422 | release_notes() 1423 | return rc 1424 | elsif wParam = Help_Context then 1425 | context_help() 1426 | return rc 1427 | elsif wParam > File_Recent and wParam <= File_Recent + max_recent_files then 1428 | open_recent(wParam - File_Recent) 1429 | elsif wParam >= Select_Tab and wParam <= Select_Tab + 9 then 1430 | select_tab(wParam - Select_Tab + 1) 1431 | elsif wParam = Select_Prev_Tab then 1432 | select_tab(get_prev_tab()) 1433 | elsif wParam = Select_Next_Tab then 1434 | select_tab(get_next_tab()) 1435 | else 1436 | printf(1, "%d %d\n", {wParam, lParam}) 1437 | end if 1438 | else 1439 | --printf(1, "HIWORD:%d LOWORD:%d LPARAM:%d\n", {HIWORD(wParam), LOWORD(wParam), lParam}) 1440 | end if 1441 | elsif iMsg = WM_FIND then -- find/replace dialog 1442 | process_find(lParam) 1443 | elsif iMsg = WM_DROPFILES then 1444 | process_dropfiles(wParam) 1445 | else 1446 | --printf(1, "hwnd=%x iMsg=%d #%x wParam=%d lParam=%d\n", {hwnd, iMsg, iMsg, wParam, lParam}) 1447 | 1448 | end if 1449 | 1450 | return c_func(DefWindowProc, {hwnd, iMsg, wParam, lParam}) 1451 | end function 1452 | 1453 | -- The scintilla edit control doesn't offer a way to hook accelerator keys 1454 | -- so we have to process messages in our message loop, and intercept and 1455 | -- rewrite them into WM_COMMAND messages for the main window handle. 1456 | procedure translate_editor_keys(atom msg) 1457 | atom hwnd, iMsg, wParam, lParam 1458 | sequence m 1459 | integer ctrl, shift 1460 | 1461 | m = unpack(msg, "pdpp") 1462 | 1463 | hwnd = m[1] 1464 | iMsg = m[2] 1465 | wParam = m[3] 1466 | lParam = m[4] 1467 | 1468 | if hwnd != hedit then 1469 | if hwnd = htabs and iMsg = WM_MBUTTONDOWN then 1470 | atom point 1471 | integer tab 1472 | point = allocate(12) 1473 | poke4(point, {LOWORD(lParam), HIWORD(lParam), 0}) 1474 | tab = c_func(SendMessage, {htabs, TCM_HITTEST, 0, point}) 1475 | free(point) 1476 | if tab >= 0 then 1477 | -- middle click to close tab 1478 | select_tab(tab + 1) 1479 | m = {hMainWnd, WM_COMMAND, File_Close, 0} 1480 | pack(msg, "pdpp", m) 1481 | end if 1482 | elsif hwnd = htabs and iMsg = WM_MOUSEWHEEL then 1483 | -- select prev/next tabs when scrolled by mouse wheel 1484 | if HIWORD(wParam) < #8000 then 1485 | m = {hMainWnd, WM_COMMAND, Select_Prev_Tab, 0} 1486 | else 1487 | m = {hMainWnd, WM_COMMAND, Select_Next_Tab, 0} 1488 | end if 1489 | pack(msg, "pdpp", m) 1490 | end if 1491 | return 1492 | end if 1493 | 1494 | if iMsg = WM_CHAR then 1495 | shift = and_bits(c_func(GetKeyState, {VK_SHIFT}), #8000) 1496 | ctrl = and_bits(c_func(GetKeyState, {VK_CONTROL}), #8000) 1497 | --printf(1, "%x %x %x %x\n", {hwnd, iMsg, wParam, lParam}) 1498 | if wParam = 27 then -- Esc 1499 | m = {hMainWnd, WM_COMMAND, View_GoBack, 0} 1500 | elsif not ctrl then 1501 | -- control key is not pressed 1502 | elsif wParam = #13 then -- Ctrl+S 1503 | m = {hMainWnd, WM_COMMAND, File_Save, 0} 1504 | elsif wParam = #6 then -- Ctrl+F 1505 | m = {hMainWnd, WM_COMMAND, Search_Find, 0} 1506 | elsif wParam = #12 then -- Ctrl+R 1507 | m = {hMainWnd, WM_COMMAND, Search_Replace, 0} 1508 | elsif wParam = #7 then -- Ctrl+G 1509 | if shift then 1510 | m = {hMainWnd, WM_COMMAND, Search_Find_Prev, 0} 1511 | else 1512 | m = {hMainWnd, WM_COMMAND, Search_Find_Next, 0} 1513 | end if 1514 | elsif wParam = #17 then -- Ctrl+W 1515 | m = {hMainWnd, WM_COMMAND, File_Close, 0} 1516 | elsif wParam = #D then -- Ctrl+M 1517 | m = {hMainWnd, WM_COMMAND, Edit_ToggleComment, 0} 1518 | elsif wParam = #E then -- Ctrl+N 1519 | m = {hMainWnd, WM_COMMAND, File_New, 0} 1520 | elsif wParam = #F then -- Ctrl+O 1521 | m = {hMainWnd, WM_COMMAND, File_Open, 0} 1522 | elsif wParam = #11 then -- Ctrl+Q 1523 | m = {hMainWnd, WM_COMMAND, File_Exit, 0} 1524 | elsif wParam = VK_SPACE then 1525 | m = {hMainWnd, WM_COMMAND, View_Completions, 0} 1526 | elsif wParam = 26 and shift then 1527 | m = {hMainWnd, WM_COMMAND, Edit_Redo, 0} 1528 | elsif wParam = 25 then -- Ctrl+Y 1529 | m = {hMainWnd, WM_COMMAND, Edit_Redo, 0} 1530 | else 1531 | return 1532 | end if 1533 | elsif iMsg = WM_KEYUP then 1534 | shift = and_bits(c_func(GetKeyState, {VK_SHIFT}), #8000) 1535 | ctrl = and_bits(c_func(GetKeyState, {VK_CONTROL}), #8000) 1536 | if wParam = VK_F5 and shift then 1537 | m = {hMainWnd, WM_COMMAND, Run_WithArgs, 0} 1538 | elsif wParam = VK_F5 then 1539 | m = {hMainWnd, WM_COMMAND, Run_Start, 0} 1540 | elsif wParam = VK_F4 and ctrl then 1541 | m = {hMainWnd, WM_COMMAND, File_Close, 0} 1542 | elsif wParam = VK_F4 then 1543 | m = {hMainWnd, WM_COMMAND, View_Error, 0} 1544 | elsif wParam = VK_F3 then 1545 | if shift then 1546 | m = {hMainWnd, WM_COMMAND, Search_Find_Prev, 0} 1547 | elsif ctrl then 1548 | m = {hMainWnd, WM_COMMAND, Search_Find, 0} 1549 | else 1550 | m = {hMainWnd, WM_COMMAND, Search_Find_Next, 0} 1551 | end if 1552 | elsif wParam = VK_F2 and ctrl then 1553 | m = {hMainWnd, WM_COMMAND, View_Declaration, 0} 1554 | elsif wParam = VK_F2 and shift then 1555 | m = {hMainWnd, WM_COMMAND, View_SubArgs, 0} 1556 | elsif wParam = VK_F2 then 1557 | m = {hMainWnd, WM_COMMAND, View_Subs, 0} 1558 | elsif wParam = #5A and ctrl and shift then 1559 | m = {hMainWnd, WM_COMMAND, Edit_Redo, 0} 1560 | elsif (wParam = VK_PRIOR or (wParam = VK_TAB and shift)) and ctrl then 1561 | m = {hMainWnd, WM_COMMAND, Select_Prev_Tab, 0} 1562 | elsif (wParam = VK_NEXT or wParam = VK_TAB) and ctrl then 1563 | m = {hMainWnd, WM_COMMAND, Select_Next_Tab, 0} 1564 | elsif wParam = VK_F1 then 1565 | m = {hMainWnd, WM_COMMAND, Help_Context, 0} 1566 | else 1567 | return 1568 | end if 1569 | elsif iMsg = WM_SYSCHAR then 1570 | if wParam >= '1' and wParam <= '9' then 1571 | m = {hMainWnd, WM_COMMAND, wParam - '1' + Select_Tab, 0} 1572 | else 1573 | return 1574 | end if 1575 | else 1576 | return 1577 | end if 1578 | --printf(1, "%x %x %x %x\n", m) 1579 | pack(msg, "pdpp", m) 1580 | end procedure 1581 | 1582 | 1583 | constant AppName = "WeeEditor" 1584 | 1585 | 1586 | global procedure ui_main() 1587 | -- main routine 1588 | atom msg 1589 | integer id 1590 | atom junk, tcitem 1591 | 1592 | init_fonts() 1593 | 1594 | msg = allocate(SIZE_OF_MESSAGE) 1595 | 1596 | id = routine_id("WndProc") 1597 | if id = -1 then 1598 | puts(1, "routine_id failed!\n") 1599 | abort(1) 1600 | end if 1601 | class = RegisterClass({ 1602 | or_bits(CS_HREDRAW, CS_VREDRAW), 1603 | call_back(id), -- get 32-bit address for callback 1604 | 0, 1605 | 0, 1606 | 0, 1607 | c_func(LoadIcon, {NULL, IDI_APPLICATION}), 1608 | c_func(LoadCursor, {NULL, IDC_ARROW}), 1609 | c_func(GetStockObject, {WHITE_BRUSH}), 1610 | NULL, 1611 | AppName, 1612 | c_func(LoadIcon, {NULL, IDI_APPLICATION})}) 1613 | if class = 0 then 1614 | puts(1, "Couldn't register class\n") 1615 | abort(1) 1616 | end if 1617 | 1618 | -- this is required for FindText,ReplaceText common dialogs to work 1619 | WM_FIND = c_func(RegisterWindowMessage,{alloc_string(FINDMSGSTRING)}) 1620 | 1621 | -- menu creation 1622 | -- file menu 1623 | hfilemenu = c_func(CreateMenu, {}) 1624 | junk = c_func(AppendMenu, {hfilemenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1625 | File_New, alloc_string("&New\tCtrl+N")}) 1626 | junk = c_func(AppendMenu, {hfilemenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1627 | File_Open, alloc_string("&Open...\tCtrl+O")}) 1628 | junk = c_func(AppendMenu, {hfilemenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1629 | File_Save, alloc_string("&Save\tCtrl+S")}) 1630 | junk = c_func(AppendMenu, {hfilemenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1631 | File_SaveAs, alloc_string("Save &As...")}) 1632 | junk = c_func(AppendMenu, {hfilemenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1633 | File_Close, alloc_string("&Close\tCtrl+W")}) 1634 | -- junk = c_func(AppendMenu, {hfilemenu, MF_BYPOSITION + MF_SEPARATOR, 0, 0}) 1635 | -- junk = c_func(AppendMenu, {hfilemenu, MF_BYPOSITION + MF_STRING + MF_GRAYED, 1636 | -- File_Print, alloc_string("Print...")}) 1637 | -- junk = c_func(AppendMenu, {hfilemenu, MF_BYPOSITION + MF_STRING + MF_GRAYED, 1638 | -- File_PageSetup, alloc_string("Page Setup...")}) 1639 | junk = c_func(AppendMenu, {hfilemenu, MF_BYPOSITION + MF_SEPARATOR, 0, 0}) 1640 | junk = c_func(AppendMenu, {hfilemenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1641 | File_Exit, alloc_string("E&xit\tAlt+F4")}) 1642 | -- edit menu 1643 | heditmenu = c_func(CreateMenu, {}) 1644 | junk = c_func(AppendMenu, {heditmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1645 | Edit_Undo, alloc_string("U&ndo\tCtrl+Z")}) 1646 | junk = c_func(AppendMenu, {heditmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1647 | Edit_Redo, alloc_string("&Redo\tShift+Ctrl+Z")}) 1648 | junk = c_func(AppendMenu, {heditmenu, MF_BYPOSITION + MF_SEPARATOR, 0, 0}) 1649 | junk = c_func(AppendMenu, {heditmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1650 | Edit_Cut, alloc_string("Cu&t\tCtrl+X")}) 1651 | junk = c_func(AppendMenu, {heditmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1652 | Edit_Copy, alloc_string("&Copy\tCtrl+C")}) 1653 | junk = c_func(AppendMenu, {heditmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1654 | Edit_Paste, alloc_string("&Paste\tCtrl+V")}) 1655 | junk = c_func(AppendMenu, {heditmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1656 | Edit_Clear, alloc_string("Cl&ear\tDel")}) 1657 | junk = c_func(AppendMenu, {heditmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1658 | Edit_SelectAll, alloc_string("Select &All\tCtrl+A")}) 1659 | junk = c_func(AppendMenu, {heditmenu, MF_BYPOSITION + MF_SEPARATOR, 0, 0}) 1660 | junk = c_func(AppendMenu, {heditmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1661 | Edit_ToggleComment, alloc_string("Toggle Co&mment\tCtrl+M")}) 1662 | -- search menu 1663 | hsearchmenu = c_func(CreateMenu, {}) 1664 | junk = c_func(AppendMenu, {hsearchmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1665 | Search_Find, alloc_string("&Find...\tCtrl+F3")}) 1666 | junk = c_func(AppendMenu, {hsearchmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1667 | Search_Find_Next, alloc_string("Find &Next\tF3")}) 1668 | junk = c_func(AppendMenu, {hsearchmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1669 | Search_Find_Prev, alloc_string("Find &Previous\tShift+F3")}) 1670 | junk = c_func(AppendMenu, {hsearchmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1671 | Search_Replace, alloc_string("&Replace...")}) 1672 | -- view menu 1673 | hviewmenu = c_func(CreateMenu, {}) 1674 | junk = c_func(AppendMenu, {hviewmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1675 | View_Subs, alloc_string("&Subroutines...\tF2")}) 1676 | junk = c_func(AppendMenu, {hviewmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1677 | View_Declaration, alloc_string("&Declaration\tCtrl+F2")}) 1678 | junk = c_func(AppendMenu, {hviewmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1679 | View_SubArgs, alloc_string("Subroutine &Arguments...\tShift+F2")}) 1680 | junk = c_func(AppendMenu, {hviewmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1681 | View_Completions, alloc_string("&Completions...\tCtrl+Space")}) 1682 | junk = c_func(AppendMenu, {hviewmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1683 | View_Error, alloc_string("Goto &Error\tF4")}) 1684 | junk = c_func(AppendMenu, {hviewmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1685 | View_GoBack, alloc_string("Go &Back\tEsc")}) 1686 | -- run menu 1687 | hrunmenu = c_func(CreateMenu, {}) 1688 | junk = c_func(AppendMenu, {hrunmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1689 | Run_Start, alloc_string("&Start\tF5")}) 1690 | junk = c_func(AppendMenu, {hrunmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1691 | Run_WithArgs, alloc_string("Start with &Arguments\tShift-F5")}) 1692 | junk = c_func(AppendMenu, {hrunmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1693 | Run_Arguments, alloc_string("Set Arguments...")}) 1694 | junk = c_func(AppendMenu, {hrunmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1695 | Run_Interpreter, alloc_string("Set Interpreter...")}) 1696 | junk = c_func(AppendMenu, {hrunmenu, MF_BYPOSITION + MF_SEPARATOR, 0, 0}) 1697 | junk = c_func(AppendMenu, {hrunmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1698 | Run_Bind, alloc_string("&Bind")}) 1699 | junk = c_func(AppendMenu, {hrunmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1700 | Run_Shroud, alloc_string("S&hroud")}) 1701 | junk = c_func(AppendMenu, {hrunmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1702 | Run_Translate, alloc_string("&Translate and Compile")}) 1703 | -- options menu 1704 | hoptionsmenu = c_func(CreateMenu, {}) 1705 | junk = c_func(AppendMenu, {hoptionsmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1706 | Options_Font, alloc_string("&Font...")}) 1707 | junk = c_func(AppendMenu, {hoptionsmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1708 | Options_LineNumbers, alloc_string("&Line Numbers")}) 1709 | junk = c_func(AppendMenu, {hoptionsmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1710 | Options_SortedSubs, alloc_string("&Sort View Subroutines")}) 1711 | junk = c_func(AppendMenu, {hoptionsmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1712 | Options_Colors, alloc_string("&Colors...")}) 1713 | junk = c_func(AppendMenu, {hoptionsmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1714 | Options_LineWrap, alloc_string("Line &Wrap")}) 1715 | junk = c_func(AppendMenu, {hoptionsmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1716 | Options_ReopenTabs, alloc_string("&Reopen Tabs Next Time")}) 1717 | junk = c_func(AppendMenu, {hoptionsmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1718 | Options_CompleteStatements, alloc_string("Complete Statements")}) 1719 | junk = c_func(AppendMenu, {hoptionsmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1720 | Options_CompleteBraces, alloc_string("Complete Braces")}) 1721 | junk = c_func(AppendMenu, {hoptionsmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1722 | Options_Indent, alloc_string("&Indents...")}) 1723 | junk = c_func(AppendMenu, {hoptionsmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1724 | Options_ErrorIndicators, alloc_string("Error Indicators")}) 1725 | -- help menu 1726 | hhelpmenu = c_func(CreateMenu, {}) 1727 | junk = c_func(AppendMenu, {hhelpmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1728 | Help_About, alloc_string("&About...")}) 1729 | junk = c_func(AppendMenu, {hhelpmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1730 | Help_ReleaseNotes, alloc_string("&Release Notes...")}) 1731 | junk = c_func(AppendMenu, {hhelpmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1732 | Help_Tutorial, alloc_string("&Tutorial")}) 1733 | junk = c_func(AppendMenu, {hhelpmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1734 | Help_Context, alloc_string("&Help\tF1")}) 1735 | -- main menu 1736 | hmenu = c_func(CreateMenu, {}) 1737 | junk = c_func(AppendMenu, {hmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED + MF_POPUP, 1738 | hfilemenu, alloc_string("&File")}) 1739 | junk = c_func(AppendMenu, {hmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED + MF_POPUP, 1740 | heditmenu, alloc_string("&Edit")}) 1741 | junk = c_func(AppendMenu, {hmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED + MF_POPUP, 1742 | hsearchmenu, alloc_string("&Search")}) 1743 | junk = c_func(AppendMenu, {hmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED + MF_POPUP, 1744 | hviewmenu, alloc_string("&View")}) 1745 | junk = c_func(AppendMenu, {hmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED + MF_POPUP, 1746 | hrunmenu, alloc_string("&Run")}) 1747 | junk = c_func(AppendMenu, {hmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED + MF_POPUP, 1748 | hoptionsmenu, alloc_string("&Options")}) 1749 | junk = c_func(AppendMenu, {hmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED + MF_POPUP, 1750 | hhelpmenu, alloc_string("&Help")}) 1751 | 1752 | -- tab popup menu 1753 | htabmenu = c_func(CreatePopupMenu) 1754 | junk = c_func(AppendMenu, {htabmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1755 | File_Save, alloc_string("Save")}) 1756 | junk = c_func(AppendMenu, {htabmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1757 | File_SaveAs, alloc_string("Save As")}) 1758 | junk = c_func(AppendMenu, {htabmenu, MF_BYPOSITION + MF_STRING + MF_ENABLED, 1759 | File_Close, alloc_string("Close")}) 1760 | 1761 | free_strings() -- garbage collect menu strings 1762 | 1763 | load_wee_conf(wee_conf_filename) 1764 | 1765 | -- set the recent items on the file menu 1766 | ui_refresh_file_menu(recent_files) 1767 | 1768 | -- set the checkmark on the Line Numbers menu item 1769 | c_func(CheckMenuItem, {hoptionsmenu, Options_LineNumbers, MF_CHECKED*line_numbers}) 1770 | c_func(CheckMenuItem, {hoptionsmenu, Options_SortedSubs, MF_CHECKED*sorted_subs}) 1771 | c_func(CheckMenuItem, {hoptionsmenu, Options_LineWrap, MF_CHECKED*line_wrap}) 1772 | c_func(CheckMenuItem, {hoptionsmenu, Options_ReopenTabs, MF_CHECKED*reopen_tabs}) 1773 | c_func(CheckMenuItem, {hoptionsmenu, Options_CompleteStatements, MF_CHECKED*complete_statements}) 1774 | c_func(CheckMenuItem, {hoptionsmenu, Options_CompleteBraces, MF_CHECKED*complete_braces}) 1775 | c_func(CheckMenuItem, {hoptionsmenu, Options_ErrorIndicators, MF_CHECKED*auto_indicator}) 1776 | 1777 | -- window creation 1778 | hMainWnd = CreateWindow({ 1779 | 0, -- extended style 1780 | AppName, -- window class name 1781 | "", -- window caption 1782 | WS_OVERLAPPEDWINDOW, -- window style 1783 | x_pos, -- initial x position 1784 | y_pos, -- initial y position 1785 | x_size, -- initial x size 1786 | y_size, -- initial y size 1787 | NULL, -- parent window handle 1788 | hmenu, -- window menu handle 1789 | 0 , --hInstance // program instance handle 1790 | NULL}) -- creation parameters 1791 | 1792 | junk = c_func(LoadLibrary, {alloc_string("RICHED32.DLL")}) --needed for richedit 1793 | 1794 | hstatus = CreateWindow({0, "STATIC", "static", 1795 | {WS_CHILD,WS_VISIBLE,SS_RIGHT}, 1796 | 0,0,0,0, -- set by resize 1797 | hMainWnd, 1798 | NULL, 1799 | 0, 1800 | NULL}) 1801 | junk = c_func(SendMessage, {hstatus, WM_SETFONT, statusFont, 0}) 1802 | 1803 | htabs = CreateWindow({0,"SysTabControl32", "tabs", 1804 | {WS_CHILD,WS_VISIBLE,TCS_FOCUSNEVER}, 1805 | 0,0,200,20, -- set by resize 1806 | hMainWnd, 1807 | NULL, 1808 | 0, 1809 | NULL}) 1810 | junk = c_func(SendMessage, {htabs, WM_SETFONT, statusFont, 0}) 1811 | 1812 | htooltip = CreateWindow({0, "tooltips_class32", 0, 1813 | {WS_POPUP,TTS_ALWAYSTIP}, 1814 | CW_USEDEFAULT, CW_USEDEFAULT, 1815 | CW_USEDEFAULT, CW_USEDEFAULT, 1816 | hMainWnd, NULL, 1817 | 0, NULL}) 1818 | 1819 | --printf(1, "hMainWnd=%x hstatus=%x htabs=%x\n", {hMainWnd, hstatus, htabs}) 1820 | if hMainWnd = 0 or hstatus = 0 or htabs = 0 or htooltip = 0 then 1821 | puts(1, "Couldn't CreateWindow\n") 1822 | abort(1) 1823 | end if 1824 | 1825 | c_func(SendMessage, {hMainWnd, WM_SETICON, ICON_BIG, wee_icon}) 1826 | c_func(SendMessage, {hMainWnd, WM_SETICON, ICON_SMALL, wee_icon}) 1827 | 1828 | -- attach tooltip to tab control 1829 | junk = allocate_pack("zdppddddps", { -- TOOLINFO 1830 | TTF_IDISHWND + TTF_SUBCLASS, -- uFlags 1831 | hMainWnd, -- hwnd 1832 | htabs, -- uId 1833 | 0,0,0,0, -- rect 1834 | 0, -- hinst 1835 | LPSTR_TEXTCALLBACK -- lpszText 1836 | }) 1837 | c_func(SendMessage, {htooltip, TTM_ADDTOOL, 0, junk}) 1838 | free(junk) 1839 | 1840 | -- open files from last time and on command line 1841 | open_tabs() 1842 | 1843 | --if SetThemeAppProperties != -1 then 1844 | -- c_proc(SetThemeAppProperties, {STAP_ALLOW_NONCLIENT+STAP_ALLOW_CONTROLS}) 1845 | -- junk = c_func(SendMessage, {hMainWnd, WM_THEMECHANGED, 0, 0}) 1846 | --end if 1847 | 1848 | c_proc(ShowWindow, {hMainWnd, SW_SHOWNORMAL}) 1849 | c_proc(UpdateWindow, {hMainWnd}) 1850 | c_proc(DragAcceptFiles, {hMainWnd, 1}) 1851 | 1852 | while c_func(GetMessage, {msg, NULL, 0, 0}) do 1853 | if hFindDlg and c_func(IsDialogMessage,{hFindDlg,msg}) then 1854 | -- this message is handled by find dialog (thanks Jacques) 1855 | -- it makes the tab key work for find/replace dialogs 1856 | elsif hDlg and c_func(IsDialogMessage,{hDlg,msg}) then 1857 | -- ditto 1858 | ? hDlg 1859 | else 1860 | translate_editor_keys(msg) 1861 | junk = c_func(TranslateMessage, {msg}) 1862 | junk = c_func(DispatchMessage, {msg}) 1863 | end if 1864 | end while 1865 | 1866 | end procedure 1867 | 1868 | wee_init() 1869 | ui_main() 1870 | -------------------------------------------------------------------------------- /updater.ex: -------------------------------------------------------------------------------- 1 | -- WEE source code updater 2 | 3 | include std/console.e 4 | --include std/net/http.e -- doesn't support https 5 | include std/io.e 6 | include std/get.e 7 | include std/filesys.e 8 | include std/hash.e 9 | include std/dll.e 10 | include std/machine.e 11 | 12 | ifdef WINDOWS then 13 | 14 | -- 15 | -- Implement http_get via WinINet for Windows 16 | -- 17 | 18 | constant 19 | wininet = open_dll("wininet.dll") 20 | if wininet = 0 then 21 | puts(1, "Failed to open wininet.dll\n") 22 | abort(1) 23 | end if 24 | 25 | constant 26 | InternetOpen = define_c_func(wininet, "InternetOpenA", {C_POINTER, C_DWORD, C_POINTER, C_POINTER, C_DWORD}, C_HANDLE), 27 | InternetCloseHandle = define_c_func(wininet, "InternetCloseHandle", {C_HANDLE}, C_BOOL), 28 | InternetOpenUrl = define_c_func(wininet, "InternetOpenUrlA", {C_HANDLE, C_POINTER, C_POINTER, C_DWORD, C_DWORD, C_POINTER}, C_HANDLE), 29 | InternetReadFile = define_c_func(wininet, "InternetReadFile", {C_HANDLE, C_POINTER, C_DWORD, C_POINTER}, C_BOOL) 30 | if InternetOpen = -1 or 31 | InternetCloseHandle = -1 or 32 | InternetOpenUrl = -1 or 33 | InternetReadFile = -1 then 34 | puts(1, "Failed to find functions in wininet\n") 35 | abort(1) 36 | end if 37 | 38 | constant 39 | INTERNET_OPEN_TYPE_PRECONFIG = 0 40 | 41 | function http_get(sequence url) 42 | atom agent_ptr = allocate_string("Mozilla/4.0 (compatible)") 43 | atom url_ptr = allocate_string(url) 44 | atom ih, ch -- internet handle, connection handle 45 | integer bufsize = 4096 46 | atom buf_ptr = allocate(bufsize) 47 | atom bytesread_ptr = allocate(4) -- LPDWORD 48 | object res = -1 49 | 50 | ih = c_func(InternetOpen, {agent_ptr, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0}) 51 | if ih then 52 | ch = c_func(InternetOpenUrl, {ih, url_ptr, NULL, 0, 0, NULL}) 53 | if ch then 54 | res = "" 55 | while c_func(InternetReadFile, {ch, buf_ptr, bufsize, bytesread_ptr}) != 1 or 56 | peek4u(bytesread_ptr) != 0 do 57 | res &= peek({buf_ptr, peek4u(bytesread_ptr)}) 58 | end while 59 | res = {{{"Status","200"}}, res} 60 | 61 | c_func(InternetCloseHandle, {ih}) 62 | end if 63 | c_func(InternetCloseHandle, {ih}) 64 | end if 65 | 66 | free(agent_ptr) 67 | free(url_ptr) 68 | free(buf_ptr) 69 | free(bytesread_ptr) 70 | 71 | return res 72 | end function 73 | 74 | elsedef 75 | 76 | -- 77 | -- Implement http_get via libcurl for UNIX 78 | -- 79 | 80 | integer 81 | libcurl = open_dll("libcurl.so") 82 | if libcurl = 0 then 83 | libcurl = open_dll("libcurl.so.3") 84 | end if 85 | if libcurl = 0 then 86 | libcurl = open_dll("libcurl.so.4") 87 | end if 88 | if libcurl = 0 then 89 | puts(1, "Failed to open libcurl.so\n") 90 | abort(1) 91 | end if 92 | 93 | constant 94 | curl_easy_init = define_c_func(libcurl, "curl_easy_init", {}, C_POINTER), 95 | curl_easy_setopt = define_c_proc(libcurl, "curl_easy_setopt", {C_POINTER, C_LONG, C_POINTER}), 96 | curl_easy_perform = define_c_func(libcurl, "curl_easy_perform", {C_POINTER}, C_LONG), 97 | curl_easy_cleanup = define_c_proc(libcurl, "curl_easy_cleanup", {C_POINTER}) 98 | if curl_easy_init = -1 or 99 | curl_easy_setopt = -1 or 100 | curl_easy_perform = -1 or 101 | curl_easy_cleanup = -1 then 102 | puts(1, "Failed to find functions in libcurl\n") 103 | abort(1) 104 | end if 105 | 106 | sequence cb_data 107 | 108 | function curl_callback(atom ptr, atom size, atom nmemb, atom writedata) 109 | cb_data &= peek({ptr, size * nmemb}) 110 | return nmemb 111 | end function 112 | 113 | constant curl_cb = call_back(routine_id("curl_callback")) 114 | 115 | atom curl = c_func(curl_easy_init, {}) 116 | if not curl then 117 | puts(1, "Failed to init libcurl\n") 118 | abort(1) 119 | end if 120 | 121 | constant 122 | CURLOPT_URL = 10002, 123 | CURLOPT_WRITEFUNCTION = 20011, 124 | CURLOPT_WRITEDATA = 10001, 125 | CURLOPT_FOLLOWLOCATION = 52 126 | 127 | c_proc(curl_easy_setopt, {curl, CURLOPT_WRITEFUNCTION, curl_cb}) 128 | c_proc(curl_easy_setopt, {curl, CURLOPT_WRITEDATA, 0}) 129 | c_proc(curl_easy_setopt, {curl, CURLOPT_FOLLOWLOCATION, 1}) 130 | 131 | function http_get(sequence url) 132 | atom url_ptr = allocate_string(url) 133 | atom res 134 | 135 | if not url_ptr then 136 | return -1 137 | end if 138 | 139 | cb_data = "" 140 | c_proc(curl_easy_setopt, {curl, CURLOPT_URL, url_ptr}) 141 | res = c_func(curl_easy_perform, {curl}) 142 | free(url_ptr) 143 | if res = 0 then 144 | return {{{"Status","200"}}, cb_data} 145 | end if 146 | return -1 147 | end function 148 | 149 | end ifdef 150 | 151 | 152 | 153 | 154 | 155 | 156 | puts(1, "=== WEE Source Code Updater ===\n"& 157 | "This will overwrite any local changes to the source files.\n"& 158 | "Press a key to continue, or 'q' to quit.\n") 159 | if wait_key() = 'q' then 160 | abort(0) 161 | end if 162 | 163 | puts(1, "Downloading manifest.json...\n") 164 | constant 165 | repo = "peberlein/WEE/", 166 | base_url = "https://raw.githubusercontent.com/" & repo, -- & "commit/filename" 167 | manifest = http_get(base_url & "master/manifest.json") 168 | 169 | procedure fail(sequence fmt, object args={}) 170 | printf(1, fmt, args) 171 | puts(1, "\nPress any key to exit, then try updating again.\n") 172 | wait_key() 173 | abort(1) 174 | end procedure 175 | 176 | if atom(manifest) or not equal(manifest[1][1][2], "200") then 177 | display(manifest) 178 | fail("Failed to download manifest.json\n") 179 | end if 180 | 181 | -- manifest format 182 | -- { 183 | -- {"pathname", hash, "commit-tag", platform-bits, platforms...} 184 | -- } 185 | 186 | sequence files, name, commit_tag 187 | files = value(manifest[2]) 188 | --display(files) 189 | if files[1] != 0 then 190 | fail("Failed to parse manifest\n") 191 | end if 192 | files = files[2] 193 | 194 | ifdef BITS64 then 195 | constant PLATFORM_BITS = 64 196 | elsedef 197 | constant PLATFORM_BITS = 32 198 | end ifdef 199 | 200 | integer platform_bits 201 | sequence platforms, subdir 202 | 203 | object result, hashcode 204 | 205 | for i = 1 to length(files) do 206 | if length(files[i]) < 4 then 207 | fail("Manifest file has invalid format.\n") 208 | end if 209 | 210 | name = files[i][1] 211 | hashcode = files[i][2] 212 | commit_tag = files[i][3] 213 | platform_bits = files[i][4] 214 | platforms = files[i][5..$] 215 | 216 | if length(platforms) and not find(platform(), platforms) then 217 | -- file not used on this platform 218 | 219 | elsif platform_bits != 0 and platform_bits != PLATFORM_BITS then 220 | -- file not compatible with 32/64-bit platform 221 | 222 | elsif equal(hashcode, hash(read_file(name), HSIEH30)) then 223 | -- file hash is ok 224 | printf(1, "%s is up-to-date.\n", {name}) 225 | 226 | else 227 | printf(1, "Updating %s...\n", {name}) 228 | result = http_get(base_url & commit_tag & "/" & name) 229 | if atom(result) or not equal(result[1][1][2], "200") then 230 | display(result) 231 | fail("Failed to download %s\n", {name}) 232 | elsif not equal(hashcode, hash(result[2], HSIEH30)) then 233 | fail("Failed to validate %s\n", {name}) 234 | else 235 | subdir = dirname(name) 236 | if length(subdir) and atom(dir(subdir)) then 237 | printf(1, "Creating directory %s\n", {subdir}) 238 | create_directory(subdir) 239 | end if 240 | if write_file(name, result[2]) = -1 then 241 | printf(1, "Failed to write_file %s\n", {name}) 242 | end if 243 | end if 244 | end if 245 | end for 246 | 247 | puts(1, "Done. Press any key to exit.\n") 248 | wait_key() 249 | 250 | 251 | ifdef UNIX then 252 | c_proc(curl_easy_cleanup, {curl}) 253 | end ifdef 254 | -------------------------------------------------------------------------------- /wee.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peberlein/WEE/1744f655e3097da221fb8302f84c96a24ca477e1/wee.ico -------------------------------------------------------------------------------- /weeicon.e: -------------------------------------------------------------------------------- 1 | -- wee icons in XPM format 2 | 3 | export constant wee_xpm = { 4 | "32 32 60 1", 5 | " c None", 6 | ". c #FF6600", 7 | "+ c #FFFFFF", 8 | "@ c #FED8BF", 9 | "# c #FED3B6", 10 | "$ c #FEEADD", 11 | "% c #FED3B7", 12 | "& c #FE6601", 13 | "* c #FEA56B", 14 | "= c #FEE5D5", 15 | "- c #FEF9F6", 16 | "; c #FEEADE", 17 | "> c #FEA76D", 18 | ", c #FE8738", 19 | "' c #FEE9DC", 20 | ") c #FE6C0C", 21 | "! c #FEFAF8", 22 | "~ c #FE7A23", 23 | "{ c #FE6B0A", 24 | "] c #FEF5F0", 25 | "^ c #FE7114", 26 | "/ c #FEA469", 27 | "( c #FE6B09", 28 | "_ c #FE9651", 29 | ": c #FEE7D8", 30 | "< c #FE8230", 31 | "[ c #FE9854", 32 | "} c #FEA468", 33 | "| c #FE9B5A", 34 | "1 c #FED7BD", 35 | "2 c #FEE6D6", 36 | "3 c #FED9C0", 37 | "4 c #FEAE7A", 38 | "5 c #FEB584", 39 | "6 c #FEC7A3", 40 | "7 c #FECFB0", 41 | "8 c #FECEAE", 42 | "9 c #FED1B3", 43 | "0 c #FEA56A", 44 | "a c #FEF8F5", 45 | "b c #FEF2EB", 46 | "c c #FE771D", 47 | "d c #FEFDFD", 48 | "e c #FEE8DA", 49 | "f c #FEF3EC", 50 | "g c #FE7820", 51 | "h c #FEF6F1", 52 | "i c #FEF9F7", 53 | "j c #FE7419", 54 | "k c #FE6D0D", 55 | "l c #FEDEC9", 56 | "m c #FECBA9", 57 | "n c #FEDAC3", 58 | "o c #FEA870", 59 | "p c #FEB787", 60 | "q c #FEDAC2", 61 | "r c #FE9E5E", 62 | "s c #FEE4D4", 63 | "t c #FEF2EA", 64 | "u c #FE7418", 65 | " ......... ", 66 | " .............. ", 67 | " .................. ", 68 | " .................... ", 69 | " ...................... ", 70 | " ........................ ", 71 | " .......................... ", 72 | " ............................ ", 73 | " ............................ ", 74 | " .............................. ", 75 | " .............................. ", 76 | "............................... ", 77 | "................................", 78 | "...+++@.#$.%++&*=-;>..&*=-;>....", 79 | "...,+'.)!+~{]^>+/(>+_.>+/(>+_...", 80 | "....:+<[++}|1.2+(.{+3.2+(.{+3...", 81 | "....4+567+890.a+++++b.a+++++b...", 82 | "....cdefghhij.2+k.....2+k.......", 83 | ".....1+l.m+n..o+pk)>q.o+pk)>q...", 84 | ".....r+4.|+o..&>s-tmu.&>s-tmu...", 85 | " .............................. ", 86 | " .............................. ", 87 | " .............................. ", 88 | " ............................ ", 89 | " ............................ ", 90 | " .......................... ", 91 | " ........................ ", 92 | " ...................... ", 93 | " .................... ", 94 | " .................. ", 95 | " .............. ", 96 | " ........ "} 97 | 98 | export constant 99 | a_xpm = `/* XPM */ 100 | "16 16 28 1", 101 | " c None", 102 | ". c #3300CC", 103 | "+ c #FFFFFF", 104 | "@ c #FBFBFD", 105 | "# c #E6E1F8", 106 | "$ c #AD99EA", 107 | "% c #4011CE", 108 | "& c #7553DB", 109 | "* c #3807CC", 110 | "= c #8061DE", 111 | "- c #B3A1EB", 112 | "; c #3503CC", 113 | "> c #EBE7F9", 114 | ", c #4A1DD1", 115 | "' c #B9A8ED", 116 | ") c #FDFDFD", 117 | "! c #CBBEF1", 118 | "~ c #947AE3", 119 | "{ c #3A0ACD", 120 | "] c #F6F4FC", 121 | "^ c #3A09CD", 122 | "/ c #DAD2F5", 123 | "( c #7958DD", 124 | "_ c #3908CC", 125 | ": c #8E72E2", 126 | "< c #5F38D6", 127 | "[ c #DAD1F5", 128 | "} c #8162DF", 129 | " ...... ", 130 | " .......... ", 131 | " ............ ", 132 | " .............. ", 133 | " ....++@#$%.... ", 134 | ".....+&*=+-.....", 135 | "........;+>.....", 136 | "....,'>)+++.....", 137 | "....!+~{.++.....", 138 | "....]+^.;++.....", 139 | "..../+(_:++.....", 140 | " ...<[]/}+++... ", 141 | " .............. ", 142 | " ............ ", 143 | " .......... ", 144 | " ...... "};`, 145 | c_xpm = `/* XPM */ 146 | static char * c_xpm[] = { 147 | "16 16 33 1", 148 | " c None", 149 | ". c #3399CC", 150 | "+ c #6EB6DA", 151 | "@ c #D1E7F3", 152 | "# c #F7FAFC", 153 | "$ c #F2F8FB", 154 | "% c #C3E0EF", 155 | "& c #6AB4D9", 156 | "* c #FDFDFD", 157 | "= c #BFDFEE", 158 | "- c #46A2D0", 159 | "; c #42A0CF", 160 | "> c #BBDDED", 161 | ", c #FFFFFF", 162 | "' c #D0E7F2", 163 | ") c #55A9D3", 164 | "! c #4AA4D1", 165 | "~ c #F6FAFC", 166 | "{ c #3A9CCD", 167 | "] c #D2E8F3", 168 | "^ c #56AAD4", 169 | "/ c #4BA4D1", 170 | "( c #E1EFF6", 171 | "_ c #72B8DB", 172 | ": c #C1DFEF", 173 | "< c #43A0CF", 174 | "[ c #93C8E3", 175 | "} c #73B8DB", 176 | "| c #D4E9F3", 177 | "1 c #F8FBFC", 178 | "2 c #EBF4F9", 179 | "3 c #A4D1E8", 180 | "4 c #3599CC", 181 | " ...... ", 182 | " .......... ", 183 | " ............ ", 184 | " .............. ", 185 | " ....+@#$%&.... ", 186 | "....+*=-;>,.....", 187 | "....',)..!,.....", 188 | "....~,{.........", 189 | "....~,{.........", 190 | "....],^../(.....", 191 | "...._,:-<=[.....", 192 | " ....}|1234.... ", 193 | " .............. ", 194 | " ............ ", 195 | " .......... ", 196 | " ...... "};`, 197 | e_xpm = `/* XPM */ 198 | static char * e_xpm[] = { 199 | "16 16 37 1", 200 | " c None", 201 | ". c #CC0099", 202 | "+ c #D844B3", 203 | "@ c #F1C0E5", 204 | "# c #FBF3F9", 205 | "$ c #FCF6FA", 206 | "% c #F3C8E8", 207 | "& c #DA4EB7", 208 | "* c #D945B4", 209 | "= c #FDFCFD", 210 | "- c #E684CD", 211 | "; c #CE0E9E", 212 | "> c #CE0F9E", 213 | ", c #E688CF", 214 | "' c #FDFDFD", 215 | ") c #D73BB0", 216 | "! c #F2C3E6", 217 | "~ c #FFFFFF", 218 | "{ c #CD0C9D", 219 | "] c #F0B8E2", 220 | "^ c #FCF5FA", 221 | "/ c #F9E9F5", 222 | "( c #CD0B9C", 223 | "_ c #F2C5E7", 224 | ": c #D637AE", 225 | "< c #D42DAA", 226 | "[ c #F5D2EC", 227 | "} c #DA4AB6", 228 | "| c #F3C7E8", 229 | "1 c #D32BA9", 230 | "2 c #CC089B", 231 | "3 c #D534AD", 232 | "4 c #F4D0EB", 233 | "5 c #DE5EBE", 234 | "6 c #D948B5", 235 | "7 c #F4CFEB", 236 | "8 c #DE60BF", 237 | " ...... ", 238 | " .......... ", 239 | " ............ ", 240 | " .............. ", 241 | " ....+@#$%&.... ", 242 | "....*=-;>,')....", 243 | "....!~{..;~]....", 244 | "....^~~~~~~/....", 245 | "....^~(.........", 246 | "...._~:...<[....", 247 | "....}'|12345....", 248 | " ....6@##78.... ", 249 | " .............. ", 250 | " ............ ", 251 | " .......... ", 252 | " ...... "};`, 253 | f_xpm = `/* XPM */ 254 | static char * f_xpm[] = { 255 | "16 16 11 1", 256 | " c None", 257 | ". c #0044FF", 258 | "+ c #2A62FE", 259 | "@ c #BDCEFE", 260 | "# c #F2F5FE", 261 | "$ c #FFFFFF", 262 | "% c #CBD8FE", 263 | "& c #3A6EFE", 264 | "* c #366BFE", 265 | "= c #FAFBFE", 266 | "- c #0044FE", 267 | " ...... ", 268 | " .......... ", 269 | " ............ ", 270 | " .....+@#$$.... ", 271 | " .....%$&*$.... ", 272 | "......=$-.......", 273 | ".....$$$$$......", 274 | "......$$........", 275 | "......$$........", 276 | "......$$........", 277 | "......$$........", 278 | " .....$$....... ", 279 | " .....$$....... ", 280 | " ...$$$$..... ", 281 | " .......... ", 282 | " ...... "};`, 283 | i_xpm = `/* XPM */ 284 | static char * i_xpm[] = { 285 | "16 16 6 1", 286 | " c None", 287 | ". c #CC0033", 288 | "+ c #F2C4CF", 289 | "@ c #F2C3CF", 290 | "# c #F3C6D1", 291 | "$ c #FFFFFF", 292 | " ...... ", 293 | " .......... ", 294 | " .....+@..... ", 295 | " ......#+...... ", 296 | " .............. ", 297 | "......$$$.......", 298 | ".......$$.......", 299 | ".......$$.......", 300 | ".......$$.......", 301 | ".......$$.......", 302 | ".......$$.......", 303 | " ......$$...... ", 304 | " .....$$$$..... ", 305 | " ............ ", 306 | " .......... ", 307 | " ...... "};`, 308 | n_xpm = `/* XPM */ 309 | static char * n_xpm[] = { 310 | "16 16 13 1", 311 | " c None", 312 | ". c #CCCCCC", 313 | "+ c #C9C9C9", 314 | "@ c #CBCBCB", 315 | "# c #CACACA", 316 | "$ c #E9E9E9", 317 | "% c #FFFFFF", 318 | "& c #E4E4E4", 319 | "* c #EEEEEE", 320 | "= c #DFDFDF", 321 | "- c #CDCDCD", 322 | "; c #FEFEFE", 323 | "> c #D7D7D7", 324 | " ...... ", 325 | " .......... ", 326 | " ............ ", 327 | " .............. ", 328 | " ...+++@++..... ", 329 | "...#$%%&*%=.....", 330 | "....+%%-+%;+....", 331 | "....+%%++%%+....", 332 | "....+%%++%%+....", 333 | "....+%%++%%+....", 334 | "...#$%%$>%%$....", 335 | " ...++++@+++... ", 336 | " .............. ", 337 | " ............ ", 338 | " .......... ", 339 | " ...... "}; 340 | `, 341 | o_xpm = `/* XPM */ 342 | static char * o_xpm[] = { 343 | "16 16 20 1", 344 | " c None", 345 | ". c #00CC99", 346 | "+ c #45D9B4", 347 | "@ c #C2F2E6", 348 | "# c #F5FCFA", 349 | "$ c #FCFDFD", 350 | "% c #A8EDDB", 351 | "& c #16CFA1", 352 | "* c #14CFA0", 353 | "= c #A3ECD9", 354 | "- c #C3F2E6", 355 | "; c #FFFFFF", 356 | "> c #23D2A6", 357 | ", c #22D2A6", 358 | "' c #04CC9A", 359 | ") c #03CC99", 360 | "! c #A6ECDB", 361 | "~ c #15CFA0", 362 | "{ c #A5ECDA", 363 | "] c #44D8B3", 364 | " ...... ", 365 | " .......... ", 366 | " ............ ", 367 | " .............. ", 368 | " ....+@##@+.... ", 369 | "....+$%&*=$+....", 370 | "....-;>..,;@....", 371 | "....#;'..);#....", 372 | "....#;)..';#....", 373 | "....@;>..>;@....", 374 | "....+$!~*{$]....", 375 | " ....+-##-+.... ", 376 | " .............. ", 377 | " ............ ", 378 | " .......... ", 379 | " ...... "};`, 380 | p_xpm = `/* XPM */ 381 | static char * p_xpm[] = { 382 | "16 16 25 1", 383 | " c None", 384 | ". c #FF6600", 385 | "+ c #FFFFFF", 386 | "@ c #FEA66C", 387 | "# c #FEEDE3", 388 | "$ c #FEFAF8", 389 | "% c #FEE3D1", 390 | "& c #FE9854", 391 | "* c #FECAA8", 392 | "= c #FE7216", 393 | "- c #FE7215", 394 | "; c #FE8D42", 395 | "> c #FE7A22", 396 | ", c #FE7B24", 397 | "' c #FED8BF", 398 | ") c #FE6703", 399 | "! c #FE6804", 400 | "~ c #FEF3EC", 401 | "{ c #FEC9A6", 402 | "] c #FECAA7", 403 | "^ c #FE8E43", 404 | "/ c #FEEEE4", 405 | "( c #FEFBF9", 406 | "_ c #FEE3D2", 407 | ": c #FE9A57", 408 | " ...... ", 409 | " .......... ", 410 | " ............ ", 411 | " ...+++@#$%&... ", 412 | " ....++*=-*+;.. ", 413 | ".....++>..,+'...", 414 | ".....++)..!+~...", 415 | ".....++)..!+~...", 416 | ".....++>..,+'...", 417 | ".....++{--]+^...", 418 | ".....++@/(_:....", 419 | " ....++........ ", 420 | " ....++........ ", 421 | " ..++++...... ", 422 | " .......... ", 423 | " ...... "};`, 424 | s_xpm = `/* XPM */ 425 | static char * s_xpm[] = { 426 | "16 16 34 1", 427 | " c None", 428 | ". c #33CC00", 429 | "+ c #4BD11F", 430 | "@ c #B6ECA4", 431 | "# c #E8F8E3", 432 | "$ c #FAFDF9", 433 | "% c #FFFFFF", 434 | "& c #D2F3C7", 435 | "* c #7BDD5B", 436 | "= c #38CC07", 437 | "- c #4AD11D", 438 | "; c #C0EEB1", 439 | "> c #F7FCF6", 440 | ", c #6AD945", 441 | "' c #35CC03", 442 | ") c #CAF1BD", 443 | "! c #F9FCF8", 444 | "~ c #E0F6D9", 445 | "{ c #A4E78D", 446 | "] c #41CE12", 447 | "^ c #44CF16", 448 | "/ c #EBF9E7", 449 | "( c #CBF1BE", 450 | "_ c #4ED222", 451 | ": c #3DCD0D", 452 | "< c #77DC55", 453 | "[ c #F6FCF4", 454 | "} c #C8F0BB", 455 | "| c #37CC06", 456 | "1 c #78DC57", 457 | "2 c #D3F3C9", 458 | "3 c #FCFDFC", 459 | "4 c #ECF9E8", 460 | "5 c #BCEDAC", 461 | " ...... ", 462 | " .......... ", 463 | " ............ ", 464 | " .............. ", 465 | " ....+@#$%%%... ", 466 | ".....&%*=-;%....", 467 | ".....>%,'.-%....", 468 | ".....)%%!~{]....", 469 | ".....^@/%%%(....", 470 | ".....%_.:<%[....", 471 | ".....%}_|1%2....", 472 | " ....%%%345+... ", 473 | " .............. ", 474 | " ............ ", 475 | " .......... ", 476 | " ...... "};`, 477 | t_xpm = `/* XPM */ 478 | static char * t_xpm[] = { 479 | "16 16 11 1", 480 | " c None", 481 | ". c #CC9900", 482 | "+ c #FFFFFF", 483 | "@ c #F9F4E6", 484 | "# c #D2A622", 485 | "$ c #D5AD34", 486 | "% c #DEBF60", 487 | "& c #F8F2E1", 488 | "* c #FDFCF9", 489 | "= c #F8F3E3", 490 | "- c #DEBE5E", 491 | " ...... ", 492 | " .......... ", 493 | " ............ ", 494 | " .....++....... ", 495 | " .....++....... ", 496 | ".....+++++......", 497 | "......++........", 498 | "......++........", 499 | "......++........", 500 | "......++........", 501 | "......++........", 502 | " .....@+#$@.... ", 503 | " .....%&*=-.... ", 504 | " ............ ", 505 | " .......... ", 506 | " ...... "};` 507 | 508 | --------------------------------------------------------------------------------