Top Level Namespace
- Includes:
- ParseDate
Defined Under Namespace
Modules: DemoBasic, DemoDialog, DemoDnD, DemoManager, DemoSelect, DemoTree, DemoVar, MultiTkIp_PseudoToplevel_Evaluable, TclTk, Tk, TkBgError, TkBindCore, TkCanvasItemConfig, TkClipboard, TkComm, TkComposite, TkConfigMethod, TkConsole, TkCore, TkEvent, TkGrid, TkItemConfigMethod, TkItemConfigOptkeys, TkItemFontOptkeys, TkKinput, TkListItemConfig, TkManageFocus, TkMenuEntryConfig, TkMenuSpec, TkOptionDB, TkPack, TkPackage, TkPalette, TkPlace, TkSelection, TkTextTagConfig, TkTreatFont, TkTreatItemFont, TkTreatTagFont, TkUtil, TkValidation, TkWinfo, TkXIM, TkcTagAccess Classes: AnimatedImageLabel, AnimatedTextLabel, AnimatedWaveDemo, BLT_Calendar_sample, BLT_Graph_Demo, BWidget_Demo, BtnFrame, Button_clone, Button_with_Frame, Clock, Hash, Knights_Tour, Mail, MultiTkIp, MultiTkIp_OK, Object, Othello, PendulumAnimationDemo, PhotoCanvas, RemoteTkIp, ScrListbox, Spinner_demo, TclTkCallback, TclTkCommand, TclTkImage, TclTkInterpreter, TclTkIp, TclTkLib, TclTkLibCommand, TclTkObject, TclTkVariable, TclTkWidget, Test1, TkBindTag, TkBindTagAll, TkBitmapImage, TkCallbackBreak, TkCallbackContinue, TkCallbackEntry, TkCallbackRedo, TkCallbackRetry, TkCallbackReturn, TkCallbackThrow, TkDatabaseClass, TkDialog, TkDialogObj, TkDialog_Demo1, TkDialog_Demo2, TkFont, TkGoldberg_Demo, TkHTML_File_Viewer, TkImage, TkImg_demo, TkKernel, TkLocalJumpError, TkMenubar, TkMsgCatalog, TkMultiColumnList, TkMultiListFrame, TkMultiListbox, TkNamedFont, TkNamespace, TkObject, TkPhotoImage, TkPixmapImage, TkRTTimer, TkScrollbox, TkScrolledCanvas, TkTextFrame, TkTextIO, TkTextImage, TkTextMark, TkTextMarkAnchor, TkTextMarkCurrent, TkTextMarkInsert, TkTextNamedMark, TkTextNamedTag, TkTextTag, TkTextTagSel, TkTextWin, TkTextWindow, TkTimer, TkTree, TkTreeCtrl_demo, TkValidateCommand, TkVarAccess, TkVariable, TkVirtualEvent, TkWarning, TkWarningObj, TkWindow, TkcArc, TkcBitmap, TkcGroup, TkcImage, TkcItem, TkcLine, TkcOval, TkcPolygon, TkcRectangle, TkcTag, TkcTagAll, TkcTagCurrent, TkcTagString, TkcText, TkcWindow, Unicodeout_SampleFrame, ViewIcons
Constant Summary collapse
- TkLib_Config =
{}
- TclConfig_Info =
{}
- TkConfig_Info =
{}
- TopLevel =
TkToplevel
- Frame =
TkFrame
- Label =
TkLabel
- Button =
TkButton
TkRadioButton
TkCheckButton
- Message =
TkMessage
- Entry =
TkEntry
- Spinbox =
TkSpinbox
- Text =
TkText
- Scale =
TkScale
- Scrollbar =
TkScrollbar
- Listbox =
TkListbox
- Menu =
TkMenu
TkMenubutton
- Canvas =
TkCanvas
- Arc =
TkcArc
- Bitmap =
TkcBitmap
- Line =
TkcLine
- Oval =
TkcOval
- Polygon =
TkcPolygon
- Rectangle =
TkcRectangle
- TextItem =
TkcText
- WindowItem =
TkcWindow
- BitmapImage =
TkBitmapImage
- PhotoImage =
TkPhotoImage
- Selection =
TkSelection
- Winfo =
TkWinfo
- Pack =
TkPack
- Grid =
TkGrid
- Place =
TkPlace
- Variable =
TkVariable
- Font =
TkFont
- VirtualEvent =
TkVirtualEvent
- TkSystemMenu =
Tk::SystemMenu
- TkRoot =
Tk::Root
- TkAfter =
TkTimer
- TkMsgCat =
TkMsgCatalog
- TkDialog2 =
TkDialogObj
- TkWarning2 =
TkWarningObj
- TktTag =
TkTextTag
- TktNamedTag =
TkTextNamedTag
- TktTagSel =
TkTextTagSel
- TkOption =
TkOptionDB
- TkResourceDB =
TkOptionDB
- TktMark =
TkTextMark
- TktNamedMark =
TkTextNamedMark
- TktMarkInsert =
TkTextMarkInsert
- TktMarkCurrent =
TkTextMarkCurrent
- TktMarkAnchor =
TkTextMarkAnchor
- TkNamedVirtualEvent =
TkVirtualEvent::PreDefVirtEvent
- TkcNamedTag =
TkcTagString
- TktImage =
TkTextImage
- TktWindow =
TkTextWindow
- Ttk =
Tk::Tile
- OPTS =
{}
- ImgFile =
[File.dirname(__FILE__), 'images','tcllogo.gif'].join(File::Separator)
- DEFAULT_TK_ENCODING =
'UTF-8'
- TkWidget =
TkWindow
Instance Method Summary collapse
- #anyUnreadDescendants(t, i) ⇒ Object
-
#arrowMove1(c, x, y) ⇒ Object
arrowMove1 – This method is called for each mouse motion event on box1 (the one at the vertex of the arrow).
-
#arrowMove2(c, x, y) ⇒ Object
arrowMove2 – This method is called for each mouse motion event on box2 (the one at the trailing tip of the arrowhead).
-
#arrowMove3(c, x, y) ⇒ Object
arrowMove3 – This method is called for each mouse motion event on box3 (the one that controls the thickness of the line).
-
#arrowSetup(c) ⇒ Object
arrowSetup – This method regenerates all the text and graphics in the canvas window.
-
#base_frame ⇒ Object
See Code / Dismiss buttons.
-
#bitmapRow(w, *args) ⇒ Object
bitmapRow – Create a row of bitmap items in a window.
- #browse(dir, file) ⇒ Object
- #browsedir(dir) ⇒ Object
-
#butPress(w, color) ⇒ Object
Method that’s invoked when the button embedded in the canvas is invoked.
- #changepage(tbl_list, tbl, ent, col, var, elem, op) ⇒ Object
- #changeState(st) ⇒ Object
- #changeToolbars ⇒ Object
- #check ⇒ Object
- #check_NG_path(path_list) ⇒ Object
- #check_pkg(file, verbose = false) ⇒ Object
- #check_shlib_search_path(paths) ⇒ Object
- #check_tcl_NG_path(path_list) ⇒ Object
- #check_tcltk_version(version) ⇒ Object
- #check_tk_NG_path(path_list) ⇒ Object
- #collect_tcltk_defs(tcl_defs_str, tk_defs_str) ⇒ Object
- #colorize(num) ⇒ Object
-
#compareOnOff(w, c, item1, item2) ⇒ Object
TreeCtrl 1.0.
-
#count ⇒ Object
Now set up the GUI.
- #cursor_window(top = nil) ⇒ Object
-
#def_puzzleswitch_proc(w, num) ⇒ Object
proc のスコープを閉じるため,proc 生成メソッドを用意 こうしておかねば,ループ中で値が変化する num の影響を受けて puzzleSwitch の第 2 引数が変化してしまい,期待通りにはならない..
-
#demoBitmaps(t) ⇒ Object
frozen_string_literal: false.
-
#demoExplorerAux(t, dir_proc, file_proc) ⇒ Object
frozen_string_literal: false.
-
#demoExplorerDetails(t) ⇒ Object
Demo: explorer files.
- #demoExplorerLargeIcons(t) ⇒ Object
-
#demoExplorerList(t) ⇒ Object
Tree is vertical, wrapping occurs at bottom of window, each range has the same width (as wide as the longest item), xscrollincrement is by range.
-
#demoExplorerSmallIcons(t) ⇒ Object
Tree is horizontal, wrapping occurs at right edge of window, each item is as wide as the smallest needed multiple of 110 pixels.
-
#demoHelpContents(t) ⇒ Object
frozen_string_literal: false.
-
#demoHelpContents2(t) ⇒ Object
This is an alternate implementation that does not define a new item state to change the appearance of the item under the cursor.
-
#demoIMovie(t) ⇒ Object
frozen_string_literal: false.
-
#demoInternetOptions(t) ⇒ Object
frozen_string_literal: false.
-
#demoInternetOptions_2(t) ⇒ Object
Alternate implementation that doesn’t rely on run-time styles.
-
#demoLayout(t) ⇒ Object
frozen_string_literal: false.
-
#demoMailWasher(t) ⇒ Object
frozen_string_literal: false.
-
#demoOutlookFolders(t) ⇒ Object
frozen_string_literal: false.
-
#demoOutlookNewsgroup(t) ⇒ Object
frozen_string_literal: false.
-
#demoOutlookNewsgroup2(t) ⇒ Object
Alternate implementation which does not rely on run-time states.
-
#demoRandom(t) ⇒ Object
Demo: random N items.
-
#demoRandom2(t) ⇒ Object
Demo: random N items, button images.
- #do_motion(x, y) ⇒ Object
- #do_press(x, y) ⇒ Object
- #do_release(x, y) ⇒ Object
- #drawlines ⇒ Object
- #embDefBg(w) ⇒ Object
- #embDefBg2(w) ⇒ Object
- #embPlotDown(w, x, y) ⇒ Object
- #embPlotDown2(w, x, y) ⇒ Object
- #embPlotMove(w, x, y) ⇒ Object
- #embPlotMove2(w, x, y) ⇒ Object
- #explorerHeaderInvoke(t, w, c) ⇒ Object
- #fileDialog(w, ent, operation) ⇒ Object
- #fill_headers(w, r = 10, c = 10) ⇒ Object
- #fill_table(tbl_list, page, r = 10, c = 10) ⇒ Object
-
#fillMenu(menu) ⇒ Object
Side-by side check, radio, and menu button comparison:.
- #fillTree(treeview) ⇒ Object
- #find_framework(tcl_hdr, tk_hdr) ⇒ Object
- #find_macosx_framework ⇒ Object
- #find_tcl(tcllib, stubs, version, *opt_paths) ⇒ Object
- #find_tcltk_header(tclver, tkver) ⇒ Object
- #find_tcltk_library(tcllib, tklib, stubs, tclversion, tkversion, tcl_opt_paths, tk_opt_paths) ⇒ Object
- #find_tk(tklib, stubs, version, *opt_paths) ⇒ Object
- #find_X11(*opt_paths) ⇒ Object
-
#floor2_bg1(w, fill, outline) ⇒ Object
floor2_bg1 – This method represents part of the floorplan database.
-
#floor2_bg2(w, fill, outline) ⇒ Object
floor2_bg2 – This method represents part of the floorplan database.
-
#floor2_bg3(w, fill, outline) ⇒ Object
floor2_bg3 – This method represents part of the floorplan database.
-
#floor2_fg1(w, color) ⇒ Object
floor2_fg1 – This method represents part of the floorplan database.
-
#floor2_fg2(w, color) ⇒ Object
floor2_fg2 – This method represents part of the floorplan database.
-
#floor2_fg3(w, color) ⇒ Object
floor2_fg3 – This method represents part of the floorplan database.
-
#floor_bg1(w, fill, outline) ⇒ Object
floor_bg1 – This method represents part of the floorplan database.
-
#floor_bg2(w, fill, outline) ⇒ Object
floor_bg2 – This method represents part of the floorplan database.
-
#floor_bg3(w, fill, outline) ⇒ Object
floor_bg3 – This method represents part of the floorplan database.
-
#floor_fg1(w, color) ⇒ Object
floor_fg1 – This method represents part of the floorplan database.
-
#floor_fg2(w, color) ⇒ Object
floor_fg2 – This method represents part of the floorplan database.
-
#floor_fg3(w, color) ⇒ Object
floor_fg3 – This method represents part of the floorplan database.
-
#floorDisplay(w, active) ⇒ Object
floorDisplay – Recreate the floorplan display in the canvas given by “w”.
-
#floorDisplay2(w, active) ⇒ Object
floorDisplay2 – Recreate the floorplan display in the canvas given by “w”.
-
#focusAndFlash(widget, fg, bg, count = 5) ⇒ Object
focusAndFlash – Error handler for entry widgets that forces the focus onto the widget and makes the widget flash by exchanging the foreground and background colours at intervals of 200ms (i.e. at approximately 2.5Hz).
- #focusMonitor ⇒ Object
-
#foreachWidget(wins, cmd) ⇒ Object
Utilities:.
- #get_ext_list ⇒ Object
- #get_files(file) ⇒ Object
- #get_libpath(lib_flag, lib_spec) ⇒ Object
- #get_pkg_list(file) ⇒ Object
- #get_shlib_path_head ⇒ Object
- #get_shlib_versions(major = 8, minor_max = 9, minor_min = 0, ext = "") ⇒ Object
- #get_tclConfig(tclConfig_file, tkConfig_file, tclConfig_dir, tkConfig_dir) ⇒ Object
- #get_tclConfig_dirs ⇒ Object
- #help_msg ⇒ Object
- #helpButton1(w, x, y) ⇒ Object
- #helpLeave1(w, x, y) ⇒ Object
- #helpMotion(w, x, y) ⇒ Object
- #helpMotion1(w, x, y) ⇒ Object
-
#helpMotion2(w, x, y) ⇒ Object
Alternate implementation doesn’t rely on mouseover state.
- #helpRelease1(w, x, y) ⇒ Object
- #iMovieButton1(w, x, y) ⇒ Object
- #is_macosx? ⇒ Boolean
-
#is_win32? ⇒ Boolean
fuctions.
- #itemDrag(c, x, y) ⇒ Object
- #itemEnter(c) ⇒ Object
- #itemLeave(c) ⇒ Object
-
#itemMark(c, x, y) ⇒ Object
Utility methods for stroking out a rectangle and printing what’s underneath the rectangle’s area.
-
#itemStartDrag(c, x, y) ⇒ Object
Utility methods to support dragging of items.
- #itemStroke(c, x, y) ⇒ Object
- #itemsUnderArea(c) ⇒ Object
- #killClone(win, cnt) ⇒ Object
- #kroc_rb_settings ⇒ Object
- #lfEnableButtons(w) ⇒ Object
- #libcheck_for_tclConfig(tcldir, tkdir, tclconf, tkconf) ⇒ Object
-
#loadDir(w) ⇒ Object
メソッド定義.
- #loadDir3(w) ⇒ Object
- #loadIcons(file) ⇒ Object
- #loadImage(img, w, x, y) ⇒ Object
- #loadImage3(w, x, y) ⇒ Object
- #Mainloop ⇒ Object
-
#makeClone(count, win, txt) ⇒ Object
Procedures to make and kill clones; most of this is just so that the demo looks nice…
-
#makeCompoundMenu(mb) ⇒ Object
Toolbar :compound control:.
-
#makeNotebook ⇒ Object
Notebook demonstration:.
- #makeThemeControl(parent) ⇒ Object
- #makeThemeMenu(parent) ⇒ Object
-
#makeToolbars ⇒ Object
Toolbar button standard vs.
- #maybe_64bit? ⇒ Boolean
- #messageReadDelayed(t) ⇒ Object
-
#mkTextConfig(w, x, y, option, value, color) ⇒ Object
Next, create some items that allow the text’s anchor position to be edited.
-
#newRoom(w) ⇒ Object
newRoom – This method is invoked whenever the mouse enters a room in the floorplan.
-
#newRoom2(w) ⇒ Object
newRoom2 – This method is invoked whenever the mouse enters a room in the floorplan.
-
#open_file(canvas, fname) ⇒ Object
define methods for menu.
- #optionButton1(w, x, y) ⇒ Object
- #optionButton1_2(w, x, y) ⇒ Object
- #optionLeave1(w, x, y) ⇒ Object
- #optionMenu(menubutton, varName, firstValue, *rest) ⇒ Object
- #optionMotion1(w, x, y) ⇒ Object
- #optionRelease1(w, x, y) ⇒ Object
- #parse_tclConfig(file) ⇒ Object
- #parse_TK_LIBS(tklibs) ⇒ Object
- #pbMode(progress, vprogress) ⇒ Object
- #pbStart(progress, vprogress) ⇒ Object
- #pbStop(progress, vprogress) ⇒ Object
-
#phoneSkipLeft(widget) ⇒ Object
phoneSkipLeft – Skip over fixed characters in a phone-number string when moving left.
-
#phoneSkipRight(widget, add = 0) ⇒ Object
phoneSkipRight – Skip over fixed characters in a phone-number string when moving right.
-
#plotDown(w, x, y) ⇒ Object
plotDown – This method is invoked when the mouse is pressed over one of the data points.
-
#plotMove(w, x, y) ⇒ Object
plotMove – This method is invoked during mouse motion events.
- #pop_up ⇒ Object
-
#populate_roots(tree) ⇒ Object
Code to populate the roots of the tree (can be more than one on Windows).
-
#populate_tree(tree, node) ⇒ Object
Code to populate a node of the tree.
-
#ps_print(canvas, fname) ⇒ Object
——————————–.
- #pthread_check ⇒ Object
-
#puzzleSwitch(w, num) ⇒ Object
puzzleSwitch – This procedure is invoked when the user clicks on a particular button; if the button is next to the empty space, it moves the button into the empty space.
-
#quit(canvas) ⇒ Object
——————————–.
- #rand_bool ⇒ Object
-
#random_N ⇒ Object
frozen_string_literal: false.
-
#randomAutoScanCheck(t, x, y) ⇒ Object
Same as TreeCtrl::AutoScanCheck, but calls RandomMotion and RandomAutoScanCheckAux.
- #randomAutoScanCheckAux(t) ⇒ Object
- #randomButton1(t, x, y) ⇒ Object
- #randomDrop(t, target, src, pos) ⇒ Object
- #randomLeave1(t, x, y) ⇒ Object
- #randomMotion(t, x, y) ⇒ Object
- #randomMotion1(t, x, y) ⇒ Object
- #randomRelease1(t, x, y) ⇒ Object
-
#repeatDemo ⇒ Object
Repeating buttons demo:.
-
#roomChanged(w, *args) ⇒ Object
roomChanged – This method is invoked whenever the currentRoom variable changes.
-
#roomChanged2(w, *args) ⇒ Object
roomChanged2 – This method is invoked whenever the currentRoom variable changes.
-
#rulerMkTab(c, x, y) ⇒ Object
rulerMkTab – This method creates a new triangular polygon in a canvas to represent a tab stop.
-
#rulerMoveTab(c, x, y) ⇒ Object
rulerMoveTab – This method is invoked during mouse motion events to drag a tab.
-
#rulerNewTab(c, x, y) ⇒ Object
rulerNewTab – Does all the work of creating a tab stop, including creating the triangle object and adding tags to it to give it tab behavior.
-
#rulerReleaseTab(c) ⇒ Object
rulerReleaseTab – This method is invoked during button release events that end a tab drag operation.
-
#rulerSelectTab(c, x, y) ⇒ Object
rulerSelectTab – This method is invoked when mouse button 1 is pressed over a tab.
-
#save_memo(canvas, fname) ⇒ Object
——————————–.
-
#sbstub(sb, cmd, num, units = 'units') ⇒ Object
sbstub Used as the :command option for a scrollbar, updates the scrollbar’s position.
- #scrollbarResizeDemo ⇒ Object
- #scrollButton(c) ⇒ Object
- #scrolledWidget(parent, klass, themed, *args) ⇒ Object
- #scrollEnter(c) ⇒ Object
- #scrollLeave(c) ⇒ Object
-
#search_tclConfig(*paths) ⇒ Object
libdir list or [tcl-libdir|file, tk-libdir|file].
- #search_vers_on_path(vers, path, *heads) ⇒ Object
- #search_X_libraries ⇒ Object
-
#selectAndLoadDir3(w, lbox) ⇒ Object
selectAndLoadDir3 – This procedure pops up a dialog to ask for a directory to load into the listobx and (if the user presses OK) reloads the directory listbox from the directory named in the demo’s entry.
- #set_class_bind ⇒ Object
-
#set_msg(x, y, bhelp, parent) ⇒ Object
CASE4b : command is a Method object and takes 4 arguemnts.
- #setColor(w, button, name, options) ⇒ Object
- #setColor_helper(w, options, color) ⇒ Object
- #setHeight(w, height) ⇒ Object
-
#setState(root, value, *excepts) ⇒ Object
Helper procedure for the top checkbutton.
- #setTheme(theme) ⇒ Object
- #setup_for_macosx_framework(tclver, tkver) ⇒ Object
- #setWidth(w, width) ⇒ Object
- #show_loupe(setting = nil) ⇒ Object
- #showHelp ⇒ Object
- #showMessageBox(w) ⇒ Object
- #showMessageBox2(w) ⇒ Object
-
#sort_by(tree, col, direction) ⇒ Object
Code to do the sorting of the tree contents when clicked on.
- #start_random ⇒ Object
- #stateMonitor ⇒ Object
- #subdir_check(dir, verbose = false) ⇒ Object
- #table_validate(w, idx) ⇒ Object
-
#tag_binding_for_bind_demo(tag, enter_style, leave_style) ⇒ Object
bind 用メソッド.
-
#tb_btn ⇒ Object
Arrange contents.
- #test ⇒ Object
- #textB1Move(w, x, y) ⇒ Object
- #textB1Press(w, x, y) ⇒ Object
- #textBs(w) ⇒ Object
- #textDel(w) ⇒ Object
- #textEnter(w) ⇒ Object
- #textInsert(w, string) ⇒ Object
-
#textLoadFile(w, file) ⇒ Object
textLoadFile – This method below loads a file into a text widget, discarding the previous contents of the widget.
- #textPaste(w, pos) ⇒ Object
-
#textSearch(w, string, tag) ⇒ Object
textSearch – Search for all instances of a given string in a text widget and apply a given tag to each instance found.
-
#textToggle(cmd1, sleep1, cmd2, sleep2) ⇒ Object
textToggle – This method is invoked repeatedly to invoke two commands at periodic intervals.
-
#textWinBigB2(w) ⇒ Object
メソッド定義.
- #textWinBigH2(w) ⇒ Object
- #textWinBigP2(w) ⇒ Object
- #textWindDel(w) ⇒ Object
- #textWindDel2(w) ⇒ Object
- #textWindOff(w) ⇒ Object
- #textWindOff2(w) ⇒ Object
-
#textWindOn(w, f) ⇒ Object
メソッド定義.
- #textWindOn2(w, f) ⇒ Object
- #textWindPlot(t) ⇒ Object
- #textWindPlot2(t) ⇒ Object
- #textWinSmallB2(w) ⇒ Object
- #textWinSmallH2(w) ⇒ Object
- #textWinSmallP2(w) ⇒ Object
-
#them ⇒ Object
Explanatory text.
- #tick ⇒ Object
- #TkGrid(*args) ⇒ Object
- #TkPack(*args) ⇒ Object
- #TkPlace(*args) ⇒ Object
- #toggle_console ⇒ Object
- #trackFocus ⇒ Object
- #trackStates ⇒ Object
- #updateStates ⇒ Object
- #validate_proc(c, val) ⇒ Object
-
#validatePhoneChange(widget, vmode, idx, char) ⇒ Object
validatePhoneChange – Checks that the replacement (mapped to a digit) of the given character in an entry widget at the given position will leave a valid phone number in the widget.
- #version?(ver) ⇒ Boolean
Instance Method Details
#anyUnreadDescendants(t, i) ⇒ Object
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
# File 'sample/tkextlib/treectrl/outlook-newgroup.rb', line 435 def anyUnreadDescendants(t, i) itemList = [] item = t.item_firstchild(i) itemList.push(item) if item != '' while item = itemList.pop return true unless @Message[:read][item] item2 = t.item_nextsibling(item) itemList.push(item2) if item2 != '' item2 = t.item_firstchild(item) itemList.push(item2) if item2 != '' end false end |
#arrowMove1(c, x, y) ⇒ Object
arrowMove1 – This method is called for each mouse motion event on box1 (the one at the vertex of the arrow). It updates the controlling parameters for the line and arrowhead.
Arguments: c - The name of the canvas window. x, y - The coordinates of the mouse.
196 197 198 199 200 201 202 203 204 205 |
# File 'sample/demos-en/arrow.rb', line 196 def arrowMove1(c,x,y) v = $demo_arrowInfo newA = (v.x2+5-c.canvasx(x).round)/10 newA = 0 if newA < 0 newA = 25 if newA > 25 if newA != v.a c.move('box1', 10*(v.a-newA), 0) v.a = newA end end |
#arrowMove2(c, x, y) ⇒ Object
arrowMove2 – This method is called for each mouse motion event on box2 (the one at the trailing tip of the arrowhead). It updates the controlling parameters for the line and arrowhead.
Arguments: c - The name of the canvas window. x, y - The coordinates of the mouse.
216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
# File 'sample/demos-en/arrow.rb', line 216 def arrowMove2(c,x,y) v = $demo_arrowInfo newB = (v.x2+5-c.canvasx(x).round)/10 newB = 0 if newB < 0 newB = 25 if newB > 25 newC = (v.y+5-c.canvasy(y).round-5*v.width)/10 newC = 0 if newC < 0 newC = 20 if newC > 20 if newB != v.b || newC != v.c c.move('box2', 10*(v.b-newB), 10*(v.c-newC)) v.b = newB v.c = newC end end |
#arrowMove3(c, x, y) ⇒ Object
arrowMove3 – This method is called for each mouse motion event on box3 (the one that controls the thickness of the line). It updates the controlling parameters for the line and arrowhead.
Arguments: c - The name of the canvas window. x, y - The coordinates of the mouse.
240 241 242 243 244 245 246 247 248 249 |
# File 'sample/demos-en/arrow.rb', line 240 def arrowMove3(c,x,y) v = $demo_arrowInfo newWidth = (v.y+2-c.canvasy(y).round)/5 newWidth = 0 if newWidth < 0 newWidth = 20 if newWidth > 20 if newWidth != v.width c.move('box3', 0, 5*(v.width-newWidth)) v.width = newWidth end end |
#arrowSetup(c) ⇒ Object
arrowSetup – This method regenerates all the text and graphics in the canvas window. It’s called when the canvas is initially created, and also whenever any of the parameters of the arrow head are changed interactively.
Arguments: c - Name of the canvas widget.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'sample/demos-en/arrow.rb', line 19 def arrowSetup(c) v = $demo_arrowInfo # Remember the current box, if there is one. = c.('current') if != [] cur = .find{|t| t.kind_of?(String) && t =~ /^box[1-3]$/ } else cur = nil end # Create the arrow and outline. c.delete('all') TkcLine.new(c, v.x1, v.y, v.x2, v.y, { 'width'=>10 * v.width, 'arrowshape'=>[10*v.a, 10*v.b, 10*v.c], 'arrow'=>'last' }.update(v.bigLineStyle) ) xtip = v.x2 - 10*v.b deltaY = 10*v.c + 5*v.width TkcLine.new(c, v.x2, v.y, xtip, v.y + deltaY, v.x2 - 10*v.a, v.y, xtip, v.y - deltaY, v.x2, v.y, 'width'=>2, 'capstyle'=>'round', 'joinstyle'=>'round') # Create the boxes for reshaping the line and arrowhead. TkcRectangle.new(c, v.x2-10*v.a-5, v.y-5, v.x2-10*v.a+5, v.y+5, {'tags'=>['box1', $arrowTag_box]}.update(v.boxStyle) ) TkcRectangle.new(c, xtip-5, v.y-deltaY-5, xtip+5, v.y-deltaY+5, {'tags'=>['box2', $arrowTag_box]}.update(v.boxStyle) ) TkcRectangle.new(c, v.x1-5, v.y-5*v.width-5, v.x1+5, v.y-5*v.width+5, {'tags'=>['box3', $arrowTag_box]}.update(v.boxStyle) ) c.itemconfigure cur, v.activeStyle if cur # Create three arrows in actual size with the same parameters TkcLine.new(c, v.x2+50, 0, v.x2+50, 1000, 'width'=>2) tmp = v.x2+100 TkcLine.new(c, tmp, v.y-125, tmp, v.y-75, 'width'=>v.width, 'arrow'=>'both', 'arrowshape'=>[v.a, v.b, v.c]) TkcLine.new(c, tmp-25, v.y, tmp+25, v.y, 'width'=>v.width, 'arrow'=>'both', 'arrowshape'=>[v.a, v.b, v.c]) TkcLine.new(c, tmp-25, v.y+75, tmp+25, v.y+125, 'width'=>v.width, 'arrow'=>'both', 'arrowshape'=>[v.a, v.b, v.c]) # Create a bunch of other arrows and text items showing the # current dimensions. tmp = v.x2+10 TkcLine.new(c, tmp, v.y-5*v.width, tmp, v.y-deltaY, 'arrow'=>'both', 'arrowshape'=>v.smallTips) TkcText.new(c, v.x2+15, v.y-deltaY+5*v.c, 'text'=>v.c, 'anchor'=>'w') tmp = v.x1-10 TkcLine.new(c, tmp, v.y-5*v.width, tmp, v.y+5*v.width, 'arrow'=>'both', 'arrowshape'=>v.smallTips) TkcText.new(c, v.x1-15, v.y, 'text'=>v.width, 'anchor'=>'e') tmp = v.y+5*v.width+10*v.c+10 TkcLine.new(c, v.x2-10*v.a, tmp, v.x2, tmp, 'arrow'=>'both', 'arrowshape'=>v.smallTips) TkcText.new(c, v.x2-5*v.a, tmp+5, 'text'=>v.a, 'anchor'=>'n') tmp = tmp+25 TkcLine.new(c, v.x2-10*v.b, tmp, v.x2, tmp, 'arrow'=>'both', 'arrowshape'=>v.smallTips) TkcText.new(c, v.x2-5*v.b, tmp+5, 'text'=>v.b, 'anchor'=>'n') if $tk_version =~ /^4.*/ TkcText.new(c, v.x1, 310, 'text'=>"'width'=>#{v.width}", 'anchor'=>'w', 'font'=>'-*-Helvetica-Medium-R-Normal--*-180-*-*-*-*-*-*') TkcText.new(c, v.x1, 330, 'text'=>"'arrowshape'=>[#{v.a}, #{v.b}, #{v.c}]",'anchor'=>'w', 'font'=>'-*-Helvetica-Medium-R-Normal--*-180-*-*-*-*-*-*') else TkcText.new(c, v.x1, 310, 'text'=>"'width'=>#{v.width}", 'anchor'=>'w', 'font'=>'Helvetica 18') TkcText.new(c, v.x1, 330, 'text'=>"'arrowshape'=>[#{v.a}, #{v.b}, #{v.c}]", 'anchor'=>'w', 'font'=>'Helvetica 18') end v.count += 1 end |
#base_frame ⇒ Object
See Code / Dismiss buttons
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'sample/demos-en/tree.rb', line 38 Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) TkGrid('x', Ttk::Button.new(frame, :text=>'See Code', :image=>$image['view'], :compound=>:left, :command=>proc{showCode 'tree'}), Ttk::Button.new(frame, :text=>'Dismiss', :image=>$image['delete'], :compound=>:left, :command=>proc{ $tree_demo.destroy $tree_demo = nil }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) } |
#bitmapRow(w, *args) ⇒ Object
bitmapRow – Create a row of bitmap items in a window.
Arguments: w - The parent window that is to contain the row. args - The names of one or more bitmaps, which will be displayed
in a new row across the bottom of w along with their
names.
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'sample/demos-en/bitmap.rb', line 18 def bitmapRow(w,*args) TkFrame.new(w){|row| pack('side'=>'top', 'fill'=>'both') for bitmap in args TkFrame.new(row){|base| pack('side'=>'left', 'fill'=>'both', 'pady'=>'.25c', 'padx'=>'.25c') TkLabel.new(base, 'text'=>bitmap, 'width'=>9).pack('side'=>'bottom') Tk::Label.new(base, 'bitmap'=>bitmap).pack('side'=>'bottom') } end } end |
#browse(dir, file) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'sample/tkbrowse.rb', line 53 def browse (dir, file) file="#{dir}/#{file}" if File.directory? file browsedir(file) else if File.file? file if ENV['EDITOR'] system format("%s %s&", ENV['EDITOR'], file) else system "xedit #{file}&" end else STDERR.print "\"#{file}\" isn't a directory or regular file" end end end |
#browsedir(dir) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'sample/tkbrowse.rb', line 20 def browsedir (dir) if $dirlist.key? dir $dirlist[dir] else top = if $dirlist.size > 0 then TkToplevel.new else nil end list = TkScrollbox.new(top) { relief 'raised' width 20 height 20 setgrid 'yes' pack } list.insert 'end', *`ls #{dir}`.split # Set up bindings for the browser. list.focus list.bind "Control-q", proc{exit} list.bind "Control-c", proc{exit} list.bind "Control-p", proc{ print "selection <", TkSelection.get, ">\n" } list.bind "Double-Button-1", proc{ for i in TkSelection.get.split print "clicked ", i, "\n" browse dir, i end } $dirlist[dir] = list end end |
#butPress(w, color) ⇒ Object
Method that’s invoked when the button embedded in the canvas is invoked.
378 379 380 381 382 |
# File 'sample/demos-en/items.rb', line 378 def butPress(w,color) i = TkcText.new(w, '25c', '18.1c', 'text'=>'Ouch!!', 'fill'=>color, 'anchor'=>'n') Tk.after(500, proc{w.delete i}) end |
#changepage(tbl_list, tbl, ent, col, var, elem, op) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'sample/tkextlib/tktable/spreadsheet.rb', line 45 def changepage(tbl_list, tbl, ent, col, var, elem, op) if elem != '' page = var[elem] else page = var.value end if tbl[:variable] != tbl_list[page].id tbl.selection_clear_all tbl.variable(tbl_list[page]) ent.textvariable(tbl_list[page].ref('active')) tbl.activate('origin') tbl.tag_configure('colored', :bg=>col[page]) tbl.see('active') end end |
#changeState(st) ⇒ Object
946 947 948 949 950 951 952 953 954 |
# File 'sample/tkextlib/tile/demo.rb', line 946 def changeState(st) if $Widget.value != '' if $State.bool_element(st) $Widget.window.ttk_state(st) else $Widget.window.ttk_state("!#{st}") end end end |
#changeToolbars ⇒ Object
292 293 294 295 296 297 298 299 300 |
# File 'sample/tkextlib/tile/demo.rb', line 292 def foreachWidget($TOOLBARS, proc{|w| begin w.compound($V[:COMPOUND]) rescue end }) end |
#check ⇒ Object
101 102 103 104 105 106 107 108 109 |
# File 'sample/tkbiff.rb', line 101 def check $check_time = Time.now size = File.size($spool) if size and size != $spool_size $spool_size = size pop_up if size > 0 end Tk.after 5000, proc{check} end |
#check_NG_path(path_list) ⇒ Object
985 986 987 988 989 990 |
# File 'extconf.rb', line 985 def check_NG_path(path_list) path_list.find_all{|path| not (TkLib_Config["tcl-NG-path"].include?(path) && TkLib_Config["tk-NG-path"].include?(path)) } end |
#check_pkg(file, verbose = false) ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/tkextlib/pkg_checker.rb', line 92 def check_pkg(file, verbose=false) pkg_list = get_pkg_list(file) error_list = [] success_list = {} pkg_list.each{|name, type| next if success_list[name] begin case type when :package ver = TkPackage.require(name) success_list[name] = ver error_list.delete_if{|n, t| n == name} when :library Tk.load_tcllibrary(name) success_list[name] = :library error_list.delete_if{|n, t| n == name} when :script Tk.load_tclscript(name) success_list[name] = :script error_list.delete_if{|n, t| n == name} when :require_ruby_lib require name end rescue => e if verbose error_list << [name, type, e.] else error_list << [name, type] end end } success_list.dup.each{|name, ver| unless ver.kind_of?(String) begin ver = TkPackage.require(name) sccess_list[name] = ver rescue end end } [success_list, error_list] end |
#check_shlib_search_path(paths) ⇒ Object
992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 |
# File 'extconf.rb', line 992 def check_shlib_search_path(paths) if !paths || paths.empty? path_list = [] #if TkLib_Config["ActiveTcl"] # path_list.concat Dir.glob(TkLib_Config["ActiveTcl"], File::FNM_CASEFOLD).sort.reverse #end if TkLib_Config["ActiveTcl"].kind_of?(String) # glob path path_list.concat Dir.glob(TkLib_Config["ActiveTcl"], File::FNM_CASEFOLD).sort.reverse end vers = get_shlib_versions path_head, path_dirs = get_shlib_path_head path_list.concat vers.map{|ver| path_head.map{|head| if ver.empty? head + "/lib" else dirs = [] if Dir.glob(head, File::FNM_CASEFOLD).find{|dir| dir == head} dirs << head + "/lib" end if !Dir.glob(head + "-*", File::FNM_CASEFOLD).empty? dirs << head + "-#{ver}/lib" if !Dir.glob(head + "-[89].*", File::FNM_CASEFOLD).empty? dirs << head + "-#{ver.delete('.')}/lib" if !Dir.glob(head + "-[89][0-9]*", File::FNM_CASEFOLD).empty? end if !Dir.glob(head + "[_-]*", File::FNM_CASEFOLD).empty? dirs << head + "_#{ver}/lib" if !Dir.glob(head + "_[89].*", File::FNM_CASEFOLD).empty? dirs << head + "-#{ver}/lib" if !Dir.glob(head + "-[89].*", File::FNM_CASEFOLD).empty? dirs << head + "_#{ver.delete('.')}/lib" if !Dir.glob(head + "_[89][0-9]*", File::FNM_CASEFOLD).empty? dirs << head + "-#{ver.delete('.')}/lib" if !Dir.glob(head + "-[89][0-9]*", File::FNM_CASEFOLD).empty? end dirs end } }.flatten! path_list.concat path_dirs else # paths is a string with PATH environment style path_list = paths.split((is_win32?)? ';': ':') end path_list = check_NG_path(path_list) path_list.map!{|path| path.strip} if !CROSS_COMPILING and (is_win32? || is_macosx?) # exist-dir only path_list.delete_if{|path| Dir.glob(File.join(path, "*.{a,so,dll,lib}")).empty?} end # keep paths for searching dynamic libs #$LIBPATH |= path_list path_list.uniq end |
#check_tcl_NG_path(path_list) ⇒ Object
977 978 979 |
# File 'extconf.rb', line 977 def check_tcl_NG_path(path_list) path_list.find_all{|path| not TkLib_Config["tcl-NG-path"].include?(path) } end |
#check_tcltk_version(version) ⇒ Object
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'extconf.rb', line 130 def check_tcltk_version(version) return [nil, nil] unless version.kind_of? String tclver, tkver = version.split(',') tclver = tclver.strip return [tclver, tkver.strip] if tkver dot = major = minor_dot = minor = plvl_dot = plvl = ext = nil if tclver =~ /^(\d)(\.?)(\d)(\.?)(\d*)(.*)$/ major = $1; minor_dot = $2; minor = $3; plvl_dot = $4; plvl = $5; ext = $6 dot = ! minor_dot.empty? if plvl_dot.empty? && ! plvl.empty? minor << plvl end elsif tclver =~ /^(\d)(\.?)(\d?)(.*)$/ major = $1; minor_dot = $2; minor = $3; ext = $4 dot = ! minor_dot.empty? else # unknown -> believe user return [tclver, tkver] end # check Tcl7.6 / Tk4.2 ? if major == "7" # Tcl7.6 ( not support Tclversion < 7.6 ) # Tk4.2 tkver = "4" + ((dot)? ".": "") + ((minor.empty)? "": "2") + ext elsif major == "4" # Tk4.2 ( not support Tkversion < 4.2 ) # Tcl7.6 tkver = tclver tclver = "7" + ((dot)? ".": "") + ((minor.empty)? "": "6") + ext end tkver = tclver unless tkver [tclver, tkver] end |
#check_tk_NG_path(path_list) ⇒ Object
981 982 983 |
# File 'extconf.rb', line 981 def check_tk_NG_path(path_list) path_list.find_all{|path| not TkLib_Config["tk-NG-path"].include?(path) } end |
#collect_tcltk_defs(tcl_defs_str, tk_defs_str) ⇒ Object
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 |
# File 'extconf.rb', line 337 def collect_tcltk_defs(tcl_defs_str, tk_defs_str) conflicts = [ 'PACKAGE_NAME', 'PACKAGE_TARNAME', 'PACKAGE_VERSION', 'PACKAGE_STRING', 'PACKAGE_BUGREPORT' ] begin # Ruby 1.9.x or later arch_config_h = RbConfig.($arch_hdrdir + "/ruby/config.h") if File.exist?(arch_config_h) keys = [] IO.foreach(arch_config_h){|line| if line =~ /^#define +([^ ]+)/ keys << $1 end } conflicts = keys end rescue # ignore, use default end if tcl_defs_str tcl_defs = tcl_defs_str.split(/ ?-D/).map{|s| s =~ /^([^=]+)(.*)$/ [$1, $2] } else tcl_defs = [] end if tk_defs_str tk_defs = tk_defs_str.split(/ ?-D/).map{|s| s =~ /^([^=]+)(.*)$/ [$1, $2] } else tk_defs = [] end defs = tcl_defs | tk_defs defs.delete_if{|name,value| conflicts.include?(name) || ( (vtcl = tcl_defs.assoc(name)) && (vtk = tk_defs.assoc(name)) && vtcl != vtk ) } defs.map{|ary| s = ary.join(''); (s.strip.empty?)? "": "-D" << s} end |
#colorize(num) ⇒ Object
17 18 19 20 |
# File 'sample/tkextlib/tktable/valid.rb', line 17 def colorize(num) num = Integer(num) return 'colored' if (num > 0 && num % 2 == 1) end |
#compareOnOff(w, c, item1, item2) ⇒ Object
TreeCtrl 1.0
259 260 261 262 263 264 265 266 267 268 269 |
# File 'sample/tkextlib/treectrl/mailwasher.rb', line 259 def compareOnOff(w, c, item1, item2) s1 = w.item_state_forcolumn(item1, c) s2 = w.item_state_forcolumn(item2, c) if (s1 == s2) 0 elsif (s1 == 'CHECK') -1 else 1 end end |
#count ⇒ Object
Now set up the GUI
60 |
# File 'sample/demos-en/textpeer.rb', line 60 makeClone(count, base_frame, first) |
#cursor_window(top = nil) ⇒ Object
1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 |
# File 'sample/tkextlib/treectrl/demo.rb', line 1147 def cursor_window(top = nil) top.destroy if top.kind_of?(TkWindow) && top.winfo_exist? top = TkToplevel.new(:title=>'Cursor Window') c = TkCanvas.new(top, :background=>'white', :width=>50*10, :highlightthickness=>0, :borderwidth=>0).pack(:expand=>true, :fill=>:both) cursors = %w( X_cursor arrow based_arrow_down based_arrow_up boat bogosity bottom_left_corner bottom_right_corner bottom_side bottom_tee box_spiral center_ptr circle clock coffee_mug cross cross_reverse crosshair diamond_cross dot dotbox double_arrow draft_large draft_small draped_box exchange fleur gobbler gumby hand1 hand2 heart icon iron_cross left_ptr left_side left_tee leftbutton ll_angle lr_angle man middlebutton mouse pencil pirate plus question_arrow right_ptr right_side right_tee rightbutton rtl_logo sailboat sb_down_arrow sb_h_double_arrow sb_left_arrow sb_right_arrow sb_up_arrow sb_v_double_arrow shuttle sizing spider spraycan star target tcross top_left_arrow top_left_corner top_right_corner top_side top_tee trek ul_angle umbrella ur_angle watch xterm ) orig_cursor = c.cursor col = 0 row = 0 cursors.each{|cur| x = col * 50 y = row * 40 begin c.cursor = cur r = TkcRectangle.new(c, x, y, x+50, y+40, :fill=>'gray90', :outline=>'black', :width=>2) t = TkcText.new(c, x+50/2, y+4, :text=>cur, :anchor=>:n, :width=>42) col += 1 if col >= 10 col = 0 row += 1 end r.bind('Enter', proc{c.cursor = cur; r.fill = 'linen'}) r.bind('Leave', proc{c.cursor = ''; r.fill = 'gray90'}) t.bind('Enter', proc{c.cursor = cur}) t.bind('Leave', proc{c.cursor = ''}) rescue c.cursor = orig_cursor end } c.cursor = orig_cursor c.height = (row + 1) * 40 end |
#def_puzzleswitch_proc(w, num) ⇒ Object
proc のスコープを閉じるため,proc 生成メソッドを用意 こうしておかねば,ループ中で値が変化する num の影響を受けて puzzleSwitch の第 2 引数が変化してしまい,期待通りにはならない.
88 89 90 |
# File 'sample/demos-jp/puzzle.rb', line 88 def def_puzzleswitch_proc(w, num) proc{puzzleSwitch w, num} end |
#demoBitmaps(t) ⇒ Object
frozen_string_literal: false
Demo: Bitmaps
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'sample/tkextlib/treectrl/bitmaps.rb', line 5 def demoBitmaps(t) #if $Version_1_1_OrLater if @has_bgimg t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, :selectmode=>:browse, :orient=>:horizontal, :wrap=>'5 items', :showheader=>false, :backgroundimage=>@images['sky']) else t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, :selectmode=>:browse, :orient=>:horizontal, :wrap=>'5 items', :showheader=>false) end if $HasColumnCreate t.column_create(:itembackground=>['gray90', []]) else t.column_configure(0, :itembackground=>['gray90', []]) end t.element_create('elemTxt', :text, :fill=>[@SystemHighlightText, ['selected', 'focus']]) t.element_create('elemSelTxt', :rect, :showfocus=>true, :fill=>[@SystemHighlight, ['selected', 'focus']]) t.element_create('elemSelBmp', :rect, :outlinewidth=>4, :outline=>[@SystemHighlight, ['selected', 'focus']]) t.element_create('elemBmp', :bitmap, :foreground=>[@SystemHighlight, ['selected', 'focus']], :background=>'linen', :bitmap=>['question' ['selected']]) s = t.style_create('STYLE', :orient=>:vertical) t.style_elements(s, ['elemSelBmp', 'elemBmp', 'elemSelTxt', 'elemTxt']) t.style_layout(s, 'elemSelBmp', :union=>'elemBmp', :ipadx=>6, :ipady=>6) t.style_layout(s, 'elemBmp', :pady=>[0, 6], :expand=>:we) t.style_layout(s, 'elemSelTxt', :union=>'elemTxt', :ipadx=>2) t.style_layout(s, 'elemTxt', :expand=>:we) # Set default item style if $Version_1_1_OrLater t.defaultstyle = [s] end bitmap_names = %w(error gray75 gray50 gray25 gray12 hourglass info questhead question warning) bitmap_names.each{|name| i = t.item_create unless $Version_1_1_OrLater t.item_style_set(i, 0, s) end t.item_text(i, 0, name) t.item_element_configure(i, 0, 'elemBmp', :bitmap=>name) t.item_lastchild(:root, i) } bitmap_names.each{|name| i = t.item_create t.item_style_set(i, 0, s) t.item_text(i, 0, name) if true t.item_element_configure(i, 0, 'elemBmp', :bitmap=>name, :foreground=>['brown', ''], :background=>['', '']) else t.item_element_configure(i, 0, 'elemBmp', :bitmap=>name, :foreground=>[ @SystemHighlight, ['selected', 'focus'], 'brown', [] ], :background=>['', []]) end t.item_lastchild(:root, i) } end |
#demoExplorerAux(t, dir_proc, file_proc) ⇒ Object
frozen_string_literal: false
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'sample/tkextlib/treectrl/explorer.rb', line 3 def demoExplorerAux(t, dir_proc, file_proc) base_dir = File.dirname(File.dirname(@ScriptDir)) clicks = Tk::Clock.clicks globDirs = Dir.glob(File.join(base_dir, '*')).find_all{|file| FileTest.directory?(file) } clickGlobDirs = Tk::Clock.clicks - clicks clicks = Tk::Clock.clicks list = globDirs.sort clickSortDirs = Tk::Clock.clicks - clicks clicks = Tk::Clock.clicks list.each{|file| dir_proc.call(file)} clickAddDirs = Tk::Clock.clicks - clicks clicks = Tk::Clock.clicks globFiles = Dir.glob(File.join(base_dir, '*')).find_all{|file| FileTest.file?(file) } clickGlobFiles = Tk::Clock.clicks - clicks clicks = Tk::Clock.clicks list = globFiles.sort clickSortFiles = Tk::Clock.clicks - clicks clicks = Tk::Clock.clicks list.each{|file| file_proc.call(file)} clickAddFiles = Tk::Clock.clicks - clicks gd = '%.2g' % (clickGlobDirs / 1000000.0) sd = '%.2g' % (clickSortDirs / 1000000.0) ad = '%.2g' % (clickAddDirs / 1000000.0) gf = '%.2g' % (clickGlobFiles / 1000000.0) sf = '%.2g' % (clickSortFiles / 1000000.0) af = '%.2g' % (clickAddFiles / 1000000.0) puts "dirs(#{globDirs.length}) glob/sort/add #{gd}/#{sd}/#{ad} files(#{globFiles.length}) glob/sort/add #{gf}/#{sf}/#{af}" @Priv[:DirCnt, t] = globDirs.length end |
#demoExplorerDetails(t) ⇒ Object
Demo: explorer files
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'sample/tkextlib/treectrl/explorer.rb', line 49 def demoExplorerDetails(t) height = t.font.metrics(:linespace) height = 18 if height < 18 t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, :itemheight=>height, :selectmode=>:extended, :xscrollincrement=>20, :scrollmargin=>16, :xscrolldelay=>[500, 50], :yscrolldelay=>[500, 50]) init_pics('small-*') if $HasColumnCreate t.column_create(:text=>'Name', :tag=>'name', :width=>200, :arrow=>:up, :arrowpad=>6) t.column_create(:text=>'Size', :tag=>'size', :justify=>:right, :width=>60, :arrowside=>:left, :arrowgravity=>:right) t.column_create(:text=>'Type', :tag=>'type', :width=>120) t.column_create(:text=>'Modified', :tag=>'modified', :width=>130) else t.column_configure(0, :text=>'Name', :tag=>'name', :width=>200, :arrow=>:up, :arrowpad=>6) t.column_configure(1, :text=>'Size', :tag=>'size', :justify=>:right, :width=>60, :arrowside=>:left, :arrowgravity=>:right) t.column_configure(2, :text=>'Type', :tag=>'type', :width=>120) t.column_configure(3, :text=>'Modified', :tag=>'modified', :width=>130) end t.element_create('e1', :image, :image=>[ @sel_images['small-folder'], ['selected'], @images['small-folder'], [] ]) t.element_create('e2', :text, :lines=>1, :fill=>[@SystemHighlightText, ['selected', 'focus']]) t.element_create('txtType', :text, :lines=>1) t.element_create('txtSize', :text, :lines=>1, :datatype=>:integer, :format=>'%dKB') t.element_create('txtDate', :text, :lines=>1, :datatype=>:time, :format=>'%d/%m/%y %I:%M %p') t.element_create('e4', :rect, :showfocus=>true, :fill=>[ @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) # image + text s = t.style_create('styName', :orient=>:horizontal) t.style_elements(s, ['e4', 'e1', 'e2']) t.style_layout(s, 'e1', :expand=>:ns) t.style_layout(s, 'e2', :padx=>[2,0], :squeeze=>:x, :expand=>:ns) t.style_layout(s, 'e4', :union=>['e2'], :iexpand=>:ns, :ipadx=>2) # column 1: text s = t.style_create('stySize') t.style_elements(s, ['txtSize']) t.style_layout(s, 'txtSize', :padx=>6, :squeeze=>:x, :expand=>:ns) # column 2: text s = t.style_create('styType') t.style_elements(s, ['txtType']) t.style_layout(s, 'txtType', :padx=>6, :squeeze=>:x, :expand=>:ns) # column 3: text s = t.style_create('styDate') t.style_elements(s, ['txtDate']) t.style_layout(s, 'txtDate', :padx=>6, :squeeze=>:x, :expand=>:ns) @Priv[:edit, t] = ['e2'] @Priv[:sensitive, t] = [ ['name', 'styName', 'e1', 'e2'] ] @Priv[:dragimage, t] = [ ['name', 'styName', 'e1', 'e2'] ] t.notify_bind(t, 'Edit-accept', proc{|w, i, tt| w.item_text(i, 0, tt)}, '%T %I %t') dir_proc = proc{|file| item = t.item_create t.item_style_set(item, 0, 'styName', 2, 'styType', 3, 'styDate') t.item_complex(item, [['e2', {:text=>File.basename(file)}]], [], [['txtType', {:text=>'Folder'}]], [['txtDate', {:data=>File.mtime(file).tv_sec}]]) t.item_lastchild(:root, item) } file_proc = proc{|file| item = t.item_create t.item_style_set(item, 0, 'styName', 1, 'stySize', 2, 'styType', 3, 'styDate') ext = File.extname(file) case ext when '.dll' img = 'small-dll' when '.exe' img = 'small-exe' when '.txt' img = 'small-txt' else img = 'small-file' end type = ext.upcase type = type[1..-1] << ' ' unless type.empty? type << 'File' t.item_complex(item, [ ['e1', {:image=>[@sel_images[img], ['selected'], @images[img], []]}], ['e2', {:text=>File.basename(file)}] ], [ ['txtSize', {:data=>File.size(file)/1024 + 1}] ], [ ['txtType', {:text=>type}] ], [ ['txtDate', {:data=>File.mtime(file).tv_sec}] ] ) t.item_lastchild(:root, item) } demoExplorerAux(t, dir_proc, file_proc) @SortColumn = 0 t.notify_bind(t, 'Header-invoke', proc{|w, c| explorerHeaderInvoke(t, w, c)}, '%T %C') t. = [ t, 'TreeCtrlFileList', Tk::TreeCtrl, t.winfo_toplevel, :all ] end |
#demoExplorerLargeIcons(t) ⇒ Object
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
# File 'sample/tkextlib/treectrl/explorer.rb', line 241 def demoExplorerLargeIcons(t) # Item height is 32 for icon, 4 padding, 3 lines of text itemHeight = 32 + 4 + t.font.metrics(:linespace) * 3 t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, :selectmode=>:extended, :wrap=>:window, :orient=>:horizontal, :itemheight=>itemHeight, :showheader=>false, :scrollmargin=>16, :xscrolldelay=>[500, 50], :yscrolldelay=>[500, 50]) init_pics('big-*') if $HasColumnCreate t.column_create(:width=>75) else t.column_configure(0, :width=>75) end t.element_create('elemImg', :image, :image=>[ @sel_images['big-folder'], ['selected'], @images['big-folder'], [] ]) t.element_create('elemTxt', :text, :justify=>:center, :lines=>1, :width=>71, :wrap=>:word, :fill=>[@SystemHighlightText, ['selected', 'focus']]) t.element_create('elemSel', :rect, :showfocus=>true, :fill=>[ @SystemHighlight, ['selected', 'focus'], 'gray', ['selected'] ]) # image + text s = t.style_create('STYLE', :orient=>:vertical) t.style_elements(s, ['elemSel', 'elemImg', 'elemTxt']) t.style_layout(s, 'elemImg', :expand=>:we) t.style_layout(s, 'elemTxt', :pady=>[4,0], :padx=>2, :squeeze=>:x, :expand=>:we) t.style_layout(s, 'elemSel', :union=>['elemTxt']) @Priv[:edit, t] = ['elemTxt'] @Priv[:sensitive, t] = [ [0, 'STYLE', 'elemImg', 'elemTxt'] ] @Priv[:dragimage, t] = [ [0, 'STYLE', 'elemImg', 'elemTxt'] ] t.notify_bind(t, 'Edit-accept', proc{|w, i, tt| w.item_text(i, 0, tt)}, '%T %I %t') dir_proc = proc{|file| item = t.item_create t.item_style_set(item, 0, 'STYLE') t.item_text(item, 0, File.basename(file)) t.item_lastchild(:root, item) } file_proc = proc{|file| item = t.item_create t.item_style_set(item, 0, 'STYLE') ext = File.extname(file) case ext when '.dll' img = 'big-dll' when '.exe' img = 'big-exe' when '.txt' img = 'big-txt' else img = 'big-file' end type = ext.upcase type = type[1..-1] << ' ' unless type.empty? type << 'File' t.item_complex(item, [ ['elemImg', {:image=>[@sel_images[img], ['selected'], @images[img], []]}], ['elemTxt', {:text=>File.basename(file)}] ]) t.item_lastchild(:root, item) } demoExplorerAux(t, dir_proc, file_proc) t.activate(t.index('root firstchild')) t.notify_bind(t, 'ActiveItem', proc{|w, a, c| w.item_element_configure(a, 0, 'elemTxt', :lines=>'') w.item_element_configure(c, 0, 'elemTxt', :lines=>3) }, '%T %p %c') t. = [ t, 'TreeCtrlFileList', Tk::TreeCtrl, t.winfo_toplevel, :all ] end |
#demoExplorerList(t) ⇒ Object
Tree is vertical, wrapping occurs at bottom of window, each range has the same width (as wide as the longest item), xscrollincrement is by range
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 |
# File 'sample/tkextlib/treectrl/explorer.rb', line 346 def demoExplorerList(t) height = t.font.metrics(:linespace) + 2 height = 18 if height < 18 t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, :itemheight=>height, :selectmode=>:extended, :wrap=>:window, :showheader=>false, :scrollmargin=>16, :xscrolldelay=>[500, 50], :yscrolldelay=>[500, 50]) init_pics('small-*') if $HasColumnCreate t.column_create(:widthhack=>true) else t.column_configure(0, :widthhack=>true) end t.element_create('elemImg', :image, :image=>[ @sel_images['small-folder'], ['selected'], @images['small-folder'], [] ]) t.element_create('elemTxt', :text, :lines=>1, :fill=>[@SystemHighlightText, ['selected', 'focus']]) t.element_create('elemSel', :rect, :showfocus=>true, :fill=>[ @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) # image + text s = t.style_create('STYLE') t.style_elements(s, ['elemSel', 'elemImg', 'elemTxt']) t.style_layout(s, 'elemImg', :expand=>:ns) t.style_layout(s, 'elemTxt', :squeeze=>:x, :expand=>:ns, :padx=>[2,0]) t.style_layout(s, 'elemSel', :union=>['elemTxt'], :iexpand=>:ns, :ipadx=>2) @Priv[:edit, t] = ['elemTxt'] @Priv[:sensitive, t] = [ [0, 'STYLE', 'elemImg', 'elemTxt'] ] @Priv[:dragimage, t] = [ [0, 'STYLE', 'elemImg', 'elemTxt'] ] t.notify_bind(t, 'Edit-accept', proc{|w, i, tt| w.item_text(i, 0, tt)}, '%T %I %t') dir_proc = proc{|file| item = t.item_create t.item_style_set(item, 0, 'STYLE') t.item_text(item, 0, File.basename(file)) t.item_lastchild(:root, item) } file_proc = proc{|file| item = t.item_create t.item_style_set(item, 0, 'STYLE') ext = File.extname(file) case ext when '.dll' img = 'small-dll' when '.exe' img = 'small-exe' when '.txt' img = 'small-txt' else img = 'small-file' end type = ext.upcase type = type[1..-1] << ' ' unless type.empty? type << 'File' t.item_complex(item, [ ['elemImg', {:image=>[@sel_images[img], ['selected'], @images[img], []]}], ['elemTxt', {:text=>File.basename(file)}] ]) t.item_lastchild(:root, item) } demoExplorerAux(t, dir_proc, file_proc) t.activate(t.item_firstchild(:root)) t. = [ t, 'TreeCtrlFileList', Tk::TreeCtrl, t.winfo_toplevel, :all ] end |
#demoExplorerSmallIcons(t) ⇒ Object
Tree is horizontal, wrapping occurs at right edge of window, each item is as wide as the smallest needed multiple of 110 pixels
338 339 340 341 342 |
# File 'sample/tkextlib/treectrl/explorer.rb', line 338 def demoExplorerSmallIcons(t) demoExplorerList(t) t.configure(:orient=>:horizontal, :xscrollincrement=>0) t.column_configure(0, :width=>'', :stepwidth=>110, :widthhack=>false) end |
#demoHelpContents(t) ⇒ Object
frozen_string_literal: false
Demo: Help contents
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'sample/tkextlib/treectrl/help.rb', line 5 def demoHelpContents(t) height = t.font.metrics(:linespace) height = 18 if height < 18 t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, :itemheight=>height, :selectmode=>:browse) init_pics('help-*') if $Version_1_1_OrLater t.column_create(:text=>'Help Contents') else # TreeCtrl 1.0 t.column_configure(0, :text=>'Help Contents') end # Define a new item state t.state_define('mouseover') t.element_create('e1', :image, :image=>@images['help-page']) t.element_create('e2', :image, :image=>[ @images['help-book-open'], ['open'], @images['help-book-closed'], [], ]) t.element_create('e3', :text, :font=>[t.font.dup.underline(true), ['mouseover']], :fill=>[ @SystemHighlightText, ['selected', 'focus'], 'blue', ['mouseover'] ]) t.element_create('e4', :rect, :showfocus=>true, :fill=>[@SystemHighlight, ['selected', 'focus']]) # book s = t.style_create('s1') t.style_elements(s, ['e4', 'e1', 'e3']) t.style_layout(s, 'e1', :padx=>[0,4], :expand=>:ns) t.style_layout(s, 'e3', :expand=>:ns) t.style_layout(s, 'e4', :union=>['e3'], :iexpand=>:ns, :ipadx=>2) # page s = t.style_create('s2') t.style_elements(s, ['e4', 'e2', 'e3']) t.style_layout(s, 'e2', :padx=>[0,4], :expand=>:ns) t.style_layout(s, 'e3', :expand=>:ns) t.style_layout(s, 'e4', :union=>['e3'], :iexpand=>:ns, :ipadx=>2) parentList = [:root, '', '', '', '', '', ''] parent = :root [ [0, 's1', "Welcome to Help"], [0, 's2', "Introducing Windows 98"], [1, 's2', "How to Use Help"], [2, 's1', "Find a topic"], [2, 's1', "Get more out of help"], [1, 's2', "Register Your Software"], [2, 's1', "Registering Windows 98 online"], [1, 's2', "What's New in Windows 98"], [2, 's1', "Innovative, easy-to-use features"], [2, 's1', "Improved reliability"], [2, 's1', "A faster operating system"], [2, 's1', "True Web integration"], [2, 's1', "More entertaining and fun"], [1, 's2', "If You're New to Windows 98"], [2, 's2', "Tips for Macintosh Users"], [3, 's1', "Why does the mouse have two buttons?"] ].each{|depth, style, text| item = t.item_create t.item_style_set(item, 0, style) t.item_element_configure(item, 0, 'e3', :text=>text) if $Version_1_1_OrLater t.item_collapse(item) else # TreeCtrl 1.0 t.collapse(item) end t.item_lastchild(parentList[depth], item) depth += 1 parentList[depth] = item } treeCtrlHelp = TkBindTag.new treeCtrlHelp.bind('Double-ButtonPress-1', proc{|w, x, y| if w.identify(x, y)[0] == 'header' Tk::TreeCtrl::BindCallback.doubleButton1(w, x, y) else helpButton1(w, x, y) end Tk.callback_break }, '%W %x %y') treeCtrlHelp.bind('ButtonPress-1', proc{|w, x, y| helpButton1(w, x, y) Tk.callback_break }, '%W %x %y') treeCtrlHelp.bind('Button1-Motion', proc{|w, x, y| helpMotion1(w, x, y) Tk.callback_break }, '%W %x %y') treeCtrlHelp.bind('Button1-Leave', proc{|w, x, y| helpLeave1(w, x, y) Tk.callback_break }, '%W %x %y') treeCtrlHelp.bind('ButtonRelease-1', proc{|w, x, y| helpRelease1(w, x, y) Tk.callback_break }, '%W %x %y') treeCtrlHelp.bind('Motion', proc{|w, x, y| helpMotion(w, x, y) }, '%W %x %y') treeCtrlHelp.bind('Leave', proc{|w, x, y| helpMotion(w, x, y) }, '%W %x %y') treeCtrlHelp.bind('KeyPress-Return', proc{|w, x, y| if w.selection_get.length == 1 if $Version_1_1_OrLater w.item_toggle(w.selection_get[0]) else # TreeCtrl 1.0 w.toggle(w.selection_get[0]) end end Tk.callback_break }, '%W %x %y') @Priv[:help, :prev] = '' t. = [ t, treeCtrlHelp, Tk::TreeCtrl, t.winfo_toplevel, :all ] end |
#demoHelpContents2(t) ⇒ Object
This is an alternate implementation that does not define a new item state to change the appearance of the item under the cursor.
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
# File 'sample/tkextlib/treectrl/help.rb', line 142 def demoHelpContents2(t) height = t.font.metrics(:linespace) height = 18 if height < 18 t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, :itemheight=>height, :selectmode=>:browse) init_pics('help-*') if $Version_1_1_OrLater t.column_create(:text=>'Help Contents') else # TreeCtrl 1.0 t.column_configure(0, :text=>'Help Contents') end t.element_create('e1', :image, :image=>@images['help-page']) t.element_create('e2', :image, :image=>[ @images['help-book-open'], ['open'], @images['help-book-closed'], [], ]) t.element_create('e3', :text, :fill=>[ @SystemHighlightText, ['selected', 'focus'], 'blue', [] ]) t.element_create('e4', :rect, :showfocus=>true, :fill=>[@SystemHighligh, ['selected', 'focus']]) t.element_create('e5', :text, :font=>t.font.dup.underline(true), :fill=>[ @SystemHighlightText, ['selected', 'focus'], 'blue', [] ]) # book s = t.style_create('s1') t.style_elements(s, ['e4', 'e1', 'e3']) t.style_layout(s, 'e1', :padx=>[0,4], :expand=>:ns) t.style_layout(s, 'e3', :expand=>:ns) t.style_layout(s, 'e4', :union=>['e3'], :iexpand=>:ns, :ipadx=>2) # page s = t.style_create('s2') t.style_elements(s, ['e4', 'e2', 'e3']) t.style_layout(s, 'e2', :padx=>[0,4], :expand=>:ns) t.style_layout(s, 'e3', :expand=>:ns) t.style_layout(s, 'e4', :union=>['e3'], :iexpand=>:ns, :ipadx=>2) # book (focus) s = t.style_create('s1.f') t.style_elements(s, ['e4', 'e1', 'e5']) t.style_layout(s, 'e1', :padx=>[0,4], :expand=>:ns) t.style_layout(s, 'e5', :expand=>:ns) t.style_layout(s, 'e4', :union=>['e5'], :iexpand=>:ns, :ipadx=>2) # page (focus) s = t.style_create('s2') t.style_elements(s, ['e4', 'e2', 'e5']) t.style_layout(s, 'e2', :padx=>[0,4], :expand=>:ns) t.style_layout(s, 'e5', :expand=>:ns) t.style_layout(s, 'e4', :union=>['e5'], :iexpand=>:ns, :ipadx=>2) parentList = [:root, '', '', '', '', '', ''] parent = :root [ [0, 's1', "Welcome to Help"], [0, 's2', "Introducing Windows 98"], [1, 's2', "How to Use Help"], [2, 's1' "Find a topic"], [2, 's1', "Get more out of help"], [1, 's2', "Register Your Software"], [2, 's1', "Registering Windows 98 online"], [1, 's2', "What's New in Windows 98"], [2, 's1', "Innovative, easy-to-use features"], [2, 's1', "Improved reliability"], [2, 's1', "A faster operating system"], [2, 's1', "True Web integration"], [2, 's1', "More entertaining and fun"], [1, 's2', "If You're New to Windows 98"], [2, 's2', "Tips for Macintosh Users"], [3, 's1', "Why does the mouse have two buttons?"] ].each{|depth, style, text| item = t.item_create t.item_style_set(item, 0, style) t.item_element_configure(item, 0, 'e3', :text=>text) if $Version_1_1_OrLater t.item_collapse(item) else # TreeCtrl 1.0 t.collapse(item) end t.item_lastchild(parentList[depth], item) depth += 1 parentList[depth] = item } treeCtrlHelp = TkBindTag.new treeCtrlHelp.bind('Double-ButtonPress-1', proc{|w, x, y| if w.identify(x, y)[0] == 'header' Tk::TreeCtrl::BindCallback.doubleButton1(w, x, y) else helpButton1(w, x, y) end Tk.callback_break }, '%W %x %y') treeCtrlHelp.bind('ButtonPress-1', proc{|w, x, y| helpButton1(w, x, y) Tk.callback_break }, '%W %x %y') treeCtrlHelp.bind('Button1-Motion', proc{|w, x, y| helpMotion1(w, x, y) Tk.callback_break }, '%W %x %y') treeCtrlHelp.bind('Button1-Leave', proc{|w, x, y| helpLeave1(w, x, y) Tk.callback_break }, '%W %x %y') treeCtrlHelp.bind('ButtonRelease-1', proc{|w, x, y| helpRelease1(w, x, y) Tk.callback_break }, '%W %x %y') treeCtrlHelp.bind('Motion', proc{|w, x, y| helpMotion(w, x, y) }, '%W %x %y') treeCtrlHelp.bind('Leave', proc{|w, x, y| helpMotion(w, x, y) }, '%W %x %y') treeCtrlHelp.bind('KeyPress-Return', proc{|w, x, y| if w.selection_get.length == 1 w.item_toggle(w.selection_get[0]) end Tk.callback_break }, '%W %x %y') @Priv[:help, :prev] = '' t. = [ t, treeCtrlHelp, Tk::TreeCtrl, t.winfo_toplevel, :all ] end |
#demoIMovie(t) ⇒ Object
frozen_string_literal: false
Demo: iMovie
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'sample/tkextlib/treectrl/imovie.rb', line 5 def demoIMovie(t) t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, :selectmode=>:browse, :orient=>:horizontal, :wrap=>:window, :showheader=>false, :background=>'#dcdcdc') if $HasColumnCreate t.column_create end init_pics('imovie-*') case @thisPlatform when 'macintosh', 'macosx' font1 = TkFont.new(['Geneva', 9]) font2 = TkFont.new(['Geneva', 10]) when 'unix' font1 = TkFont.new(['Helvetica', -12]) font2 = TkFont.new(['Helvetica', -14]) else font1 = TkFont.new(['Helvetica', 8]) font2 = TkFont.new(['Helvetica', 10]) end t.element_create('elemTime', :text, :font=>font1) t.element_create('elemName', :text, :font=>font2, :lines=>1, :width=>80) t.element_create('elemRect', :rect, :outline=>'#827878', :outlinewidth=>1, :fill=>['#ffdc5a', ['selected'], 'white', []]) t.element_create('elemImg', :image) t.element_create('elemShadow', :rect, :outline=>'gray', :outlinewidth=>1, :open=>:wn) s = t.style_create('STYLE', :orient=>:vertical) t.style_elements(s, [ 'elemShadow', 'elemRect', 'elemTime', 'elemImg', 'elemName' ]) t.style_layout(s, 'elemShadow', :detach=>true, :padx=>[1,2], :pady=>[1,2], :iexpand=>:es) t.style_layout(s, 'elemTime', :padx=>[2,0]) t.style_layout(s, 'elemImg', :pady=>[0,1]) t.style_layout(s, 'elemName', :expand=>:we, :ipady=>[0,2], :padx=>[0,3], :squeeze=>:x) t.style_layout(s, 'elemRect', :union=>['elemTime', 'elemImg', 'elemName'], :ipadx=>6, :padx=>[0,3], :pady=>[0,3]) # Set default item style if $Version_1_1_OrLater t.defaultstyle([s]) end (0..4).each{|i| [ ['15:20', 'Clip 1', @images['imovie-01']], ['19:18', 'Clip 2', @images['imovie-02']], ['07:20', 'Clip 3', @images['imovie-03']], ['07:20', 'Clip 4', @images['imovie-04']], ['07:20', 'Clip 5', @images['imovie-05']], ['07:20', 'Clip 6', @images['imovie-06']], ['07:20', 'Clip 7', @images['imovie-07']] ].each{|time, name, image| item = t.item_create unless $Version_1_1_OrLater t.item_style_set(item, 0, s) end t.item_element_configure(item, 0, 'elemTime', :text=>time) t.item_element_configure(item, 0, 'elemName', :text=>name) t.item_element_configure(item, 0, 'elemImg', :image=>image) t.item_lastchild(:root, item) } } t.notify_bind(t, 'Edit-accept', proc{|w, i, c, e, tt| w.item_element_configure(i, c, e, :text=>tt) }, '%T %I %C %E %t') iMovie = TkBindTag.new iMovie.bind('ButtonPress-1', proc{|w, x, y| iMovieButton1(w, x, y) }, '%W %x %y') t. = [t, iMovie, Tk::TreeCtrl, t.winfo_toplevel, TkBindTag::ALL] end |
#demoInternetOptions(t) ⇒ Object
frozen_string_literal: false
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'sample/tkextlib/treectrl/www-options.rb', line 2 def demoInternetOptions (t) @Option = TkVarAccess.new_hash('::Option') height = t.font.metrics(:linespace) + 2 height = 18 if height < 18 t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, :itemheight=>height, :selectmode=>:browse) init_pics('internet-*') if $HasColumnCreate t.column_create(:text=>'Internet Options') else t.column_configure(0, :text=>'Internet Options') end t.state_define('check') t.state_define('radio') t.state_define('on') t.element_create('e1', :image, :image=>[ @images['internet-check-on'], ['check', 'on'], @images['internet-check-off'], ['check'], @images['internet-radio-on'], ['radio', 'on'], @images['internet-radio-off'], ['radio'] ]) t.element_create('e2', :text, :fill=>[@SystemHighlightText, ['selected', 'focus']]) t.element_create('e3', :rect, :showfocus=>true, :fill=>[@SystemHighlight, ['selected', 'focus']]) s = t.style_create('s1') t.style_elements(s, ['e3', 'e1', 'e2']) t.style_layout(s, 'e1', :padx=>[0,4], :expand=>:ns) t.style_layout(s, 'e2', :expand=>:ns) t.style_layout(s, 'e3', :union=>['e2'], :iexpand=>:ns, :ipadx=>2) parentList = [:root, '', '', '', '', '', ''] parent = :root [ [0, :print, "Printing", "", ""], [1, :off, "Print background colors and images", "o1", ""], [0, :search, "Search from Address bar", "", ""], [1, :search, "When searching", "", ""], [2, :off, "Display results, and go to the most likely sites", "o2", "r1"], [2, :off, "Do not search from the Address bar", "o3", "r1"], [2, :off, "Just display the results in the main window", "o4", "r1"], [2, :on, "Just go to the most likely site", "o5", "r1"], [0, :security, "Security", "", ""], [1, :on, "Check for publisher's certificate revocation", "o5", ""], [1, :off, "Check for server certificate revocation (requires restart)", "o6", ""] ].each{|depth, setting, text, option, group| item = t.item_create() t.item_style_set(item, 0, 's1') t.item_element_configure(item, 0, 'e2', :text=>text) @Option[:option, item] = option @Option[:group, item] = group if setting == :on || setting == :off @Option[:setting, item] = setting if group == '' t.item_state_set(item, 'check') if setting == :on t.item_state_set(item, 'on') end else if setting == :on @Option[:current, group] = item t.item_state_set(item, 'on') end t.item_state_set(item, 'radio') end else t.item_element_configure(item, 0, 'e1', :image=>@images["internet-#{setting}"]) end t.item_lastchild(parentList[depth], item) depth += 1 parentList[depth] = item } treeCtrlOption = TkBindTag.new treeCtrlOption.bind('Double-ButtonPress-1', proc{|w, x, y| Tk::TreeCtrl::BindCallback.doubleButton1(w, x, y) }, '%W %x %y') treeCtrlOption.bind('ButtonPress-1', proc{|w, x, y| optionButton1(w, x, y) Tk.callback_break }, '%W %x %y') treeCtrlOption.bind('Button1-Motion', proc{|w, x, y| optionMotion1(w, x, y) Tk.callback_break }, '%W %x %y') treeCtrlOption.bind('Button1-Leave', proc{|w, x, y| optionLeave1(w, x, y) Tk.callback_break }, '%W %x %y') treeCtrlOption.bind('ButtonRelease-1', proc{|w, x, y| optionRelease1(w, x, y) Tk.callback_break }, '%W %x %y') t. = [ t, treeCtrlOption, Tk::TreeCtrl, t.winfo_toplevel, TkBindTag::ALL ] end |
#demoInternetOptions_2(t) ⇒ Object
Alternate implementation that doesn’t rely on run-time styles
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 |
# File 'sample/tkextlib/treectrl/www-options.rb', line 147 def demoInternetOptions_2(t) height = t.font.metrics(:linespace) + 2 height = 18 if height < 18 t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, :itemheight=>height, :selectmode=>:browse) init_pics('internet-*') t.column_configure(0, :text=>'Internet Options') t.element_create('e1', :image) t.element_create('e2', :text, :fill=>[@SystemHighlightText, ['selected', 'focus']]) t.element_create('e3', :rect, :showfocus=>true, :fill=>[@SystemHighlight, ['selected', 'focus']]) s = t.style_create('s1') t.style_elements('s1', ['e3', 'e1', 'e2']) t.style_layout(s, 'e1', :padx=>[0,4], :expand=>:ns) t.style_layout(s, 'e2', :expand=>:ns) t.style_layout(s, 'e3', :union=>['e2'], :iexpand=>:ns, :ipadx=>2) parentList = [:root, '', '', '', '', '', ''] parent = :root [ [0, :print, "Printing", "", ""], [1, :off, "Print background colors and images", "o1", ""], [0, :search, "Search from Address bar", "", ""], [1, :search, "When searching", "", ""], [2, :off, "Display results, and go to the most likely sites", "o2", "r1"], [2, :off, "Do not search from the Address bar", "o3", "r1"], [2, :off, "Just display the results in the main window", "o4", "r1"], [2, :on, "Just go to the most likely site", "o5", "r1"], [0, :security, "Security", "", ""], [1, :on, "Check for publisher's certificate revocation", "o5", ""], [1, :off, "Check for server certificate revocation (requires restart)", "o6", ""] ].each{|depth, setting, text, option, group| item = t.item_create() t.item_style_set(item, 0, 's1') t.item_element_configure(item, 0, 'e2', :text=>text) @Option[:option, item] = option @Option[:group, item] = group if setting == :on || setting == :off @Option[:setting, item] = setting if group == '' img = @images["internet-check-#{setting}"] t.item_element_configure(item, 0, 'e1', :image=>img) else if setting == :on @Option[:current, group] = item end img = @images["internet-radio-#{setting}"] t.item_element_configure(item, 0, 'e1', :image=>img) end else t.item_element_configure(item, 0, 'e1', :image=>@images["internet-#{setting}"]) end t.item_lastchild(parentList[depth], item) depth += 1 parentList[depth] = item } treeCtrlOption = TkBindTag.new treeCtrlOption.bind('Double-ButtonPress-1', proc{|w, x, y| Tk::TreeCtrl::BindCallback.doubleButton1(w, x, y) }, '%W %x %y') treeCtrlOption.bind('ButtonPress-1', proc{|w, x, y| optionButton1(w, x, y) Tk.callback_break }, '%W %x %y') treeCtrlOption.bind('Button1-Motion', proc{|w, x, y| optionMotion1(w, x, y) Tk.callback_break }, '%W %x %y') treeCtrlOption.bind('Button1-Leave', proc{|w, x, y| optionLeave1(w, x, y) Tk.callback_break }, '%W %x %y') treeCtrlOption.bind('ButtonRelease-1', proc{|w, x, y| optionRelease1(w, x, y) Tk.callback_break }, '%W %x %y') t. = [ t, treeCtrlOption, Tk::TreeCtrl, t.winfo_toplevel, TkBindTag::ALL ] end |
#demoLayout(t) ⇒ Object
frozen_string_literal: false
Demo: Layout
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'sample/tkextlib/treectrl/layout.rb', line 5 def demoLayout(t) t.configure(:showroot=>false, :showrootbutton=>true, :showbuttons=>true, :showlines=>true, :itemheight=>0, :selectmode=>:browse) if $HasColumnCreate t.column_create(:text=>'Layout') else t.column_configure(0, :text=>'Layout') end t.element_create('e1', :rect, :width=>30, :height=>30, :fill=>'gray20') t.element_create('e2', :rect, :width=>30, :height=>30, :fill=>'gray40', :outline=>'blue', :outlinewidth=>3) t.element_create('e3', :rect, :fill=>'gray60') t.element_create('e4', :rect, :showfocus=>true, :fill=>[ @SystemHighlight, ['selected', 'focus'], 'gray80', [] ]) t.element_create('e5', :rect, :fill=>'{sky blue}', :width=>20, :height=>20) t.element_create('e6', :rect, :fill=>'{sea green}', :width=>30, :height=>16) t.element_create('e7', :rect, :fill=>'{sky blue}', :width=>30, :height=>16) t.element_create('e8', :rect, :fill=>'gray70', :height=>1) s = t.style_create('s1') t.style_elements(s, ['e4', 'e3', 'e1', 'e2', 'e5', 'e6', 'e7']) t.style_layout(s, 'e1', :padx=>[28, 4], :pady=>4) t.style_layout(s, 'e2', :expand=>:es, :padx=>[0, 38]) t.style_layout(s, 'e3', :union=>['e1', 'e2'], :ipadx=>4, :ipady=>4, :pady=>2) t.style_layout(s, 'e4', :detach=>true, :iexpand=>:es) t.style_layout(s, 'e5', :detach=>true, :padx=>[2,0], :pady=>2, :iexpand=>:s) t.style_layout(s, 'e6', :detach=>true, :expand=>:ws, :padx=>[0,2], :pady=>[2,0]) t.style_layout(s, 'e7', :detach=>true, :expand=>:wn, :padx=>[0,2], :pady=>[0,2]) if $Version_1_1_OrLater i = t.item_create(:button=>true) else i = t.item_create t.(i, true) end t.item_style_set(i, 0, s) t.item_lastchild(:root, i) parent = i i = t.item_create() unless $Version_1_1_OrLater t.(i, false) end t.item_style_set(i, 0, s) t.item_lastchild(parent, i) ### s = t.style_create('s2') t.style_elements(s, ['e4', 'e3', 'e1']) t.style_layout(s, 'e1', :padx=>8, :pady=>8, :iexpand=>:e) t.style_layout(s, 'e3', :union=>['e1'], :ipadx=>[20,4], :ipady=>[4,12]) t.style_layout(s, 'e4', :detach=>true, :iexpand=>:es) if $Version_1_1_OrLater i = t.item_create(:button=>true) else i = t.item_create t.(i, true) end t.item_style_set(i, 0, s) t.item_lastchild(:root, i) i2 = t.item_create() unless $Version_1_1_OrLater t.(i2, false) end t.item_style_set(i2, 0, s) t.item_lastchild(i, i2) ### s = t.style_create('s3') t.style_elements(s, ['e4', 'e3', 'e1', 'e5', 'e6']) t.style_layout(s, 'e4', :union=>['e1', 'e6'], :ipadx=>8, :ipady=>[8,0]) t.style_layout(s, 'e3', :union=>['e1', 'e5'], :ipadx=>4, :ipady=>4) t.style_layout(s, 'e5', :ipady=>[0,20]) if $Version_1_1_OrLater i = t.item_create(:button=>true) else i = t.item_create t.(i, true) end t.item_style_set(i, 0, s) t.item_lastchild(:root, i) i2 = t.item_create() unless $Version_1_1_OrLater t.(i2, false) end t.item_style_set(i2, 0, s) t.item_lastchild(i, i2) ### t.element_create('eb', :border, :background=>@SystemButtonFace, :relief=>[:sunken, ['selected'], :raised, []], :thickness=>2, :filled=>true) t.element_create('et', :text) text = "Here is a text element surrounded by a border element.\nResize the column to watch me wrap." s = t.style_create('e4') t.style_elements(s, ['eb', 'et']) t.style_layout(s, 'eb', :union=>['et'], :ipadx=>2, :ipady=>2) t.style_layout(s, 'et', :squeeze=>:x) if $Version_1_1_OrLater i = t.item_create(:button=>true) else i = t.item_create t.(i, true) end t.item_style_set(i, 0, s) t.item_text(i, 0, text) t.item_lastchild(:root, i) parent = i i = t.item_create() unless $Version_1_1_OrLater t.(i, false) end t.item_style_set(i, 0, s) t.item_text(i, 0, text) t.item_lastchild(parent, i) ### styleNum = 5 [ [:horizontal, [:s, :ns, :n]], [:vertical, [:e, :we, :w]] ].each{|orient, | .each{|| s = t.style_create("s#{styleNum}", :orient=>orient) t.style_elements(s, ['e4', 'e8', 'e2', 'e5', 'e6']) t.style_layout(s, 'e4', :detach=>true, :iexpand=>:es) t.style_layout(s, 'e8', :detach=>true, :expand=>:n, :iexpand=>:e) t.style_layout(s, 'e2', :expand=>) t.style_layout(s, 'e5', :expand=>) t.style_layout(s, 'e6', :expand=>) styleNum += 1 i = t.item_create() t.item_style_set(i, 0, s) t.item_lastchild(:root, i) } } end |
#demoMailWasher(t) ⇒ Object
frozen_string_literal: false
Demo: MailWasher
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
# File 'sample/tkextlib/treectrl/mailwasher.rb', line 5 def demoMailWasher(t) init_pics('*checked') height = t.font.metrics(:linespace) + 2 height = 18 if height < 18 t.configure(:showroot=>false, :showrootbutton=>false, :showbuttons=>false, :showlines=>false, :itemheight=>height, :selectmode=>:browse, :xscrollincrement=>1) pad = 4 if $Version_1_1_OrLater t.column_create(:text=>'Delete', :textpadx=>pad, :tag=>'delete') t.column_create(:text=>'Bounce', :textpadx=>pad, :tag=>'bounce') t.column_create(:text=>'Status', :width=>80, :textpadx=>pad, :tag=>'status') t.column_create(:text=>'Size', :width=>40, :textpadx=>pad, :justify=>:right, :tag=>'size') t.column_create(:text=>'From', :width=>140, :textpadx=>pad, :tag=>'from') t.column_create(:text=>'Subject', :width=>240, :textpadx=>pad, :tag=>'subject') t.column_create(:text=>'Received', :textpadx=>pad, :arrow=>:up, :arrowpad=>[4,0], :tag=>'received') t.column_create(:text=>'Attachments', :textpadx=>pad, :tag=>'attachments') t.state_define('CHECK') t.element_create('imgCheck', :image, :image=>[ @images['checked'], ['CHECK'], @images['unchecked'], [] ]) else # TreeCtrl 1.0 t.column_configure(0, :text=>'Delete', :textpadx=>pad, :tag=>'delete') t.column_configure(1, :text=>'Bounce', :textpadx=>pad, :tag=>'bounce') t.column_configure(2, :text=>'Status', :width=>80, :textpadx=>pad, :tag=>'status') t.column_configure(3, :text=>'Size', :width=>40, :textpadx=>pad, :justify=>:right, :tag=>'size') t.column_configure(4, :text=>'From', :width=>140, :textpadx=>pad, :tag=>'from') t.column_configure(5, :text=>'Subject', :width=>240, :textpadx=>pad, :tag=>'subject') t.column_configure(6, :text=>'Received', :textpadx=>pad, :arrow=>:up, :arrowpad=>[4,0], :tag=>'received') t.column_configure(7, :text=>'Attachments', :textpadx=>pad, :tag=>'attachments') t.element_create('imgOff', :image, :image=>@images['unchecked']) t.element_create('imgOn', :image, :image=>@images['checked']) end t.element_create('border', :rect, :open=>:nw, :outline=>'gray', :outlinewidth=>1, :fill=>[@SystemHighlight, ['selected']]) t.element_create('txtAny', :text, :lines=>1, :fill=>[@SystemHighlightText, ['selected']]) t.element_create('txtNone', :text, :text=>'none', :lines=>1, :fill=>[@SystemHighlightText, ['selected']]) t.element_create('txtYes', :text, :text=>'yes', :lines=>1, :fill=>[@SystemHighlightText, ['selected']]) t.element_create('txtNormal', :text, :text=>'Normal', :lines=>1, :fill=>[@SystemHighlightText, ['selected'], '#006800', []]) t.element_create('txtPossSpam', :text, :text=>'Possible Spam', :lines=>1, :fill=>[@SystemHighlightText, ['selected'], '#787800', []]) t.element_create('txtProbSpam', :text, :text=>'Probably Spam', :lines=>1, :fill=>[@SystemHighlightText, ['selected'], '#FF9000', []]) t.element_create('txtBlacklist', :text, :text=>'Blacklisted', :lines=>1, :fill=>[@SystemHighlightText, ['selected'], '#FF5800', []]) if $Version_1_1_OrLater s = t.style_create('styCheck') t.style_elements(s, ['border', 'imgCheck']) t.style_layout(s, 'border', :detach=>true, :iexpand=>:es) t.style_layout(s, 'imgCheck', :expand=>:news) else ['Off', 'On'].each{|name| s = t.style_create('sty' << name) i = 'img' << name t.style_elements(s, ['border', i]) t.style_layout(s, 'border', :detach=>true, :iexpand=>:es) t.style_layout(s, i, :expand=>:news) } end pad = 4 %w(Any None Yes Normal PossSpam ProbSpam Blacklist).each{|name| s = t.style_create('sty' << name) e = 'txt' << name t.style_elements(s, ['border', e]) t.style_layout(s, 'border', :detach=>true, :iexpand=>:es) t.style_layout(s, e, :padx=>pad, :squeeze=>:x, :expand=>:ns) } [ ['[email protected]', "Your hair is thinning"], ['[email protected]', "Your breasts are too small"], ['[email protected]', "Your penis is too small"], ['[email protected]', "You are not very smart"], ['[email protected]', "You need more money"], ['[email protected]', "You need better friends"], ['[email protected]', "Find out what your coworkers think about you"], ['[email protected]', "Find out what you think about yourself"], ['[email protected]', "You need a better job"], ['[email protected]', "Your mortgage is a joke"], ['[email protected]', "You need more spam"] ].each{|frm, subj| item = t.item_create status = ['styNormal','styPossSpam','styProbSpam','styBlacklist'][rand(4)] = ['styNone','styYes'][rand(2)] if $Version_1_1_OrLater delete = [false, true][rand(2)] bounce = [false, true][rand(2)] t.item_style_set(item, 0, 'styCheck', 1, 'styCheck', 2, status, 3, 'styAny', 4, 'styAny', 5, 'styAny', 6, 'styAny', 7, ) t.item_state_forcolumn(item, 'delete', 'CHECK') if delete t.item_state_forcolumn(item, 'bounce', 'CHECK') if bounce else # TreeCtrl 1.0 delete = ['styOn', 'styOff'][rand(2)] bounce = ['styOn', 'styOff'][rand(2)] t.item_style_set(item, 0, delete, 1, bounce, 2, status, 3, 'styAny', 4, 'styAny', 5, 'styAny', 6, 'styAny', 7, ) end bytes = 512 + rand(1024 * 12) size = "#{bytes / 1024 + 1}KB" seconds = Tk::Clock.seconds - rand(100000) received = Tk::Clock.format(seconds, '%d/%m/%y %I:%M %p') t.item_text(item, 3, size, 4, frm, 5, subj, 6, received) t.item_lastchild(:root, item) } sortColumn = 6 t.notify_bind(t, 'Header-invoke', proc{|c, w| if c == sortColumn if w.column_cget(sortColumn, :arrow) == 'down' order = :increasing arrow = :up else order = :decreasing arrow = :down end else if w.column_cget(sortColumn, :arrow) == 'down' order = :decreasing arrow = :down else order = :increasing arrow = :up end w.column_configure(sortColumn, :arrow=>:none) sortColumn = c end w.column_configure(c, :arrow=>arrow) case w.column_cget(c, :tag) when 'bounce', 'delete' w.item_sort(:root, order, { :column=>c, :command=>proc{|item1, item2| compareOnOff(w, c, item1, item2) } }, { :column=>'subject', :dictionary=>true }) when 'status' w.item_sort(:root, order, { :column=>c, :dictionary=>true }) when 'from' w.item_sort(:root, order, { :column=>c, :dictionary=>true }, { :column=>'subject', :dictionary=>true }) when 'subject' w.item_sort(:root, order, { :column=>c, :dictionary=>true }) when 'size' w.item_sort(:root, order, { :column=>c, :dictionary=>true }, { :column=>'subject', :dictionary=>true }) when 'received' w.item_sort(:root, order, { :column=>c, :dictionary=>true }, { :column=>'subject', :dictionary=>true }) when 'attachments' w.item_sort(:root, order, { :column=>c, :dictionary=>true }, { :column=>'subject', :dictionary=>true }) end }, '%C %T') mailWasher = TkBindTag.new if $Version_1_1_OrLater mailWasher.bind('ButtonPress-1', proc{|w, x, y| id = w.identify(x, y) if id.empty? elsif id[0] == 'header' else what, item, where, arg1, arg2, arg3 = id if where == 'column' tag = w.column_cget(arg1, :tag) if tag == 'delete' || tag == 'bounce' w.item_state_forcolumn(item, arg1, '~CHECK') end end end }, '%W %x %y') else # TreeCtrl 1.0 mailWasher.bind('ButtonPress-1', proc{|w, x, y| id = w.identify(x, y) if id.empty? elsif id[0] == 'header' else what, item, where, arg1, arg2, arg3 = id if where == 'column' tag = w.column_cget(arg1, :tag) if tag == 'delete' || tag == 'bounce' style = w.item_style_set(item, arg1) if style == 'styOn' style = 'styOff' else style = 'styOn' end w.item_style_set(item, arg1, style) @display_styles_in_item.call(item) end end end }, '%W %x %y') end t. = [t, mailWasher, Tk::TreeCtrl, t.winfo_toplevel, TkBindTag::ALL] end |
#demoOutlookFolders(t) ⇒ Object
frozen_string_literal: false
Demo: Outlook Express folder list
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'sample/tkextlib/treectrl/outlook-folders.rb', line 5 def demoOutlookFolders(t) init_pics('outlook-*') height = t.font.metrics(:linespace) + 2 height = 18 if height < 18 t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>true, :showroot=>true, :showrootbutton=>false, :showbuttons=>true) if $HasColumnCreate t.column_create(:text=>'Folders') else t.column_configure(0, :text=>'Folders') end t.element_create('e1', :image) t.element_create('e2', :text, :lines=>1, :fill=>[@SystemHighlightText, ['selected', 'focus']]) t.element_create('e3', :text, :lines=>1, :font=>t.font.dup.weight(:bold), :fill=>[@SystemHighlightText, ['selected', 'focus']]) t.element_create('e4', :text, :fill=>'blue') t.element_create('e5', :image, :image=>@images['outlook-folder']) t.element_create('e6', :rect, :showfocus=>true, :fill=>[ @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) # image + text s = t.style_create('s1') t.style_elements(s, ['e6', 'e1', 'e2']) t.style_layout(s, 'e1', :expand=>:ns) t.style_layout(s, 'e2', :padx=>[4,0], :expand=>:ns, :squeeze=>:x) t.style_layout(s, 'e6', :union=>['e2'], :iexpand=>:ns, :ipadx=>2) # image + text + text s = t.style_create('s2') t.style_elements(s, ['e6', 'e1', 'e3', 'e4']) t.style_layout(s, 'e1', :expand=>:ns) t.style_layout(s, 'e3', :padx=>4, :expand=>:ns, :squeeze=>:x) t.style_layout(s, 'e4', :expand=>:ns) t.style_layout(s, 'e6', :union=>['e3'], :iexpand=>:ns, :ipadx=>2) # folder + text s = t.style_create('s3') t.style_elements(s, ['e6', 'e5', 'e2']) t.style_layout(s, 'e5', :expand=>:ns) t.style_layout(s, 'e2', :padx=>[4,0], :expand=>:ns, :squeeze=>:x) t.style_layout(s, 'e6', :union=>['e2'], :iexpand=>:ns, :ipadx=>2) # folder + text + text s = t.style_create('s4') t.style_elements(s, ['e6', 'e5', 'e3', 'e4']) t.style_layout(s, 'e5', :expand=>:ns) t.style_layout(s, 'e3', :padx=>4, :expand=>:ns, :squeeze=>:x) t.style_layout(s, 'e4', :expand=>:ns) t.style_layout(s, 'e6', :union=>['e3'], :iexpand=>:ns, :ipadx=>2) t.item_style_set(:root, 0, 's1') t.item_complex(:root, [ ['e1', {:image=>@images['outlook-main']}], ['e2', {:text=>'Outlook Express'}] ]) parentList = [:root, '', '', '', '', '', ''] parent = :root [ [0, :local, "Local Folders", true, 0], [1, :inbox, 'Inbox', false, 5], [1, :outbox, 'Outbox', false, 0], [1, :sent, "Sent Items", false, 0], [1, :deleted, "Deleted Items", false, 50], [1, :draft, 'Drafts', false, 0], [1, :folder, "Messages to Dad", false, 0], [1, :folder, "Messages to Sis", false, 0], [1, :folder, "Messages to Me", false, 0], [2, :folder, "2001", false, 0], [2, :folder, "2000", false, 0], [2, :folder, "1999", false, 0], [0, :server, "news.gmane.org", true, 0], [1, :group, "gmane.comp.lang.lua.general", false, 498] ].each{|depth, img, text, , unread| if $Version_1_1_OrLater item = t.item_create(:button=>) else item = t.item_create t.(item, ) end if img == :folder if unread != 0 t.item_style_set(item, 0, 's4') t.item_complex(item, [['e3', {:text=>text}], ['e4', {:text=>"(#{unread})"}]]) else t.item_style_set(item, 0, 's3') t.item_complex(item, [['e2', {:text=>text}]]) end else if unread != 0 t.item_style_set(item, 0, 's2') t.item_complex(item, [ ['e1', {:image=>@images["outlook-#{img}"]}], ['e3', {:text=>text}], ['e4', {:text=>"(#{unread})"}] ]) else t.item_style_set(item, 0, 's1') t.item_complex(item, [ ['e1', {:image=>@images["outlook-#{img}"]}], ['e2', {:text=>text}] ]) end end t.item_lastchild(parentList[depth], item) depth += 1 parentList[depth] = item } end |
#demoOutlookNewsgroup(t) ⇒ Object
frozen_string_literal: false
Demo: Outlook Express newsgroup messages
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'sample/tkextlib/treectrl/outlook-newgroup.rb', line 5 def demoOutlookNewsgroup(t) init_pics('outlook-*') height = t.font.metrics(:linespace) height = 18 if height < 18 t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>false, :showroot=>false, :showrootbutton=>false, :showbuttons=>true) if $Version_1_1_OrLater t.column_create(:image=>@images['outlook-clip'], :tag=>'clip') t.column_create(:image=>@images['outlook-arrow'], :tag=>'arrow') t.column_create(:image=>@images['outlook-watch'], :tag=>'watch') t.column_create(:text=>'Subject', :width=>250, :tag=>'subject') t.column_create(:text=>'From', :width=>150, :tag=>'from') t.column_create(:text=>'Sent', :width=>150, :tag=>'sent') t.column_create(:text=>'Size', :width=>60, :justify=>:right, :tag=>'size') else # TreeCtrl 1.0 t.column_configure(0, :image=>@images['outlook-clip'], :tag=>'clip') t.column_configure(1, :image=>@images['outlook-arrow'], :tag=>'arrow') t.column_configure(2, :image=>@images['outlook-watch'], :tag=>'watch') t.column_configure(3, :text=>'Subject', :width=>250, :tag=>'subject') t.column_configure(4, :text=>'From', :width=>150, :tag=>'from') t.column_configure(5, :text=>'Sent', :width=>150, :tag=>'sent') t.column_configure(6, :text=>'Size', :width=>60, :justify=>:right, :tag=>'size') end # Would be nice if I could specify a column -tag too t.treecolumn = 3 # State for a read message t.state_define('read') # State for a message with unread descendants t.state_define('unread') t.element_create('elemImg', :image, :image=>[ @sel_images['outlook-read-2'], ['selected', 'read', 'unread', '!open'], @images['outlook-read-2'], ['read', 'unread', '!open'], @sel_images['outlook-read'], ['selected', 'read'], @images['outlook-read'], ['read'], @sel_images['outlook-unread'], ['selected'], @images['outlook-unread'], [] ]) t.element_create('elemTxt', :text, :lines=>1, :fill=>[@SystemHighlightText, ['selected', 'focus']], :font=>[ t.font.dup.weight(:bold), ['read', 'unread', '!open'], t.font.dup.weight(:bold), ['!read'] ]) t.element_create('sel.e', :rect, :open=>:e, :showfocus=>true, :fill=>[ @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) t.element_create('sel.w', :rect, :open=>:w, :showfocus=>true, :fill=>[ @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) t.element_create('sel.we', :rect, :open=>:we, :showfocus=>true, :fill=>[ @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) # Image + text s = t.style_create('s1') t.style_elements(s, ['sel.e', 'elemImg', 'elemTxt']) t.style_layout(s, 'elemImg', :expand=>:ns) t.style_layout(s, 'elemTxt', :padx=>[2,6], :squeeze=>:x, :expand=>:ns) t.style_layout(s, 'sel.e', :union=>['elemTxt'], :iexpand=>:nes, :ipadx=>[2,0]) # Text s = t.style_create('s2.we') t.style_elements(s, ['sel.we', 'elemTxt']) t.style_layout(s, 'elemTxt', :padx=>6, :squeeze=>:x, :expand=>:ns) t.style_layout(s, 'sel.we', :detach=>true, :iexpand=>:es) # Text s = t.style_create('s2.w') t.style_elements(s, ['sel.w', 'elemTxt']) t.style_layout(s, 'elemTxt', :padx=>6, :squeeze=>:x, :expand=>:ns) t.style_layout(s, 'sel.w', :detach=>true, :iexpand=>:es) # Set default item style if $Version_1_1_OrLater t.defaultstyle = ['', '', '', 's1', 's2.we', 's2.we', 's2.w'] end msgCnt = 100 thread = 0 @Message = Hash.new{|k, v| k[v] = Hash.new} @Message[:count][0] = 0 items = [t.index(:root)] (1...(msgCnt)).each{|i| item_i = t.item_create item_j = nil j = nil loop { j = rand(i) item_j = items[j] break if j == 0 next if t.depth(item_j) == 5 next if @Message[:count][@Message[:thread][item_j]] == 15 break } t.item_lastchild(item_j, item_i) @Message[:read][item_i] = (rand(2) == 0) if j == 0 thread += 1 @Message[:thread][item_i] = thread @Message[:seconds][item_i] = (Tk::Clock.seconds - rand(500000)) @Message[:seconds2][item_i] = @Message[:seconds][item_i] @Message[:count][thread] = 1 else @Message[:thread][item_i] = @Message[:thread][item_j] @Message[:seconds][item_i] = (@Message[:seconds2][item_j] + rand(10000)) @Message[:seconds2][item_i] = @Message[:seconds][item_i] @Message[:seconds2][item_j] = @Message[:seconds][item_i] @Message[:count][@Message[:thread][item_j]] += 1 end items << item_i } (1...(msgCnt)).each{|i| item_i = items[i] subject = "This is thread number #{@Message[:thread][item_i]}" from = '[email protected]' sent = Tk::Clock.format(@Message[:seconds][item_i], "%d/%m/%y %I:%M %p") size = "#{1 + rand(10)}KB" # This message has been read t.item_state_set(item_i, 'read') if @Message[:read][item_i] # This message has unread descendants t.item_state_set(item_i, 'unread') if anyUnreadDescendants(t, item_i) if t.item_numchildren(item_i) > 0 if $Version_1_1_OrLater t.item_configure(item_i, :button=>true) else # TreeCtrl 1.0 t.(item_i, true) end # Collapse some messages if $Version_1_1_OrLater t.item_collapse(item_i) if rand(2) == 0 else # TreeCtrl 1.0 t.collapse(item_i) if rand(2) == 0 end end unless $Version_1_1_OrLater t.item_style_set(item_i, 3, 's1', 4, 's2.we', 5, 's2.we', 6, 's2.w') end t.item_text(item_i, 3, subject, 4, from, 5, sent, 6, size) } # Do something when the selection changes t.notify_bind(t, 'Selection', proc{|w| if w.selection_count == 1 # One item is selected if @Message[:afterId][:id] Tk.after_cancel(@Message[:afterId][:id]) end @Message[:afterId][:item] = w.selection_get[0] @Message[:afterId][:id] = Tk.after(500, proc{ (w) }) end }, '%T') end |
#demoOutlookNewsgroup2(t) ⇒ Object
Alternate implementation which does not rely on run-time states
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 |
# File 'sample/tkextlib/treectrl/outlook-newgroup.rb', line 207 def demoOutlookNewsgroup2(t) init_pics('outlook-*') height = t.font.metrics(:linespace) height = 18 if height < 18 t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>false, :showroot=>false, :showrootbutton=>false, :showbuttons=>true) if $Version_1_1_OrLater t.column_create(:image=>@images['outlook-clip'], :tag=>'clip') t.column_create(:image=>@images['outlook-arrow'], :tag=>'arrow') t.column_create(:image=>@images['outlook-watch'], :tag=>'watch') t.column_create(:text=>'Subject', :width=>250, :tag=>'subject') t.column_create(:text=>'From', :width=>150, :tag=>'from') t.column_create(:text=>'Sent', :width=>150, :tag=>'sent') t.column_create(:text=>'Size', :width=>60, :justify=>:right, :tag=>'size') else # TreeCtrl 1.0 t.column_configure(0, :image=>@images['outlook-clip'], :tag=>'clip') t.column_configure(1, :image=>@images['outlook-arrow'], :tag=>'arrow') t.column_configure(2, :image=>@images['outlook-watch'], :tag=>'watch') t.column_configure(3, :text=>'Subject', :width=>250, :tag=>'subject') t.column_configure(4, :text=>'From', :width=>150, :tag=>'from') t.column_configure(5, :text=>'Sent', :width=>150, :tag=>'sent') t.column_configure(6, :text=>'Size', :width=>60, :justify=>:right, :tag=>'size') end t.treecolumn = 3 t.element_create('image.unread', :image, :image=>@images['outlook-unread']) t.element_create('image.read', :image, :image=>@images['outlook-read']) t.element_create('image.read2', :image, :image=>@images['outlook-read-2']) t.element_create('text.read', :text, :lines=>1, :fill=>[@SystemHighlightText, ['selected', 'focus']]) t.element_create('text.unread', :text, :lines=>1, :fill=>[@SystemHighlightText, ['selected', 'focus']], :font=>t.font.dup.weight(:bold)) t.element_create('sel.e', :rect, :open=>:e, :showfocus=>true, :fill=>[ @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) t.element_create('sel.w', :rect, :open=>:w, :showfocus=>true, :fill=>[ @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) t.element_create('sel.we', :rect, :open=>:we, :showfocus=>true, :fill=>[ @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) # Image + text s = t.style_create('unread') t.style_elements(s, ['sel.e', 'image.unread', 'text.unread']) t.style_layout(s, 'image.unread', :expand=>:ns) t.style_layout(s, 'text.unread', :padx=>[2,6], :squeeze=>:x, :expand=>:ns) t.style_layout(s, 'sel.e', :union=>['text.unread'], :iexpand=>:nes, :ipadx=>[2,0]) # Image + text s = t.style_create('read') t.style_elements(s, ['sel.e', 'image.read', 'text.read']) t.style_layout(s, 'image.read', :expand=>:ns) t.style_layout(s, 'text.read', :padx=>[2,6], :squeeze=>:x, :expand=>:ns) t.style_layout(s, 'sel.e', :union=>['text.read'], :iexpand=>:nes, :ipadx=>[2,0]) # Image + text s = t.style_create('read2') t.style_elements(s, ['sel.e', 'image.read2', 'text.unread']) t.style_layout(s, 'image.read2', :expand=>:ns) t.style_layout(s, 'text.unread', :padx=>[2,6], :squeeze=>:x, :expand=>:ns) t.style_layout(s, 'sel.e', :union=>['text.unread'], :iexpand=>:nes, :ipadx=>[2,0]) # Text s = t.style_create('unread.we') t.style_elements(s, ['sel.we', 'text.unread']) t.style_layout(s, 'text.unread', :padx=>6, :squeeze=>:x, :expand=>:ns) t.style_layout(s, 'sel.we', :detach=>true, :iexpand=>:es) # Text s = t.style_create('read.we') t.style_elements(s, ['sel.we', 'text.read']) t.style_layout(s, 'text.read', :padx=>6, :squeeze=>:x, :expand=>:ns) t.style_layout(s, 'sel.we', :detach=>true, :iexpand=>:es) # Text s = t.style_create('unread.w') t.style_elements(s, ['sel.w', 'text.unread']) t.style_layout(s, 'text.unread', :padx=>6, :squeeze=>:x, :expand=>:ns) t.style_layout(s, 'sel.w', :detach=>true, :iexpand=>:es) # Text s = t.style_create('read.w') t.style_elements(s, ['sel.w', 'text.read']) t.style_layout(s, 'text.read', :padx=>6, :squeeze=>:x, :expand=>:ns) t.style_layout(s, 'sel.w', :detach=>true, :iexpand=>:es) msgCnt = 100 thread = 0 @Message = Hash.new{|k, v| k[v] = Hash.new} @Message[:count][0] = 0 (1...(msgCnt)).each{|i| t.item_create j = nil loop { j = rand(i) break if j == 0 next if t.depth(j) == 5 next if @Message[:count][@Message[:thread][j]] == 15 break } t.item_lastchild(j, i) @Message[:read][i] = (rand(2) == 0) if j == 0 thread += 1 @Message[:thread][i] = thread @Message[:seconds][i] = (Tk::Clock.seconds - rand(500000)) @Message[:seconds2][i] = @Message[:seconds][i] @Message[:count][thread] = 1 else @Message[:thread][i] = @Message[:thread][j] @Message[:seconds][i] = (@Message[:seconds2][j] + rand(10000)) @Message[:seconds2][i] = @Message[:seconds][i] @Message[:seconds2][j] = @Message[:seconds][i] @Message[:count][@Message[:thread][j]] += 1 end } (1...(msgCnt)).each{|i| subject = "This is thread number #{@Message[:thread][i]}" from = '[email protected]' sent = Tk::Clock.format(@Message[:seconds][i], "%d/%m/%y %I:%M %p") size = "#{1 + rand(10)}KB" if @Message[:read][i] style = 'read' style2 = 'read2' else style = 'unread' style2 = 'unread2' end t.item_style_set(i, 3, style, 4, "#{style2}.we", 5, "#{style2}.we", 6, "#{style2}.w") t.item_text(i, 3, subject, 4, from, 5, sent, 6, size) if t.item_numchildren(i) > 0 t.item_configure(item_i, :button=>true) end } # Do something when the selection changes t.notify_bind(t, 'Selection', proc{|w| if w.selection_count == 1 i = t.selection_get[0] unless @Message[:read][i] if t.item_isopen(i) || !anyUnreadDescendants(t, i) # unread -> read t.item_style_map(i, 'subject', 'read', ['text.unread', 'text.read']) t.item_style_map(i, 'from', 'read.we', ['text.unread', 'text.read']) t.item_style_map(i, 'sent', 'read.we', ['text.unread', 'text.read']) t.item_style_map(i, 'size', 'read.w', ['text.unread', 'text.read']) else # unread -> read2 t.item_style_map(i, 'subject', 'read2', ['text.unread', 'text.unread']) end @Message[:read][i] = true @display_styles_in_item.call(i) end end }, '%T') t.notify_bind(t, 'Expand-after', proc{|w, i| if @Messge[:read][i] && anyUnreadDescendants(t, i) # read2 -> read t.item_style_map(i, 'subject', 'read', ['text.unread', 'text.read']) # unread -> read t.item_style_map(i, 'from', 'read.we', ['text.unread', 'text.read']) t.item_style_map(i, 'sent', 'read.we', ['text.unread', 'text.read']) t.item_style_map(i, 'size', 'read.w', ['text.unread', 'text.read']) end }, '%T %I') t.notify_bind(t, 'Collapse-after', proc{|w, i| if @Messge[:read][i] && anyUnreadDescendants(t, i) # read -> read2 t.item_style_map(i, 'subject', 'read2', ['text.read', 'text.unread']) # read -> unread t.item_style_map(i, 'from', 'unread.we', ['text.read', 'text.unread']) t.item_style_map(i, 'sent', 'unread.we', ['text.read', 'text.unread']) t.item_style_map(i, 'size', 'unread.w', ['text.read', 'text.unread']) end }, '%T %I') (1...(msgCnt)).each{|i| if rand(2) == 0 if t.item_numchildren(i) > 0 if $Version_1_1_OrLater t.item_collapse(i) else # TreeCtrl 1.0 t.collapse(i) end end end } end |
#demoRandom(t) ⇒ Object
Demo: random N items
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'sample/tkextlib/treectrl/random.rb', line 10 def demoRandom(t) init_pics('folder-*', 'small-*') height = t.font.metrics(:linespace) height = 18 if height < 18 t.configure(:itemheight=>height, :selectmode=>:extended, :showroot=>true, :showrootbutton=>true, :showbuttons=>true, :showlines=>true, :scrollmargin=>16, :xscrolldelay=>[500, 50], :yscrolldelay=>[500, 50]) if $Version_1_1_OrLater t.column_create(:expand=>true, :text=>'Item', :itembackground=>['#e0e8f0', []], :tag=>'item') t.column_create(:text=>'Parent', :justify=>:center, :itembackground=>['gray90', []], :tag=>'parent') t.column_create(:text=>'Depth', :justify=>:center, :itembackground=>['linen', []], :tag=>'depth') else # TreeCtrl 1.0 t.column_configure(0, :expand=>true, :text=>'Item', :itembackground=>['#e0e8f0', []], :tag=>'item') t.column_configure(1, :text=>'Parent', :justify=>:center, :itembackground=>['gray90', []], :tag=>'parent') t.column_configure(2, :text=>'Depth', :justify=>:center, :itembackground=>['linen', []], :tag=>'depth') end t.element_create('e1', :image, :image=>[ @images['folder-open'], ['open'], @images['folder-closed'], [] ]) t.element_create('e2', :image, :image=>@images['small-file']) t.element_create('e3', :text, :fill=>[@SystemHighlightText, ['selected', 'focus']]) t.element_create('e4', :text, :fill=>'blue') t.element_create('e6', :text) t.element_create('e5', :rect, :showfocus=>true, :fill=>[ @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) s = t.style_create('s1') t.style_elements(s, ['e5', 'e1', 'e3', 'e4']) t.style_layout(s, 'e1', :padx=>[0,4], :expand=>:ns) t.style_layout(s, 'e3', :padx=>[0,4], :expand=>:ns) t.style_layout(s, 'e4', :padx=>[0,6], :expand=>:ns) t.style_layout(s, 'e5', :union=>['e3'], :iexpand=>:ns, :ipadx=>2) s = t.style_create('s2') t.style_elements(s, ['e5', 'e2', 'e3']) t.style_layout(s, 'e2', :padx=>[0,4], :expand=>:ns) t.style_layout(s, 'e3', :padx=>[0,4], :expand=>:ns) t.style_layout(s, 'e5', :union=>['e3'], :iexpand=>:ns, :ipadx=>2) s = t.style_create('s3') t.style_elements(s, ['e6']) t.style_layout(s, 'e6', :padx=>6, :expand=>:ns) @Priv[:sensitive, t] = [ [:item, 's1', 'e5', 'e1', 'e3'], [:item, 's2', 'e5', 'e2', 'e3'] ] @Priv[:dragimage, t] = [ [:item, 's1', 'e1', 'e3'], [:item, 's2', 'e2', 'e3'] ] clicks = Tk::Clock.clicks items = [ t.index(:root) ] (1...(random_N())).each{|i| item_i = t.item_create item_j = nil loop { j = rand(i) item_j = items[j] break if t.depth(item_j) < 5 } if $Version_1_1_OrLater t.item_collapse(item_i) if rand(2) == 0 else # TreeCtrl 1.0 t.collapse(item_i) if rand(2) == 0 end if rand(2) == 0 t.item_lastchild(item_j, item_i) else t.item_firstchild(item_j, item_i) end items << item_i } puts "created #{random_N() - 1} items in #{Tk::Clock.clicks - clicks} clicks" clicks = Tk::Clock.clicks (0...(random_N())).each{|i| item_i = items[i] numChildren = t.item_numchildren(item_i) if numChildren > 0 if $Version_1_1_OrLater t.item_configure(item_i, :button=>true) else # TreeCtrl 1.0 t.(item_i, true) end t.item_style_set(item_i, 0, 's1', 1, 's3', 2, 's3') t.item_complex(item_i, [ ['e3', {:text=>"Item #{i}"}], ['e4', {:text=>"(#{numChildren})"}] ], [ ['e6', {:text=>"#{t.item_parent(item_i)}"}] ], [ ['e6', {:text=>"#{t.depth(item_i)}"}] ]) else t.item_style_set(item_i, 1, 's3', 2, 's3', 0, 's2') t.item_complex(item_i, [ ['e3', {:text=>"Item #{i}"}] ], [ ['e6', {:text=>"#{t.item_parent(item_i)}"}] ], [ ['e6', {:text=>"#{t.depth(item_i)}"}] ]) end } puts "configured #{random_N()} items in #{Tk::Clock.clicks - clicks} clicks" treeCtrlRandom = TkBindTag.new treeCtrlRandom.bind('Double-ButtonPress-1', proc{|w, x, y| Tk::TreeCtrl::BindCallback.doubleButton1(w, x, y) Tk.callback_break }, '%W %x %y') treeCtrlRandom.bind('Control-ButtonPress-1', proc{|w, x, y| @Priv['selectMode'] = :toggle randomButton1(w, x, y) Tk.callback_break }, '%W %x %y') treeCtrlRandom.bind('Shift-ButtonPress-1', proc{|w, x, y| @Priv['selectMode'] = :add randomButton1(w, x, y) Tk.callback_break }, '%W %x %y') treeCtrlRandom.bind('ButtonPress-1', proc{|w, x, y| @Priv['selectMode'] = :set randomButton1(w, x, y) Tk.callback_break }, '%W %x %y') treeCtrlRandom.bind('Button1-Motion', proc{|w, x, y| randomMotion1(w, x, y) Tk.callback_break }, '%W %x %y') treeCtrlRandom.bind('Button1-Leave', proc{|w, x, y| randomLeave1(w, x, y) Tk.callback_break }, '%W %x %y') treeCtrlRandom.bind('ButtonRelease-1', proc{|w, x, y| randomRelease1(w, x, y) Tk.callback_break }, '%W %x %y') t. = [ t, treeCtrlRandom, Tk::TreeCtrl, t.winfo_toplevel, :all ] end |
#demoRandom2(t) ⇒ Object
Demo: random N items, button images
501 502 503 504 505 506 507 508 509 |
# File 'sample/tkextlib/treectrl/random.rb', line 501 def demoRandom2(t) demoRandom(t) init_pics('mac-*') t.configure(:openbuttonimage=>@images['mac-collapse'], :closedbuttonimage=>@images['mac-expand'], :showlines=>false) end |
#do_motion(x, y) ⇒ Object
31 32 33 34 35 |
# File 'sample/tkline.rb', line 31 def do_motion(x, y) if $current_line $current_line.coords $start_x, $start_y, x, y end end |
#do_press(x, y) ⇒ Object
25 26 27 28 29 30 |
# File 'sample/tkline.rb', line 25 def do_press(x, y) $start_x = x $start_y = y $current_line = Line.new($c, x, y, x, y) start_random end |
#do_release(x, y) ⇒ Object
37 38 39 40 41 42 43 |
# File 'sample/tkline.rb', line 37 def do_release(x, y) if $current_line $current_line.coords $start_x, $start_y, x, y $current_line.fill 'black' $current_line = nil end end |
#drawlines ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'sample/tcltklib/lines3.rb', line 6 def drawlines() print Time.now, "\n" for j in 0 .. 99 print "*" $stdout.flush if (j & 1) != 0 col = "blue" else col = "red" end for i in 0 .. 99 # $a.create(TkcLine, i, 0, 0, 500 - i, "fill"=>col) end end print Time.now, "\n" for j in 0 .. 99 print "*" $stdout.flush if (j & 1) != 0 col = "blue" else col = "red" end for i in 0 .. 99 $a.create(TkcLine, i, 0, 0, 500 - i, "fill"=>col) end end print Time.now, "\n" # Tk.root.destroy end |
#embDefBg(w) ⇒ Object
290 291 292 |
# File 'sample/demos-en/twind.rb', line 290 def embDefBg (w) w['background'] = w.configinfo('background')[3] end |
#embDefBg2(w) ⇒ Object
383 384 385 |
# File 'sample/demos-en/twind2.rb', line 383 def embDefBg2 (w) w['background'] = w.configinfo('background')[3] end |
#embPlotDown(w, x, y) ⇒ Object
265 266 267 268 269 270 271 |
# File 'sample/demos-en/twind.rb', line 265 def embPlotDown (w, x, y) w.dtag 'selected' w.addtag_withtag 'selected', 'current' w.raise 'current' $embPlot['lastX'] = x $embPlot['lastY'] = y end |
#embPlotDown2(w, x, y) ⇒ Object
358 359 360 361 362 363 364 |
# File 'sample/demos-en/twind2.rb', line 358 def embPlotDown2 (w, x, y) w.dtag 'selected' w.addtag_withtag 'selected', 'current' w.raise 'current' $embPlot2['lastX'] = x $embPlot2['lastY'] = y end |
#embPlotMove(w, x, y) ⇒ Object
273 274 275 276 277 |
# File 'sample/demos-en/twind.rb', line 273 def embPlotMove (w, x, y) w.move 'selected', x - $embPlot['lastX'], y - $embPlot['lastY'] $embPlot['lastX'] = x $embPlot['lastY'] = y end |
#embPlotMove2(w, x, y) ⇒ Object
366 367 368 369 370 |
# File 'sample/demos-en/twind2.rb', line 366 def embPlotMove2 (w, x, y) w.move 'selected', x - $embPlot2['lastX'], y - $embPlot2['lastY'] $embPlot2['lastX'] = x $embPlot2['lastY'] = y end |
#explorerHeaderInvoke(t, w, c) ⇒ Object
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
# File 'sample/tkextlib/treectrl/explorer.rb', line 177 def explorerHeaderInvoke(t, w, c) if (c == @SortColumn) if t.column_cget(@SortColumn, :arrow) == 'down' order = :increasing arrow = :up else order = :decreasing arrow = :down end else if t.column_cget(@SortColumn, :arrow) == 'down' order = :decreasing arrow = :down else order = :increasing arrow = :up end t.column_configure(@SortColumn, :arrow=>:none) @SortColumn = c end t.column_configure(c, :arrow=>arrow) dirCount = TkComm.number(@Priv[:DirCnt, t]) lastDir = dirCount - 1 case t.column_cget(c, :tag) when 'name' if dirCount > 0 t.item_sort(:root, order, {:last=>"root child #{lastDir}"}, {:column=>c, :dictionary=>true}) end if dirCount < t.numitems - 1 t.item_sort(:root, order, {:first=>"root child #{dirCount}"}, {:column=>c, :dictionary=>true}) end when 'size' if dirCount < t.numitems - 1 t.item_sort(:root, order, {:first=>"root child #{dirCount}"}, {:column=>c, :integer=>true}, {:column=>'name', :dictionary=>true}) end when 'type' if dirCount < t.numitems - 1 t.item_sort(:root, order, {:first=>"root child #{dirCount}"}, {:column=>c, :dictionary=>true}, {:column=>'name', :dictionary=>true}) end when 'modified' if dirCount > 0 t.item_sort(:root, order, {:last=>"root child #{lastDir}"}, {:column=>c, :integer=>true}, {:column=>'name', :dictionary=>true}) end if dirCount < t.numitems - 1 t.item_sort(:root, order, {:first=>"root child #{dirCount}"}, {:column=>c, :integer=>true}, {:column=>'name', :dictionary=>true}) end end end |
#fileDialog(w, ent, operation) ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'sample/demos-en/filebox.rb', line 70 def fileDialog(w,ent,operation) # Type names Extension(s) Mac File Type(s) # #-------------------------------------------------------- types = [ ['Text files', ['.txt','.doc'] ], ['Text files', [], 'TEXT' ], ['Ruby Scripts', ['.rb'], 'TEXT' ], ['Tcl Scripts', ['.tcl'], 'TEXT' ], ['C Source Files', ['.c','.h'] ], ['All Source Files', ['.rb','.tcl','.c','.h'] ], ['Image Files', ['.gif'] ], ['Image Files', ['.jpeg','.jpg'] ], ['Image Files', [], ['GIFF','JPEG']], ['All files', '*' ] ] if operation == 'open' file = Tk.getOpenFile('filetypes'=>types, 'parent'=>w) else file = Tk.getSaveFile('filetypes'=>types, 'parent'=>w, 'initialfile'=>'Untitled', 'defaultextension'=>'.txt') end if file != "" ent.delete 0, 'end' ent.insert 0, file # ent.xview 'end' Tk.update_idletasks # need this for Tk::Tile::Entry # (to find right position of 'xview'). ent.xview(ent.index('end')) end end |
#fill_headers(w, r = 10, c = 10) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'sample/tkextlib/tktable/valid.rb', line 22 def fill_headers(w, r=10, c=10) (1..(r-1)).each{|i| w.set([i,0], i.to_s)} (1..(c-1)).each{|j| if j % 3 == 1 w.set([0,j], 'AlphaNum') elsif j % 2 == 1 w.set([0,j], 'Alpha') elsif j != 0 w.set([0,j], 'Real') end } end |
#fill_table(tbl_list, page, r = 10, c = 10) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'sample/tkextlib/tktable/spreadsheet.rb', line 29 def fill_table(tbl_list, page, r=10, c=10) ary = tbl_list[page] (0...r).each{|i| (0...c).each{|j| if i!=0 && j!=0 ary[i,j] = "#{page} #{i},#{j}" elsif i!=0 ary[i,j] = i.to_s else ary[i,j] = (64+j).chr end } } end |
#fillMenu(menu) ⇒ Object
Side-by side check, radio, and menu button comparison:
352 353 354 355 356 357 358 359 360 361 362 363 364 |
# File 'sample/tkextlib/tile/demo.rb', line 352 def fillMenu() %w(above below left right flush).each{|dir| .add(:command, :label=>Tk.tk_call('string', 'totitle', dir), :command=>proc{ .winfo_parent.direction(dir) }) } .add(:cascade, :label=>'Submenu', :menu=>( = TkMenu.new())) .add(:command, :label=>'Subcommand 1') .add(:command, :label=>'Subcommand 2') .add(:command, :label=>'Subcommand 3') .add(:separator) .add(:command, :label=>'Quit', :command=>proc{Tk.root.destroy}) end |
#fillTree(treeview) ⇒ Object
722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 |
# File 'sample/tkextlib/tile/demo.rb', line 722 def fillTree(treeview) id = treeview.focus_item unless TkWinfo.exist?(id) treeview.delete(id) end # Replace tree item children with current list of child windows. treeview.delete(treeview.children(id)) for child in TkWinfo.children(id) treeview.insert(id, :end, :id=>child, :text=>TkWinfo.appname(child), :open=>false, :values=>[TkWinfo.classname(child)]) unless TkWinfo.children(child).empty? # insert dummy child to show [+] indicator treeview.insert(child, :end) end end end |
#find_framework(tcl_hdr, tk_hdr) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'old-extconf.rb', line 15 def find_framework(tcl_hdr, tk_hdr) if framework_dir = with_config("tcltk-framework") paths = [framework_dir] else unless tcl_hdr || tk_hdr || enable_config("tcltk-framework", false) || enable_config("mac-tcltk-framework", false) return false end paths = ["/Library/Frameworks", "/System/Library/Frameworks"] end checking_for('Tcl/Tk Framework') { paths.find{|dir| dir.strip! dir.chomp!('/') (tcl_hdr || FileTest.directory?(dir + "/Tcl.framework/") ) && (tk_hdr || FileTest.directory?(dir + "/Tk.framework/") ) } } end |
#find_macosx_framework ⇒ Object
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
# File 'extconf.rb', line 259 def find_macosx_framework use_framework = is_macosx? && TkLib_Config["ActiveTcl"] use_framework ||= (tcl_hdr = with_config("tcl-framework-header")) use_framework ||= (tk_hdr = with_config("tk-framework-header")) tcl_hdr = nil unless tcl_hdr.kind_of? String tk_hdr = nil unless tk_hdr.kind_of? String TkLib_Config["tcl-framework-header"] = tcl_hdr TkLib_Config["tk-framework-header"] = tk_hdr use_framework ||= (tcl_dir = with_config("tcl-framework-dir")) tcl_dir = nil unless tcl_dir.kind_of? String if !tcl_dir && tcl_hdr # e.g. /Library/Frameworks/Tcl.framework/Headers # ==> /Library/Frameworks/Tcl.framework tcl_dir = File.dirname(tcl_hdr.strip.chomp('/')) end TkLib_Config["tcl-framework-dir"] = tcl_dir use_framework ||= (tk_dir = with_config("tk-framework-dir")) tk_dir = nil unless tk_dir.kind_of? String if !tk_dir && tk_hdr # e.g. /Library/Frameworks/Tk.framework/Headers # ==> /Library/Frameworks/Tk.framework tk_dir = File.dirname(tk_hdr.strip.chomp('/')) end TkLib_Config["tk-framework-dir"] = tk_dir if tcl_dir && !tk_dir tk_dir = File.join(File.dirname(tcl_dir), 'Tk.framework') TkLib_Config["tk-framework-dir"] = tk_dir elsif !tcl_dir && tk_dir tcl_dir = File.join(File.dirname(tk_dir), 'Tcl.framework') TkLib_Config["tcl-framework-dir"] = tcl_dir end if tcl_dir && tk_dir TkLib_Config["tcltk-framework"] = File.dirname(tcl_dir) unless TkLib_Config["tcltk-framework"] return [tcl_dir, tk_dir] end # framework is disabled? if with_config("tcltk-framework") == false || enable_config("tcltk-framework") == false return false end use_framework ||= (framework_dir = with_config("tcltk-framework")) if framework_dir.kind_of? String TkLib_Config["tcltk-framework"] = framework_dir.strip.chomp('/') return [File.join(TkLib_Config["tcltk-framework"], 'Tcl.framework'), File.join(TkLib_Config["tcltk-framework"], 'Tk.framework')] end unless enable_config("tcltk-framework", use_framework) || enable_config("mac-tcltk-framework", use_framework) TkLib_Config["tcltk-framework"] = false return false end paths = [ #"~/Library/Frameworks", "/Library/Frameworks", "/Network/Library/Frameworks", "/System/Library/Frameworks" ] paths.reverse! unless TkLib_Config["ActiveTcl"] # system has higher priority paths.map{|dir| dir.strip.chomp('/')}.each{|dir| next unless File.exist?(File.join(dir, "Tcl.framework", "Headers")) next unless File.directory?(tcldir = File.join(dir, "Tcl.framework")) next unless File.exist?(File.join(dir, "Tk.framework", "Headers")) next unless File.directory?(tkdir = File.join(dir, "Tk.framework")) TkLib_Config["tcltk-framework"] = dir return [tcldir, tkdir] } nil end |
#find_tcl(tcllib, stubs, version, *opt_paths) ⇒ Object
1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 |
# File 'extconf.rb', line 1060 def find_tcl(tcllib, stubs, version, *opt_paths) if TclConfig_Info['MKMF_PARAMS'] # already checked existence of tcl library based on tclConfig.sh ($INCFLAGS ||= "") << " " << TclConfig_Info['MKMF_PARAMS']['INCFLAGS'] $LIBPATH ||= []; $LIBPATH |= TclConfig_Info['MKMF_PARAMS']['LIBPATH'] ($libs ||= "") << " " << TclConfig_Info['MKMF_PARAMS']['libs'] return [true, nil, nil, nil] end # else, no available tclConfig.sh on the system print "Search Tcl library" if stubs func = "Tcl_InitStubs" lib = "tclstub" else func = "Tcl_FindExecutable" lib = "tcl" end if version && ! version.empty? versions = [version] else versions = TkLib_Config['search_versions'] end default_paths = [] default_paths.concat [ RbConfig::CONFIG['libdir'], File.join(RbConfig::CONFIG['exec_prefix'], 'lib'), File.join(RbConfig::CONFIG['prefix'], 'lib'), "/usr/local/lib", "/usr/pkg/lib", "/usr/contrib/lib", "/usr/lib" ].find_all{|dir| File.directory?(dir)} unless CROSS_COMPILING if TkLib_Config["ActiveTcl"].kind_of?(String) # glob path default_paths.concat Dir.glob(TkLib_Config["ActiveTcl"]).sort.reverse.map{|d| d << "/lib"} end if !CROSS_COMPILING and is_win32? default_paths.concat [ "c:/Tcl/lib","c:/Program Files/Tcl/lib","c:/Program Files (x86)/Tcl/lib", "/Tcl/lib","/Program Files/Tcl/lib","/Program Files (x86)/Tcl/lib" ].find_all{|dir| File.directory?(dir)}.map{|dir| File.(dir)} # for MinGW ["/usr/local/lib64", "/usr/lib64", "/usr/local/lib", "/usr/lib"].each{|dir| default_paths << File.(dir) if File.directory? dir } default_paths |= ENV['LIBRARY_PATH'].split(';').find_all{|dir| File.directory? dir}.map{|dir| File.(dir)} if ENV['LIBRARY_PATH'] default_paths |= ENV['PATH'].split(';').find_all{|dir| File.directory? dir}.map{|dir| File.(dir)} if ENV['PATH'] end default_paths |= TkLib_Config["checked_shlib_dirs"] unless TkLib_Config["space-on-tk-libpath"] default_paths.delete_if{|path| path =~ / /} end if (paths = opt_paths.compact).empty? paths = check_tcl_NG_path(default_paths) end incflags = ($INCFLAGS ||= "").dup libpath = ($LIBPATH ||= []).dup libs_param = ($libs ||= "").dup tcllibs = nil exts = "(" + get_ext_list.join('|') + ")" paths.map{|path| lib_w_sufx = lib begin $LIBPATH |= [path] inc = [File.join(File.dirname(path),"include"), File.dirname(path)] inc.each{|f| $INCFLAGS << " -I" << f } if tcllib print(".") if have_library(tcllib, func, ["tcl.h"]) return [true, path, tcllib, nil, *inc] end else sufx_list = ['', 't', 'g', 's', 'x'] search_vers_on_path(versions, path, lib, 'tcl').find{|ver| dir_enum = Dir.foreach(path) no_dot_ver = ver.delete('.') libnames = ["#{lib}#{ver}", "#{lib}#{no_dot_ver}"] libnames << "tcl#{ver}" << "tcl#{no_dot_ver}" if lib != "tcl" libnames.find{|libname| sufx_list.find{|sufx| print(".") dir_enum.map{|fname| if fname =~ /^.*(#{libname}.*#{sufx})\.(#{exts}).*$/ [fname, $1, $2] end }.compact.find{|fname, lib_w_sufx, ext| ext.downcase! if (ext != CONFIG['DLEXT'] && ext == CONFIG['LIBEXT']) || ext == "a" # static link tcllibs = libs_param + " -DSTATIC_BUILD " + fname.quote else tcllibs = append_library($libs, lib_w_sufx) tcllibs = "#{libpathflag([path])} #{tcllibs}" end if try_func(func, tcllibs, ["tcl.h"]) return [true, path, nil, tcllibs, *inc] end } } } } if (!version && (print(".");try_func(func, libs_param, ["tcl.h"]))) return [true, path, lib_w_sufx, nil, *inc] end end ensure $LIBPATH = libpath.dup $libs = libs_param.dup $INCFLAGS = incflags.dup end } print("\n") # progress [false, nil, nil, nil] end |
#find_tcltk_header(tclver, tkver) ⇒ Object
1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 |
# File 'extconf.rb', line 1365 def find_tcltk_header(tclver, tkver) base_dir = [] base_dir.concat [ File.join(RbConfig::CONFIG['prefix'], 'include'), "/usr/local/include", "/usr/pkg/include", "/usr/contrib/include", "/usr/include" ].find_all{|dir| File.directory?(dir)}.map{|dir| File.(dir)} if !CROSS_COMPILING && is_win32? base_dir.concat [ "c:/Tcl/include","c:/Program Files/Tcl/include", "c:/Program Files (x86)/Tcl/include", "/Tcl/include","/Program Files/Tcl/include", "/Program Files (x86)/Tcl/include" ].find_all{|dir| File.directory?(dir)}.map{|dir| File.(dir)} if ENV['CPATH'] base_dir |= ENV['CPATH'].split(';').find_all{|dir| File.directory?(dir)}.map{|dir| File.(dir)} end end base_dir |= TkLib_Config["checked_shlib_dirs"] unless TkLib_Config["space-on-tk-libpath"] base_dir.delete_if{|path| path =~ / /} end # tcl.h if TclConfig_Info['MKMF_PARAMS'] # already checked existence of tcl headers based on tclConfig.sh have_tcl_h = true else print "\nSearch tcl.h" if enable_config("tcl-h-ver-check", true) && tclver && tclver =~ /^\D*(\d)\.?(\d)/ major = $1; minor = $2 else major = minor = nil end print(".") # progress if major && minor # version check on tcl.h version_check = proc {|code| code << ("#if TCL_MAJOR_VERSION != #{major} || TCL_MINOR_VERSION != #{minor}\n" \ "#error VERSION does not match\n" \ "#endif") } else version_check = nil end have_tcl_h = have_header('tcl.h', &version_check) unless have_tcl_h if tclver && ! tclver.empty? versions = [tclver] else versions = TkLib_Config['search_versions'] end paths = base_dir.dup (versions + [""]).each{|ver| paths.concat(base_dir.map{|dir| [ dir + '/tcl' + ver, dir + '/tcl' + ver + '/include', dir + '/tcl' + ver.delete('.'), dir + '/tcl' + ver.delete('.') + '/include' ] }.flatten) } paths = paths.map{|dir| (File.directory?(dir))? File.(dir): nil }.compact.uniq if major || minor version_check = proc {|code| code << "#if TCL_MAJOR_VERSION != #{major}\n#error MAJOR_VERSION does not match\n#endif\n" if major code << "#if TCL_MINOR_VERSION != #{minor}\n#error MINOR_VERSION does not match\n#endif\n" if minor code } else version_check = nil end have_tcl_h = paths.find{|path| print(".") # progress inc_opt = " -I#{path.quote}" if try_header("tcl", inc_opt, &version_check) ($INCFLAGS ||= "") << inc_opt true else false end } end end # tk.h if TkConfig_Info['MKMF_PARAMS'] # already checked existence of tk headers based on tkConfig.sh have_tk_h = true else print "\nSearch tk.h" if enable_config("tk-h-ver-check", true) && tkver && tkver =~ /^\D*(\d)\.?(\d)/ major = $1; minor = $2 else major = minor = nil end print(".") # progress if major && minor # version check on tk.h version_check = proc {|code| code << ("#if TK_MAJOR_VERSION != #{major} || TK_MINOR_VERSION != #{minor}\n" \ "#error VERSION does not match\n" \ "#endif") } else version_check = nil end have_tk_h = have_header('tk.h') unless have_tk_h if tkver && ! tkver.empty? versions = [tkver] else versions = TkLib_Config['search_versions'] end paths = base_dir.dup (versions + [""]).each{|ver| paths.concat(base_dir.map{|dir| [ dir + '/tk' + ver, dir + '/tk' + ver + '/include', dir + '/tk' + ver.delete('.'), dir + '/tk' + ver.delete('.') + '/include' ] }.flatten) } paths = paths.map{|dir| (File.directory?(dir))? File.(dir): nil }.compact.uniq if major || minor version_check = proc {|code| code << "#if TK_MAJOR_VERSION != #{major}\n#error MAJOR_VERSION does not match\n#endif\n" if major code << "#if TK_MINOR_VERSION != #{minor}\n#error MINOR_VERSION does not match\n#endif\n" if minor code } else version_check = nil end have_tk_h = paths.find{|path| print(".") # progress inc_opt = " -I#{path.quote}" if try_header(%w'tcl.h tk.h', inc_opt, &version_check) ($INCFLAGS ||= "") << inc_opt true else false end } end end puts "Can't find \"tcl.h\"." unless have_tcl_h puts "Can't find \"tk.h\"." unless have_tk_h have_tcl_h && have_tk_h end |
#find_tcltk_library(tcllib, tklib, stubs, tclversion, tkversion, tcl_opt_paths, tk_opt_paths) ⇒ Object
1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 |
# File 'extconf.rb', line 1328 def find_tcltk_library(tcllib, tklib, stubs, tclversion, tkversion, tcl_opt_paths, tk_opt_paths) st,path,lib,libs,*inc = find_tcl(tcllib, stubs, tclversion, *tcl_opt_paths) if !st && TkLib_Config['enable-shared'] == nil TkLib_Config['enable-shared'] = false st,path,lib,libs,*inc = find_tcl(tcllib, stubs, tclversion, *tcl_opt_paths) end unless st puts("Warning:: cannot find Tcl library. tcltklib will not be compiled (tcltklib is disabled on your Ruby. That is, Ruby/Tk will not work). Please check configure options.") return false else ($LIBPATH ||= []; $LIBPATH |= [path]) if path $libs = append_library($libs, lib) if lib ($libs ||= "") << " " << libs if libs $INCFLAGS ||= "" inc.each{|f| $INCFLAGS << " -I" << f} end st,path,lib,libs,*inc = find_tk(tklib, stubs, tkversion, *tk_opt_paths) if !st && TkLib_Config['enable-shared'] == nil TkLib_Config['enable-shared'] = false st,path,lib,libs,*inc = find_tk(tklib, stubs, tkversion, *tk_opt_paths) end unless st puts("Warning:: cannot find Tk library. tcltklib will not be compiled (tcltklib is disabled on your Ruby. That is, Ruby/Tk will not work). Please check configure options.") return false else ($LIBPATH ||= []; $LIBPATH |= [path]) if path $libs = append_library($libs, lib) if lib && !lib.empty? ($libs ||= "") << " " << libs if libs $INCFLAGS ||= "" inc.each{|f| $INCFLAGS << " -I" << f} end true end |
#find_tk(tklib, stubs, version, *opt_paths) ⇒ Object
1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 |
# File 'extconf.rb', line 1204 def find_tk(tklib, stubs, version, *opt_paths) if TkConfig_Info['MKMF_PARAMS'] # already checked existence of tcl library based on tkConfig.sh ($INCFLAGS ||= "") << " " << TkConfig_Info['MKMF_PARAMS']['INCFLAGS'] $LIBPATH ||= []; $LIBPATH |= TkConfig_Info['MKMF_PARAMS']['LIBPATH'] ($libs ||= "") << " " << TkConfig_Info['MKMF_PARAMS']['libs'] return [true, nil, nil, nil] end # else, no available tkConfig.sh on the system print "Search Tk library" if stubs func = "Tk_InitStubs" lib = "tkstub" else func = "Tk_Init" lib = "tk" end if version && ! version.empty? versions = [version] else versions = TkLib_Config['search_versions'] end default_paths = [] default_paths.concat [ RbConfig::CONFIG['libdir'], File.join(RbConfig::CONFIG['exec_prefix'], 'lib'), File.join(RbConfig::CONFIG['prefix'], 'lib'), "/usr/local/lib", "/usr/pkg/lib", "/usr/contrib/lib", "/usr/lib" ].find_all{|dir| File.directory?(dir)} unless CROSS_COMPILING if !CROSS_COMPILING and is_win32? default_paths.concat [ "c:/Tcl/lib","c:/Program Files/Tcl/lib","c:/Program Files (x86)/Tcl/lib", "/Tcl/lib","/Program Files/Tcl/lib","/Program Files (x86)/Tcl/lib" ].find_all{|dir| File.directory?(dir)} # for MinGW ["/usr/local/lib64", "/usr/lib64", "/usr/local/lib", "/usr/lib"].each{|dir| default_paths << File.(dir) if File.directory? dir } default_paths |= ENV['LIBRARY_PATH'].split(';').find_all{|dir| File.directory? dir}.map{|dir| File.(dir)} if ENV['LIBRARY_PATH'] default_paths |= ENV['PATH'].split(';').find_all{|dir| File.directory? dir}.map{|dir| File.(dir)} if ENV['PATH'] end default_paths |= TkLib_Config["checked_shlib_dirs"] unless TkLib_Config["space-on-tk-libpath"] default_paths.delete_if{|path| path =~ / /} end if (paths = opt_paths.compact).empty? paths = check_tk_NG_path(default_paths) end incflags = ($INCFLAGS ||= "").dup libpath = ($LIBPATH ||= []).dup libs_param = ($libs ||= "").dup tcllibs = nil exts = "(" + get_ext_list.join('|') + ")" paths.map{|path| lib_w_sufx = lib begin $LIBPATH |= [path] inc = [File.join(File.dirname(path),"include"), File.dirname(path)] inc.each{|f| $INCFLAGS << " -I" << f } if tklib print(".") if have_library(tklib, func, ["tcl.h", "tk.h"]) return [true, path, tklib, nil, *inc] end else sufx_list = ['', 't', 'g', 's', 'x'] search_vers_on_path(versions, path, lib, 'tk').find{|ver| dir_enum = Dir.foreach(path) no_dot_ver = ver.delete('.') libnames = ["#{lib}#{ver}", "#{lib}#{no_dot_ver}"] libnames << "tk#{ver}" << "tk#{no_dot_ver}" if lib != "tk" libnames.find{|libname| sufx_list.find{|sufx| print(".") dir_enum.map{|fname| if fname =~ /^.*(#{libname}.*#{sufx})\.(#{exts}).*$/ [fname, $1, $2] end }.compact.find{|fname, lib_w_sufx, ext| if (ext != CONFIG['DLEXT'] && ext == CONFIG['LIBEXT']) || ext == "a" # static link tklibs = libs_param + " -DSTATIC_BUILD " + fname.quote else tklibs = append_library($libs, lib_w_sufx) tklibs = "#{libpathflag([path])} #{tklibs}" end if try_func(func, tklibs, ["tcl.h", "tk.h"]) return [true, path, nil, tklibs, *inc] end } } } } if (!version && (print(".");try_func(func, libs_param, ["tcl.h", "tk.h"]))) return [true, path, lib_w_sufx, nil, *inc] end end ensure $LIBPATH = libpath $libs = libs_param $INCFLAGS = incflags.dup end } print("\n") # progress [false, nil, nil, nil] end |
#find_X11(*opt_paths) ⇒ Object
1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 |
# File 'extconf.rb', line 1577 def find_X11(*opt_paths) defaults = [ "/usr/X11*/lib", "/usr/lib/X11*", "/usr/local/X11*", "/usr/openwin/lib" ] paths = [] opt_paths.compact.each{|path| paths.concat(Dir.glob(path.strip.chomp('/'), File::FNM_CASEFOLD))} defaults.compact.each{|path| paths.concat(Dir.glob(path.strip.chomp('/'), File::FNM_CASEFOLD))} st = find_library("X11", "XOpenDisplay", *paths) unless st puts("Warning:: cannot find X11 library. tcltklib will not be compiled (tcltklib is disabled on your Ruby. That is, Ruby/Tk will not work). Please check configure options. If your Tcl/Tk don't require X11, please try --without-X11.") end st end |
#floor2_bg1(w, fill, outline) ⇒ Object
floor2_bg1 – This method represents part of the floorplan database. When invoked, it instantiates the background information for the first floor.
Arguments: w - The canvas window. fill - Fill color to use for the floor’s background. outline - Color to use for the floor’s outline.
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'sample/demos-en/floor2.rb', line 102 def floor2_bg1(w,fill,outline) w.create(TkcPolygon,347,80,349,82,351,84,353,85,363,92,375,99,386,104, 386,129,398,129,398,162,484,162,484,129,559,129,559,133,725, 133,725,129,802,129,802,389,644,389,644,391,559,391,559,327, 508,327,508,311,484,311,484,278,395,278,395,288,400,288,404, 288,409,290,413,292,418,297,421,302,422,309,421,318,417,325, 411,330,405,332,397,333,344,333,340,334,336,336,335,338,332, 342,331,347,332,351,334,354,336,357,341,359,340,360,335,363, 331,365,326,366,304,366,304,355,258,355,258,387,60,387,60,391, 0,391,0,337,3,337,3,114,8,114,8,25,30,25,30,5,93,5,98,5,104,7, 110,10,116,16,119,20,122,28,123,32,123,68,220,68,220,34,221, 22,223,17,227,13,231,8,236,4,242,2,246,0,260,0,283,1,300,5, 321,14,335,22,348,25,365,29,363,39,358,48,352,56,337,70, 344,76,347,80, 'tags'=>['floor1','bg'], 'fill'=>fill) w.create(TkcLine,386,129,398,129, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,258,355,258,387, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,60,387,60,391, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,0,337,0,391, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,60,391,0,391, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,3,114,3,337, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,258,387,60,387, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,484,162,398,162, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,398,162,398,129, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,484,278,484,311, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,484,311,508,311, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,508,327,508,311, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,559,327,508,327, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,644,391,559,391, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,644,389,644,391, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,559,129,484,129, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,484,162,484,129, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,725,133,559,133, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,559,129,559,133, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,725,129,802,129, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,802,389,802,129, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,3,337,0,337, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,559,391,559,327, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,802,389,644,389, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,725,133,725,129, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,8,25,8,114, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,8,114,3,114, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,30,25,8,25, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,484,278,395,278, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,30,25,30,5, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,93,5,30,5, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,98,5,93,5, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,104,7,98,5, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,110,10,104,7, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,116,16,110,10, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,119,20,116,16, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,122,28,119,20, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,123,32,122,28, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,123,68,123,32, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,220,68,123,68, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,386,129,386,104, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,386,104,375,99, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,375,99,363,92, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,353,85,363,92, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,220,68,220,34, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,337,70,352,56, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,352,56,358,48, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,358,48,363,39, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,363,39,365,29, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,365,29,348,25, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,348,25,335,22, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,335,22,321,14, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,321,14,300,5, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,300,5,283,1, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,283,1,260,0, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,260,0,246,0, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,246,0,242,2, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,242,2,236,4, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,236,4,231,8, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,231,8,227,13, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,223,17,227,13, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,221,22,223,17, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,220,34,221,22, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,340,360,335,363, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,335,363,331,365, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,331,365,326,366, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,326,366,304,366, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,304,355,304,366, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,395,288,400,288, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,404,288,400,288, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,409,290,404,288, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,413,292,409,290, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,418,297,413,292, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,421,302,418,297, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,422,309,421,302, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,421,318,422,309, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,421,318,417,325, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,417,325,411,330, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,411,330,405,332, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,405,332,397,333, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,397,333,344,333, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,344,333,340,334, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,340,334,336,336, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,336,336,335,338, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,335,338,332,342, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,331,347,332,342, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,332,351,331,347, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,334,354,332,351, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,336,357,334,354, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,341,359,336,357, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,341,359,340,360, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,395,288,395,278, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,304,355,258,355, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,347,80,344,76, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,344,76,337,70, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,349,82,347,80, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,351,84,349,82, 'fill'=>outline, 'tags'=>['floor1','bg']) w.create(TkcLine,353,85,351,84, 'fill'=>outline, 'tags'=>['floor1','bg']) end |
#floor2_bg2(w, fill, outline) ⇒ Object
floor2_bg2 – This method represents part of the floorplan database. When invoked, it instantiates the background information for the first floor.
Arguments: w - The canvas window. fill - Fill color to use for the floor’s background. outline - Color to use for the floor’s outline.
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
# File 'sample/demos-en/floor2.rb', line 226 def floor2_bg2(w,fill,outline) w.create(TkcPolygon,559,129,484,129,484,162,398,162,398,129,315,129, 315,133,176,133,176,129,96,129,96,133,3,133,3,339,0,339,0,391, 60,391,60,387,258,387,258,329,350,329,350,311,395,311,395,280, 484,280,484,311,508,311,508,327,558,327,558,391,644,391,644, 367,802,367,802,129,725,129,725,133,559,133,559,129, 'tags'=>['floor2','bg'], 'fill'=>fill) w.create(TkcLine,350,311,350,329, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,398,129,398,162, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,802,367,802,129, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,802,129,725,129, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,725,133,725,129, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,559,129,559,133, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,559,133,725,133, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,484,162,484,129, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,559,129,484,129, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,802,367,644,367, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,644,367,644,391, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,644,391,558,391, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,558,327,558,391, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,558,327,508,327, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,508,327,508,311, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,484,311,508,311, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,484,280,484,311, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,398,162,484,162, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,484,280,395,280, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,395,280,395,311, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,258,387,60,387, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,3,133,3,339, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,3,339,0,339, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,60,391,0,391, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,0,339,0,391, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,60,387,60,391, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,258,329,258,387, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,350,329,258,329, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,395,311,350,311, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,398,129,315,129, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,176,133,315,133, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,176,129,96,129, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,3,133,96,133, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,315,133,315,129, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,176,133,176,129, 'fill'=>outline, 'tags'=>['floor2','bg']) w.create(TkcLine,96,133,96,129, 'fill'=>outline, 'tags'=>['floor2','bg']) end |
#floor2_bg3(w, fill, outline) ⇒ Object
floor2_bg3 – This method represents part of the floorplan database. When invoked, it instantiates the background information for the first floor.
Arguments: w - The canvas window. fill - Fill color to use for the floor’s background. outline - Color to use for the floor’s outline.
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 |
# File 'sample/demos-en/floor2.rb', line 281 def floor2_bg3(w,fill,outline) w.create(TkcPolygon,159,300,107,300,107,248,159,248,159,129,96,129,96, 133,21,133,21,331,0,331,0,391,60,391,60,370,159,370,159,300, 'tags'=>['floor3','bg'], 'fill'=>fill) w.create(TkcPolygon,258,370,258,329,350,329,350,311,399,311,399,129, 315,129,315,133,176,133,176,129,159,129,159,370,258,370, 'tags'=>['floor3','bg'], 'fill'=>fill) w.create(TkcLine,96,133,96,129, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,176,129,96,129, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,176,129,176,133, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,315,133,176,133, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,315,133,315,129, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,399,129,315,129, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,399,311,399,129, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,399,311,350,311, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,350,329,350,311, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,350,329,258,329, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,258,370,258,329, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,60,370,258,370, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,60,370,60,391, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,60,391,0,391, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,0,391,0,331, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,21,331,0,331, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,21,331,21,133, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,96,133,21,133, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,107,300,159,300,159,248,107,248,107,300, 'fill'=>outline, 'tags'=>['floor3','bg']) end |
#floor2_fg1(w, color) ⇒ Object
floor2_fg1 – This method represents part of the floorplan database. When invoked, it instantiates the foreground information for the first floor (office outlines and numbers).
Arguments: w - The canvas window. color - Color to use for drawing foreground information.
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 |
# File 'sample/demos-en/floor2.rb', line 319 def floor2_fg1(w,color) i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '101' $floorItems2['101'] = i w.create(TkcText,358,209, 'text'=>'101', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Pub Lift1' $floorItems2['Pub Lift1'] = i w.create(TkcText,323,223, 'text'=>'Pub Lift1', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Priv Lift1' $floorItems2['Priv Lift1'] = i w.create(TkcText,323,188, 'text'=>'Priv Lift1', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,42,389,42,337,1,337,1,389, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '110' $floorItems2['110'] = i w.create(TkcText,21.5,363, 'text'=>'110', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,59,389,59,385,90,385,90,337,44,337,44,389, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '109' $floorItems2['109'] = i w.create(TkcText,67,363, 'text'=>'109', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,51,300,51,253,6,253,6,300, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '111' $floorItems2['111'] = i w.create(TkcText,28.5,276.5, 'text'=>'111', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,98,248,98,309,79,309,79,248, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '117B' $floorItems2['117B'] = i w.create(TkcText,88.5,278.5, 'text'=>'117B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,51,251,51,204,6,204,6,251, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '112' $floorItems2['112'] = i w.create(TkcText,28.5,227.5, 'text'=>'112', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,6,156,51,156,51,203,6,203, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '113' $floorItems2['113'] = i w.create(TkcText,28.5,179.5, 'text'=>'113', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,85,169,79,169,79,192,85,192, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '117A' $floorItems2['117A'] = i w.create(TkcText,82,180.5, 'text'=>'117A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,77,302,77,168,53,168,53,302, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '117' $floorItems2['117'] = i w.create(TkcText,65,235, 'text'=>'117', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,51,155,51,115,6,115,6,155, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '114' $floorItems2['114'] = i w.create(TkcText,28.5,135, 'text'=>'114', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,95,115,53,115,53,168,95,168, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '115' $floorItems2['115'] = i w.create(TkcText,74,141.5, 'text'=>'115', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,87,113,87,27,10,27,10,113, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '116' $floorItems2['116'] = i w.create(TkcText,48.5,70, 'text'=>'116', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,89,91,128,91,128,113,89,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '118' $floorItems2['118'] = i w.create(TkcText,108.5,102, 'text'=>'118', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,178,128,178,132,216,132,216,91, 163,91,163,112,149,112,149,128, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '120' $floorItems2['120'] = i w.create(TkcText,189.5,111.5, 'text'=>'120', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,79,193,87,193,87,169,136,169,136,192, 156,192,156,169,175,169,175,246,79,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '122' $floorItems2['122'] = i w.create(TkcText,131,207.5, 'text'=>'122', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,138,169,154,169,154,191,138,191, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '121' $floorItems2['121'] = i w.create(TkcText,146,180, 'text'=>'121', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,99,300,126,300,126,309,99,309, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '106A' $floorItems2['106A'] = i w.create(TkcText,112.5,304.5, 'text'=>'106A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,128,299,128,309,150,309,150,248,99,248,99,299, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '105' $floorItems2['105'] = i w.create(TkcText,124.5,278.5, 'text'=>'105', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,174,309,174,300,152,300,152,309, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '106B' $floorItems2['106B'] = i w.create(TkcText,163,304.5, 'text'=>'106B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,176,299,176,309,216,309,216,248,152,248,152,299, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '104' $floorItems2['104'] = i w.create(TkcText,184,278.5, 'text'=>'104', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,138,385,138,337,91,337,91,385, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '108' $floorItems2['108'] = i w.create(TkcText,114.5,361, 'text'=>'108', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,256,337,140,337,140,385,256,385, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '107' $floorItems2['107'] = i w.create(TkcText,198,361, 'text'=>'107', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,300,353,300,329,260,329,260,353, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Smoking' $floorItems2['Smoking'] = i w.create(TkcText,280,341, 'text'=>'Smoking', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,314,135,314,170,306,170,306,246,177,246,177,135, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '123' $floorItems2['123'] = i w.create(TkcText,245.5,190.5, 'text'=>'123', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,217,248,301,248,301,326,257,326,257,310,217,310, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '103' $floorItems2['103'] = i w.create(TkcText,259,287, 'text'=>'103', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,396,188,377,188,377,169,316,169,316,131,396,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '124' $floorItems2['124'] = i w.create(TkcText,356,150, 'text'=>'124', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,397,226,407,226,407,189,377,189,377,246,397,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '125' $floorItems2['125'] = i w.create(TkcText,392,217.5, 'text'=>'125', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,399,187,409,187,409,207,474,207,474,164,399,164, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '126' $floorItems2['126'] = i w.create(TkcText,436.5,185.5, 'text'=>'126', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,409,209,409,229,399,229,399,253, 486,253,486,239,474,239,474,209, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '127' $floorItems2['127'] = i w.create(TkcText,436.5,'231', 'text'=>'127', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,501,164,501,174,495,174,495,188, 490,188,490,204,476,204,476,164, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'MShower' $floorItems2['MShower'] = i w.create(TkcText,488.5,'184', 'text'=>'MShower', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,497,176,513,176,513,204,492,204,492,190,497,190, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Closet' $floorItems2['Closet'] = i w.create(TkcText,502.5,190, 'text'=>'Closet', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,476,237,476,206,513,206,513,254,488,254,488,237, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'WShower' $floorItems2['WShower'] = i w.create(TkcText,494.5,230, 'text'=>'WShower', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,486,131,558,131,558,135,724,135,724,166, 697,166,697,275,553,275,531,254,515,254, 515,174,503,174,503,161,486,161, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '130' $floorItems2['130'] = i w.create(TkcText,638.5,205, 'text'=>'130', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,308,242,339,242,339,248,342,248, 342,246,397,246,397,276,393,276, 393,309,300,309,300,248,308,248, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '102' $floorItems2['102'] = i w.create(TkcText,367.5,278.5, 'text'=>'102', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,397,255,486,255,486,276,397,276, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '128' $floorItems2['128'] = i w.create(TkcText,441.5,265.5, 'text'=>'128', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,510,309,486,309,486,255,530,255, 552,277,561,277,561,325,510,325, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '129' $floorItems2['129'] = i w.create(TkcText,535.5,293, 'text'=>'129', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,696,281,740,281,740,387,642,387, 642,389,561,389,561,277,696,277, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '133' $floorItems2['133'] = i w.create(TkcText,628.5,335, 'text'=>'133', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,742,387,742,281,800,281,800,387, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '132' $floorItems2['132'] = i w.create(TkcText,771,334, 'text'=>'132', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,800,168,800,280,699,280,699,168, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '134' $floorItems2['134'] = i w.create(TkcText,749.5,224, 'text'=>'134', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,726,131,726,166,800,166,800,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '135' $floorItems2['135'] = i w.create(TkcText,763,148.5, 'text'=>'135', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,340,360,335,363,331,365,326,366,304,366, 304,312,396,312,396,288,400,288,404,288, 409,290,413,292,418,297,421,302,422,309, 421,318,417,325,411,330,405,332,397,333, 344,333,340,334,336,336,335,338,332,342, 331,347,332,351,334,354,336,357,341,359, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Ramona Stair' $floorItems2['Ramona Stair'] = i w.create(TkcText,368,323, 'text'=>'Ramona Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,30,23,30,5,93,5,98,5,104,7,110,10,116,16,119,20, 122,28,123,32,123,68,220,68,220,87,90,87,90,23, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'University Stair' $floorItems2['University Stair'] = i w.create(TkcText,155,77.5, 'text'=>'University Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,282,37,295,40,312,49,323,56,337,70,352,56, 358,48,363,39,365,29,348,25,335,22,321,14, 300,5,283,1,260,0,246,0,242,2,236,4,231,8, 227,13,223,17,221,22,220,34,260,34, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Plaza Stair' $floorItems2['Plaza Stair'] = i w.create(TkcText,317.5,28.5, 'text'=>'Plaza Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,220,34,260,34,282,37,295,40,312,49, 323,56,337,70,350,83,365,94,377,100, 386,104,386,128,220,128, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Plaza Deck' $floorItems2['Plaza Deck'] = i w.create(TkcText,303,81, 'text'=>'Plaza Deck', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,257,336,77,336,6,336,6,301,77,301,77,310,257,310, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '106' $floorItems2['106'] = i w.create(TkcText,131.5,318.5, 'text'=>'106', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,146,110,162,110,162,91,130,91,130,115,95,115, 95,128,114,128,114,151,157,151,157,153,112,153, 112,130,97,130,97,168,175,168,175,131,146,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '119' $floorItems2['119'] = i w.create(TkcText,143.5,133, 'text'=>'119', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) w.create(TkcLine,155,191,155,189, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,155,177,155,169, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,96,129,96,169, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,78,169,176,169, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,176,247,176,129, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,340,206,307,206, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,340,187,340,170, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,340,210,340,201, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,340,247,340,224, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,340,241,307,241, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,376,246,376,170, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,307,247,307,170, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,376,170,307,170, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,315,129,315,170, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,147,129,176,129, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,202,133,176,133, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,398,129,315,129, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,258,352,258,387, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,60,387,60,391, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,0,337,0,391, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,60,391,0,391, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,3,114,3,337, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,258,387,60,387, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,52,237,52,273, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,52,189,52,225, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,52,140,52,177, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,395,306,395,311, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,531,254,398,254, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,475,178,475,238, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,502,162,398,162, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,398,129,398,188, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,383,188,376,188, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,408,188,408,194, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,398,227,398,254, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,408,227,398,227, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,408,222,408,227, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,408,206,408,210, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,408,208,475,208, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,484,278,484,311, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,484,311,508,311, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,508,327,508,311, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,559,327,508,327, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,644,391,559,391, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,644,389,644,391, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,514,205,475,205, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,496,189,496,187, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,559,129,484,129, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,484,162,484,129, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,725,133,559,133, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,559,129,559,133, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,725,149,725,167, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,725,129,802,129, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,802,389,802,129, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,739,167,802,167, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,396,188,408,188, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,0,337,9,337, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,58,337,21,337, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,43,391,43,337, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,105,337,75,337, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,91,387,91,337, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,154,337,117,337, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,139,387,139,337, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,227,337,166,337, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,258,337,251,337, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,258,328,302,328, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,302,355,302,311, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,395,311,302,311, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,484,278,395,278, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,395,294,395,278, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,473,278,473,275, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,473,256,473,254, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,533,257,531,254, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,553,276,551,274, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,698,276,553,276, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,559,391,559,327, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,802,389,644,389, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,741,314,741,389, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,698,280,698,167, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,707,280,698,280, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,802,280,731,280, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,741,280,741,302, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,698,167,727,167, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,725,137,725,129, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,514,254,514,175, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,496,175,514,175, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,502,175,502,162, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,475,166,475,162, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,496,176,496,175, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,491,189,496,189, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,491,205,491,189, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,487,238,475,238, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,487,240,487,238, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,487,252,487,254, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,315,133,304,133, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,256,133,280,133, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,78,247,270,247, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,307,247,294,247, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,214,133,232,133, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,217,247,217,266, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,217,309,217,291, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,217,309,172,309, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,154,309,148,309, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,175,300,175,309, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,151,300,175,300, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,151,247,151,309, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,78,237,78,265, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,78,286,78,309, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,106,309,78,309, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,130,309,125,309, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,99,309,99,247, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,127,299,99,299, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,127,309,127,299, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,155,191,137,191, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,137,169,137,191, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,78,171,78,169, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,78,190,78,218, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,86,192,86,169, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,86,192,78,192, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,52,301,3,301, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,52,286,52,301, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,52,252,3,252, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,52,203,3,203, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,3,156,52,156, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,8,25,8,114, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,63,114,3,114, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,75,114,97,114, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,108,114,129,114, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,129,114,129,89, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,52,114,52,128, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,132,89,88,89, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,88,25,88,89, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,88,114,88,89, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,218,89,144,89, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,147,111,147,129, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,162,111,147,111, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,162,109,162,111, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,162,96,162,89, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,218,89,218,94, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,218,89,218,119, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,8,25,88,25, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,258,337,258,328, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,113,129,96,129, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,302,355,258,355, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,386,104,386,129, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,377,100,386,104, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,365,94,377,100, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,350,83,365,94, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,337,70,350,83, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,337,70,323,56, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,312,49,323,56, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,295,40,312,49, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,282,37,295,40, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,260,34,282,37, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,253,34,260,34, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,386,128,386,104, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,113,152,156,152, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,113,152,156,152, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,113,152,113,129, 'fill'=>color, 'tags'=>['floor1','wall']) end |
#floor2_fg2(w, color) ⇒ Object
floor2_fg2 – This method represents part of the floorplan database. When invoked, it instantiates the foreground information for the second floor (office outlines and numbers).
Arguments: w - The canvas window. color - Color to use for drawing foreground information.
800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 |
# File 'sample/demos-en/floor2.rb', line 800 def floor2_fg2(w,color) i = TkcPolygon.new(w,748,188,755,188,755,205,758,205,758,222, 800,222,800,168,748,168, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '238' $floorItems2['238'] = i w.create(TkcText,774,195, 'text'=>'238', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,726,188,746,188,746,166,800,166,800,131,726,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '237' $floorItems2['237'] = i w.create(TkcText,763,148.5, 'text'=>'237', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,497,187,497,204,559,204,559,324,641,324, 643,324,643,291,641,291,641,205,696,205, 696,291,694,291,694,314,715,314,715,291, 715,205,755,205,755,190,724,190,724,187, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '246' $floorItems2['246'] = i w.create(TkcText,600,264, 'text'=>'246', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,694,279,643,279,643,314,694,314, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '247' $floorItems2['247'] = i w.create(TkcText,668.5,296.5, 'text'=>'247', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,232,250,308,250,308,242,339,242,339,246, 397,246,397,255,476,255,476,250,482,250,559,250, 559,274,482,274,482,278,396,278,396,274,232,274, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '202' $floorItems2['202'] = i w.create(TkcText,285.5,260, 'text'=>'202', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,53,228,53,338,176,338,233,338,233,196, 306,196,306,180,175,180,175,169,156,169, 156,196,176,196,176,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '206' $floorItems2['206'] = i w.create(TkcText,143,267, 'text'=>'206', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,51,277,6,277,6,338,51,338, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '212' $floorItems2['212'] = i w.create(TkcText,28.5,307.5, 'text'=>'212', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,557,276,486,276,486,309,510,309,510,325,557,325, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '245' $floorItems2['245'] = i w.create(TkcText,521.5,300.5, 'text'=>'245', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,560,389,599,389,599,326,560,326, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '244' $floorItems2['244'] = i w.create(TkcText,579.5,357.5, 'text'=>'244', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,601,389,601,326,643,326,643,389, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '243' $floorItems2['243'] = i w.create(TkcText,622,357.5, 'text'=>'243', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,688,316,645,316,645,365,688,365, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '242' $floorItems2['242'] = i w.create(TkcText,666.5,340.5, 'text'=>'242', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,802,367,759,367,759,226,802,226, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = 'Barbecue Deck' $floorItems2['Barbecue Deck'] = i w.create(TkcText,780.5,296.5, 'text'=>'Barbecue Deck', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,755,262,755,314,717,314,717,262, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '240' $floorItems2['240'] = i w.create(TkcText,736,288, 'text'=>'240', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,755,316,689,316,689,365,755,365, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '241' $floorItems2['241'] = i w.create(TkcText,722,340.5, 'text'=>'241', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,755,206,717,206,717,261,755,261, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '239' $floorItems2['239'] = i w.create(TkcText,736,233.5, 'text'=>'239', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,695,277,643,277,643,206,695,206, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '248' $floorItems2['248'] = i w.create(TkcText,669,241.5, 'text'=>'248', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,676,135,676,185,724,185,724,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '236' $floorItems2['236'] = i w.create(TkcText,700,160, 'text'=>'236', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,675,135,635,135,635,145,628,145,628,185,675,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '235' $floorItems2['235'] = i w.create(TkcText,651.5,160, 'text'=>'235', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,626,143,633,143,633,135,572,135, 572,143,579,143,579,185,626,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '234' $floorItems2['234'] = i w.create(TkcText,606,160, 'text'=>'234', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,557,135,571,135,571,145,578,145, 578,185,527,185,527,131,557,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '233' $floorItems2['233'] = i w.create(TkcText,552.5,158, 'text'=>'233', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,476,249,557,249,557,205,476,205, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '230' $floorItems2['230'] = i w.create(TkcText,516.5,227, 'text'=>'230', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,476,164,486,164,486,131,525,131,525,185,476,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '232' $floorItems2['232'] = i w.create(TkcText,500.5,158, 'text'=>'232', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,476,186,495,186,495,204,476,204, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '229' $floorItems2['229'] = i w.create(TkcText,485.5,195, 'text'=>'229', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,474,207,409,207,409,187,399,187,399,164,474,164, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '227' $floorItems2['227'] = i w.create(TkcText,436.5,185.5, 'text'=>'227', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,399,228,399,253,474,253,474,209,409,209,409,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '228' $floorItems2['228'] = i w.create(TkcText,436.5,231, 'text'=>'228', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,397,246,397,226,407,226,407,189,377,189,377,246, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '226' $floorItems2['226'] = i w.create(TkcText,392,217.5, 'text'=>'226', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,377,169,316,169,316,131,397,131,397,188,377,188, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '225' $floorItems2['225'] = i w.create(TkcText,356.5,150, 'text'=>'225', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,234,198,306,198,306,249,234,249, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '224' $floorItems2['224'] = i w.create(TkcText,270,223.5, 'text'=>'224', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,270,179,306,179,306,170,314,170,314,135,270,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '223' $floorItems2['223'] = i w.create(TkcText,292,157, 'text'=>'223', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,268,179,221,179,221,135,268,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '222' $floorItems2['222'] = i w.create(TkcText,244.5,157, 'text'=>'222', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,177,179,219,179,219,135,177,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '221' $floorItems2['221'] = i w.create(TkcText,198,157, 'text'=>'221', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,299,327,349,327,349,284,341,284,341,276,299,276, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '204' $floorItems2['204'] = i w.create(TkcText,324,301.5, 'text'=>'204', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,234,276,297,276,297,327,257,327,257,338,234,338, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '205' $floorItems2['205'] = i w.create(TkcText,265.5,307, 'text'=>'205', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,256,385,256,340,212,340,212,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '207' $floorItems2['207'] = i w.create(TkcText,234,362.5, 'text'=>'207', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,210,340,164,340,164,385,210,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '208' $floorItems2['208'] = i w.create(TkcText,187,362.5, 'text'=>'208', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,115,340,162,340,162,385,115,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '209' $floorItems2['209'] = i w.create(TkcText,138.5,362.5, 'text'=>'209', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,89,228,89,156,53,156,53,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '217' $floorItems2['217'] = i w.create(TkcText,71,192, 'text'=>'217', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,89,169,97,169,97,190,89,190, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '217A' $floorItems2['217A'] = i w.create(TkcText,93,179.5, 'text'=>'217A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,89,156,89,168,95,168,95,135,53,135,53,156, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '216' $floorItems2['216'] = i w.create(TkcText,71,145.5, 'text'=>'216', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,51,179,51,135,6,135,6,179, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '215' $floorItems2['215'] = i w.create(TkcText,28.5,157, 'text'=>'215', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,51,227,6,227,6,180,51,180, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '214' $floorItems2['214'] = i w.create(TkcText,28.5,203.5, 'text'=>'214', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,51,275,6,275,6,229,51,229, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '213' $floorItems2['213'] = i w.create(TkcText,28.5,252, 'text'=>'213', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,114,340,67,340,67,385,114,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '210' $floorItems2['210'] = i w.create(TkcText,90.5,362.5, 'text'=>'210', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,59,389,59,385,65,385,65,340,1,340,1,389, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '211' $floorItems2['211'] = i w.create(TkcText,33,364.5, 'text'=>'211', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,393,309,350,309,350,282,342,282,342,276,393,276, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '203' $floorItems2['203'] = i w.create(TkcText,367.5,292.5, 'text'=>'203', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,99,191,91,191,91,226,174,226,174,198, 154,198,154,192,109,192,109,169,99,169, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '220' $floorItems2['220'] = i w.create(TkcText,132.5,208.5, 'text'=>'220', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = 'Priv Lift2' $floorItems2['Priv Lift2'] = i w.create(TkcText,323,188, 'text'=>'Priv Lift2', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = 'Pub Lift 2' $floorItems2['Pub Lift 2'] = i w.create(TkcText,323,223, 'text'=>'Pub Lift 2', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '218' $floorItems2['218'] = i w.create(TkcText,136,149.5, 'text'=>'218', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '219' $floorItems2['219'] = i w.create(TkcText,132.5,180, 'text'=>'219', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '201' $floorItems2['201'] = i w.create(TkcText,358,209, 'text'=>'201', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) w.create(TkcLine,641,186,678,186, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,757,350,757,367, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,634,133,634,144, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,634,144,627,144, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,572,133,572,144, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,572,144,579,144, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,398,129,398,162, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,174,197,175,197, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,175,197,175,227, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,757,206,757,221, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,396,188,408,188, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,727,189,725,189, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,747,167,802,167, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,747,167,747,189, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,755,189,739,189, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,769,224,757,224, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,802,224,802,129, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,802,129,725,129, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,725,189,725,129, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,725,186,690,186, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,676,133,676,186, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,627,144,627,186, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,629,186,593,186, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,579,144,579,186, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,559,129,559,133, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,725,133,559,133, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,484,162,484,129, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,559,129,484,129, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,526,129,526,186, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,540,186,581,186, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,528,186,523,186, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,511,186,475,186, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,496,190,496,186, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,496,205,496,202, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,475,205,527,205, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,558,205,539,205, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,558,205,558,249, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,558,249,475,249, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,662,206,642,206, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,695,206,675,206, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,695,278,642,278, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,642,291,642,206, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,695,291,695,206, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,716,208,716,206, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,757,206,716,206, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,757,221,757,224, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,793,224,802,224, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,757,262,716,262, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,716,220,716,264, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,716,315,716,276, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,757,315,703,315, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,757,325,757,224, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,757,367,644,367, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,689,367,689,315, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,647,315,644,315, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,659,315,691,315, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,600,325,600,391, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,627,325,644,325, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,644,391,644,315, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,615,325,575,325, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,644,391,558,391, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,563,325,558,325, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,558,391,558,314, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,558,327,508,327, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,558,275,484,275, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,558,302,558,275, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,508,327,508,311, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,484,311,508,311, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,484,275,484,311, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,475,208,408,208, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,408,206,408,210, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,408,222,408,227, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,408,227,398,227, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,398,227,398,254, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,408,188,408,194, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,383,188,376,188, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,398,188,398,162, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,398,162,484,162, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,475,162,475,254, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,398,254,475,254, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,484,280,395,280, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,395,311,395,275, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,307,197,293,197, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,278,197,233,197, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,233,197,233,249, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,307,179,284,179, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,233,249,278,249, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,269,179,269,133, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,220,179,220,133, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,155,191,110,191, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,90,190,98,190, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,98,169,98,190, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,52,133,52,165, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,52,214,52,177, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,52,226,52,262, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,52,274,52,276, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,234,275,234,339, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,226,339,258,339, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,211,387,211,339, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,214,339,177,339, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,258,387,60,387, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,3,133,3,339, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,165,339,129,339, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,117,339,80,339, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,68,339,59,339, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,0,339,46,339, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,60,391,0,391, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,0,339,0,391, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,60,387,60,391, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,258,329,258,387, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,350,329,258,329, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,395,311,350,311, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,398,129,315,129, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,176,133,315,133, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,176,129,96,129, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,3,133,96,133, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,66,387,66,339, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,115,387,115,339, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,163,387,163,339, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,234,275,276,275, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,288,275,309,275, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,298,275,298,329, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,341,283,350,283, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,321,275,341,275, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,375,275,395,275, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,315,129,315,170, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,376,170,307,170, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,307,250,307,170, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,376,245,376,170, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,340,241,307,241, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,340,245,340,224, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,340,210,340,201, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,340,187,340,170, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,340,206,307,206, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,293,250,307,250, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,271,179,238,179, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,226,179,195,179, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,176,129,176,179, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,182,179,176,179, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,174,169,176,169, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,162,169,90,169, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,96,169,96,129, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,175,227,90,227, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,90,190,90,227, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,52,179,3,179, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,52,228,3,228, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,52,276,3,276, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,155,177,155,169, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,110,191,110,169, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,155,189,155,197, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,350,283,350,329, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,162,197,155,197, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,341,275,341,283, 'fill'=>color, 'tags'=>['floor2','wall']) end |
#floor2_fg3(w, color) ⇒ Object
floor2_fg3 – This method represents part of the floorplan database. When invoked, it instantiates the foreground information for the third floor (office outlines and numbers).
Arguments: w - The canvas window. color - Color to use for drawing foreground information.
1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 |
# File 'sample/demos-en/floor2.rb', line 1282 def floor2_fg3(w,color) i = TkcPolygon.new(w,89,228,89,180,70,180,70,228, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '316' $floorItems2['316'] = i w.create(TkcText,79.5,204, 'text'=>'316', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,115,368,162,368,162,323,115,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '309' $floorItems2['309'] = i w.create(TkcText,138.5,345.5, 'text'=>'309', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,164,323,164,368,211,368,211,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '308' $floorItems2['308'] = i w.create(TkcText,187.5,345.5, 'text'=>'308', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,256,368,212,368,212,323,256,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '307' $floorItems2['307'] = i w.create(TkcText,234,345.5, 'text'=>'307', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,244,276,297,276,297,327,260,327,260,321,244,321, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '305' $floorItems2['305'] = i w.create(TkcText,270.5,301.5, 'text'=>'305', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,251,219,251,203,244,203,244,219, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '324B' $floorItems2['324B'] = i w.create(TkcText,247.5,211, 'text'=>'324B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,251,249,244,249,244,232,251,232, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '324A' $floorItems2['324A'] = i w.create(TkcText,247.5,240.5, 'text'=>'324A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,223,135,223,179,177,179,177,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '320' $floorItems2['320'] = i w.create(TkcText,200,157, 'text'=>'320', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,114,368,114,323,67,323,67,368, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '310' $floorItems2['310'] = i w.create(TkcText,90.5,345.5, 'text'=>'310', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,23,277,23,321,68,321,68,277, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '312' $floorItems2['312'] = i w.create(TkcText,45.5,299, 'text'=>'312', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,23,229,68,229,68,275,23,275, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '313' $floorItems2['313'] = i w.create(TkcText,45.5,252, 'text'=>'313', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,68,227,23,227,23,180,68,180, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '314' $floorItems2['314'] = i w.create(TkcText,40.5,203.5, 'text'=>'314', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,95,179,95,135,23,135,23,179, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '315' $floorItems2['315'] = i w.create(TkcText,59,157, 'text'=>'315', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,99,226,99,204,91,204,91,226, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '316B' $floorItems2['316B'] = i w.create(TkcText,95,215, 'text'=>'316B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,91,202,99,202,99,180,91,180, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '316A' $floorItems2['316A'] = i w.create(TkcText,95,191, 'text'=>'316A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,97,169,109,169,109,192,154,192,154,198, 174,198,174,226,101,226,101,179,97,179, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '319' $floorItems2['319'] = i w.create(TkcText,141.5,209, 'text'=>'319', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,65,368,58,368,58,389,1,389,1,333,23,333,23,323,65,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '311' $floorItems2['311'] = i w.create(TkcText,29.5,361, 'text'=>'311', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '318' $floorItems2['318'] = i w.create(TkcText,132.5,180, 'text'=>'318', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '317' $floorItems2['317'] = i w.create(TkcText,136,149.5, 'text'=>'317', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,274,194,274,221,306,221,306,194, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '323' $floorItems2['323'] = i w.create(TkcText,290,207.5, 'text'=>'323', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,306,222,274,222,274,249,306,249, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '325' $floorItems2['325'] = i w.create(TkcText,290,235.5, 'text'=>'325', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,263,179,224,179,224,135,263,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '321' $floorItems2['321'] = i w.create(TkcText,243.5,157, 'text'=>'321', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,314,169,306,169,306,192,273,192, 264,181,264,135,314,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '322' $floorItems2['322'] = i w.create(TkcText,293.5,163.5, 'text'=>'322', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = 'Pub Lift3' $floorItems2['Pub Lift3'] = i w.create(TkcText,323,223, 'text'=>'Pub Lift3', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = 'Priv Lift3' $floorItems2['Priv Lift3'] = i w.create(TkcText,323,188, 'text'=>'Priv Lift3', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,350,284,376,284,376,276,397,276,397,309,350,309, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '303' $floorItems2['303'] = i w.create(TkcText,373.5,292.5, 'text'=>'303', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,272,203,272,249,252,249,252,230, 244,230,244,221,252,221,252,203, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '324' $floorItems2['324'] = i w.create(TkcText,262,226, 'text'=>'324', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,299,276,299,327,349,327,349,284,341,284,341,276, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '304' $floorItems2['304'] = i w.create(TkcText,324,301.5, 'text'=>'304', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '301' $floorItems2['301'] = i w.create(TkcText,358,209, 'text'=>'301', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,397,246,377,246,377,185,397,185, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '327' $floorItems2['327'] = i w.create(TkcText,387,215.5, 'text'=>'327', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,316,131,316,169,377,169,377,185,397,185,397,131, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '326' $floorItems2['326'] = i w.create(TkcText,365.5,150, 'text'=>'326', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,308,251,242,251,242,274,342,274,342,282,375, 282, 375,274,397,274,397,248,339,248,339,242,308,242, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '302' $floorItems2['302'] = i w.create(TkcText,319.5,261, 'text'=>'302', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,70,321,242,321,242,200,259,200,259,203,272,203, 272,193,263,180,242,180,175,180,175,169,156,169, 156,196,177,196,177,228,107,228,70,228,70,275,107,275, 107,248,160,248,160,301,107,301,107,275,70,275, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '306' $floorItems2['306'] = i w.create(TkcText,200.5,284.5, 'text'=>'306', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) w.create(TkcLine,341,275,341,283, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,162,197,155,197, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,396,247,399,247, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,399,129,399,311, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,258,202,243,202, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,350,283,350,329, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,251,231,243,231, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,243,220,251,220, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,243,250,243,202, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,155,197,155,190, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,110,192,110,169, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,155,192,110,192, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,155,177,155,169, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,176,197,176,227, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,69,280,69,274, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,21,276,69,276, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,69,262,69,226, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,21,228,69,228, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,21,179,75,179, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,69,179,69,214, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,90,220,90,227, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,90,204,90,202, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,90,203,100,203, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,90,187,90,179, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,90,227,176,227, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,100,179,100,227, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,100,179,87,179, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,96,179,96,129, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,162,169,96,169, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,173,169,176,169, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,182,179,176,179, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,176,129,176,179, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,195,179,226,179, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,224,133,224,179, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,264,179,264,133, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,238,179,264,179, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,273,207,273,193, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,273,235,273,250, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,273,224,273,219, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,273,193,307,193, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,273,222,307,222, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,273,250,307,250, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,384,247,376,247, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,340,206,307,206, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,340,187,340,170, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,340,210,340,201, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,340,247,340,224, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,340,241,307,241, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,376,247,376,170, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,307,250,307,170, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,376,170,307,170, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,315,129,315,170, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,376,283,366,283, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,376,283,376,275, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,399,275,376,275, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,341,275,320,275, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,341,283,350,283, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,298,275,298,329, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,308,275,298,275, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,243,322,243,275, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,243,275,284,275, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,258,322,226,322, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,212,370,212,322, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,214,322,177,322, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,163,370,163,322, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,165,322,129,322, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,84,322,117,322, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,71,322,64,322, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,115,322,115,370, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,66,322,66,370, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,52,322,21,322, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,21,331,0,331, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,21,331,21,133, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,96,133,21,133, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,176,129,96,129, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,315,133,176,133, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,315,129,399,129, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,399,311,350,311, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,350,329,258,329, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,258,322,258,370, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,60,370,258,370, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,60,370,60,391, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,0,391,0,331, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,60,391,0,391, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,307,250,307,242, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,273,250,307,250, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,258,250,243,250, 'fill'=>color, 'tags'=>['floor3','wall']) end |
#floor_bg1(w, fill, outline) ⇒ Object
floor_bg1 – This method represents part of the floorplan database. When invoked, it instantiates the background information for the first floor.
Arguments: w - The canvas window. fill - Fill color to use for the floor’s background. outline - Color to use for the floor’s outline.
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'sample/demos-en/floor.rb', line 102 def floor_bg1(w,fill,outline) TkcPolygon.new(w,347,80,349,82,351,84,353,85,363,92,375,99,386,104, 386,129,398,129,398,162,484,162,484,129,559,129,559,133,725, 133,725,129,802,129,802,389,644,389,644,391,559,391,559,327, 508,327,508,311,484,311,484,278,395,278,395,288,400,288,404, 288,409,290,413,292,418,297,421,302,422,309,421,318,417,325, 411,330,405,332,397,333,344,333,340,334,336,336,335,338,332, 342,331,347,332,351,334,354,336,357,341,359,340,360,335,363, 331,365,326,366,304,366,304,355,258,355,258,387,60,387,60,391, 0,391,0,337,3,337,3,114,8,114,8,25,30,25,30,5,93,5,98,5,104,7, 110,10,116,16,119,20,122,28,123,32,123,68,220,68,220,34,221, 22,223,17,227,13,231,8,236,4,242,2,246,0,260,0,283,1,300,5, 321,14,335,22,348,25,365,29,363,39,358,48,352,56,337,70, 344,76,347,80, 'tags'=>['floor1','bg'], 'fill'=>fill) TkcLine.new(w,386,129,398,129, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,258,355,258,387, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,60,387,60,391, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,0,337,0,391, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,60,391,0,391, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,3,114,3,337, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,258,387,60,387, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,484,162,398,162, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,398,162,398,129, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,484,278,484,311, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,484,311,508,311, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,508,327,508,311, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,559,327,508,327, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,644,391,559,391, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,644,389,644,391, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,559,129,484,129, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,484,162,484,129, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,725,133,559,133, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,559,129,559,133, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,725,129,802,129, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,802,389,802,129, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,3,337,0,337, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,559,391,559,327, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,802,389,644,389, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,725,133,725,129, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,8,25,8,114, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,8,114,3,114, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,30,25,8,25, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,484,278,395,278, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,30,25,30,5, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,93,5,30,5, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,98,5,93,5, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,104,7,98,5, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,110,10,104,7, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,116,16,110,10, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,119,20,116,16, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,122,28,119,20, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,123,32,122,28, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,123,68,123,32, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,220,68,123,68, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,386,129,386,104, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,386,104,375,99, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,375,99,363,92, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,353,85,363,92, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,220,68,220,34, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,337,70,352,56, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,352,56,358,48, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,358,48,363,39, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,363,39,365,29, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,365,29,348,25, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,348,25,335,22, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,335,22,321,14, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,321,14,300,5, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,300,5,283,1, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,283,1,260,0, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,260,0,246,0, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,246,0,242,2, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,242,2,236,4, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,236,4,231,8, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,231,8,227,13, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,223,17,227,13, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,221,22,223,17, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,220,34,221,22, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,340,360,335,363, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,335,363,331,365, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,331,365,326,366, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,326,366,304,366, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,304,355,304,366, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,395,288,400,288, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,404,288,400,288, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,409,290,404,288, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,413,292,409,290, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,418,297,413,292, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,421,302,418,297, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,422,309,421,302, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,421,318,422,309, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,421,318,417,325, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,417,325,411,330, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,411,330,405,332, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,405,332,397,333, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,397,333,344,333, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,344,333,340,334, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,340,334,336,336, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,336,336,335,338, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,335,338,332,342, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,331,347,332,342, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,332,351,331,347, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,334,354,332,351, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,336,357,334,354, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,341,359,336,357, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,341,359,340,360, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,395,288,395,278, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,304,355,258,355, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,347,80,344,76, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,344,76,337,70, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,349,82,347,80, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,351,84,349,82, 'fill'=>outline, 'tags'=>['floor1','bg']) TkcLine.new(w,353,85,351,84, 'fill'=>outline, 'tags'=>['floor1','bg']) end |
#floor_bg2(w, fill, outline) ⇒ Object
floor_bg2 – This method represents part of the floorplan database. When invoked, it instantiates the background information for the first floor.
Arguments: w - The canvas window. fill - Fill color to use for the floor’s background. outline - Color to use for the floor’s outline.
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
# File 'sample/demos-en/floor.rb', line 226 def floor_bg2(w,fill,outline) TkcPolygon.new(w,559,129,484,129,484,162,398,162,398,129,315,129, 315,133,176,133,176,129,96,129,96,133,3,133,3,339,0,339,0,391, 60,391,60,387,258,387,258,329,350,329,350,311,395,311,395,280, 484,280,484,311,508,311,508,327,558,327,558,391,644,391,644, 367,802,367,802,129,725,129,725,133,559,133,559,129, 'tags'=>['floor2','bg'], 'fill'=>fill) TkcLine.new(w,350,311,350,329, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,398,129,398,162, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,802,367,802,129, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,802,129,725,129, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,725,133,725,129, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,559,129,559,133, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,559,133,725,133, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,484,162,484,129, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,559,129,484,129, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,802,367,644,367, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,644,367,644,391, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,644,391,558,391, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,558,327,558,391, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,558,327,508,327, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,508,327,508,311, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,484,311,508,311, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,484,280,484,311, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,398,162,484,162, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,484,280,395,280, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,395,280,395,311, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,258,387,60,387, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,3,133,3,339, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,3,339,0,339, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,60,391,0,391, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,0,339,0,391, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,60,387,60,391, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,258,329,258,387, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,350,329,258,329, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,395,311,350,311, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,398,129,315,129, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,176,133,315,133, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,176,129,96,129, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,3,133,96,133, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,315,133,315,129, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,176,133,176,129, 'fill'=>outline, 'tags'=>['floor2','bg']) TkcLine.new(w,96,133,96,129, 'fill'=>outline, 'tags'=>['floor2','bg']) end |
#floor_bg3(w, fill, outline) ⇒ Object
floor_bg3 – This method represents part of the floorplan database. When invoked, it instantiates the background information for the first floor.
Arguments: w - The canvas window. fill - Fill color to use for the floor’s background. outline - Color to use for the floor’s outline.
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 |
# File 'sample/demos-en/floor.rb', line 281 def floor_bg3(w,fill,outline) TkcPolygon.new(w,159,300,107,300,107,248,159,248,159,129,96,129,96, 133,21,133,21,331,0,331,0,391,60,391,60,370,159,370,159,300, 'tags'=>['floor3','bg'], 'fill'=>fill) TkcPolygon.new(w,258,370,258,329,350,329,350,311,399,311,399,129, 315,129,315,133,176,133,176,129,159,129,159,370,258,370, 'tags'=>['floor3','bg'], 'fill'=>fill) TkcLine.new(w,96,133,96,129, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,176,129,96,129, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,176,129,176,133, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,315,133,176,133, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,315,133,315,129, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,399,129,315,129, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,399,311,399,129, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,399,311,350,311, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,350,329,350,311, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,350,329,258,329, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,258,370,258,329, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,60,370,258,370, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,60,370,60,391, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,60,391,0,391, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,0,391,0,331, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,21,331,0,331, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,21,331,21,133, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,96,133,21,133, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,107,300,159,300,159,248,107,248,107,300, 'fill'=>outline, 'tags'=>['floor3','bg']) end |
#floor_fg1(w, color) ⇒ Object
floor_fg1 – This method represents part of the floorplan database. When invoked, it instantiates the foreground information for the first floor (office outlines and numbers).
Arguments: w - The canvas window. color - Color to use for drawing foreground information.
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 |
# File 'sample/demos-en/floor.rb', line 319 def floor_fg1(w,color) i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '101' $floorItems['101'] = i TkcText.new(w,358,209, 'text'=>'101', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Pub Lift1' $floorItems['Pub Lift1'] = i TkcText.new(w,323,223, 'text'=>'Pub Lift1', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Priv Lift1' $floorItems['Priv Lift1'] = i TkcText.new(w,323,188, 'text'=>'Priv Lift1', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,42,389,42,337,1,337,1,389, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '110' $floorItems['110'] = i TkcText.new(w,21.5,363, 'text'=>'110', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,59,389,59,385,90,385,90,337,44,337,44,389, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '109' $floorItems['109'] = i TkcText.new(w,67,363, 'text'=>'109', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,51,300,51,253,6,253,6,300, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '111' $floorItems['111'] = i TkcText.new(w,28.5,276.5, 'text'=>'111', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,98,248,98,309,79,309,79,248, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '117B' $floorItems['117B'] = i TkcText.new(w,88.5,278.5, 'text'=>'117B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,51,251,51,204,6,204,6,251, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '112' $floorItems['112'] = i TkcText.new(w,28.5,227.5, 'text'=>'112', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,6,156,51,156,51,203,6,203, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '113' $floorItems['113'] = i TkcText.new(w,28.5,179.5, 'text'=>'113', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,85,169,79,169,79,192,85,192, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '117A' $floorItems['117A'] = i TkcText.new(w,82,180.5, 'text'=>'117A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,77,302,77,168,53,168,53,302, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '117' $floorItems['117'] = i TkcText.new(w,65,235, 'text'=>'117', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,51,155,51,115,6,115,6,155, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '114' $floorItems['114'] = i TkcText.new(w,28.5,135, 'text'=>'114', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,95,115,53,115,53,168,95,168, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '115' $floorItems['115'] = i TkcText.new(w,74,141.5, 'text'=>'115', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,87,113,87,27,10,27,10,113, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '116' $floorItems['116'] = i TkcText.new(w,48.5,70, 'text'=>'116', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,89,91,128,91,128,113,89,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '118' $floorItems['118'] = i TkcText.new(w,108.5,102, 'text'=>'118', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,178,128,178,132,216,132,216,91, 163,91,163,112,149,112,149,128, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '120' $floorItems['120'] = i TkcText.new(w,189.5,111.5, 'text'=>'120', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,79,193,87,193,87,169,136,169,136,192, 156,192,156,169,175,169,175,246,79,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '122' $floorItems['122'] = i TkcText.new(w,131,207.5, 'text'=>'122', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,138,169,154,169,154,191,138,191, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '121' $floorItems['121'] = i TkcText.new(w,146,180, 'text'=>'121', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,99,300,126,300,126,309,99,309, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '106A' $floorItems['106A'] = i TkcText.new(w,112.5,304.5, 'text'=>'106A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,128,299,128,309,150,309,150,248,99,248,99,299, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '105' $floorItems['105'] = i TkcText.new(w,124.5,278.5, 'text'=>'105', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,174,309,174,300,152,300,152,309, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '106B' $floorItems['106B'] = i TkcText.new(w,163,304.5, 'text'=>'106B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,176,299,176,309,216,309,216,248,152,248,152,299, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '104' $floorItems['104'] = i TkcText.new(w,184,278.5, 'text'=>'104', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,138,385,138,337,91,337,91,385, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '108' $floorItems['108'] = i TkcText.new(w,114.5,361, 'text'=>'108', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,256,337,140,337,140,385,256,385, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '107' $floorItems['107'] = i TkcText.new(w,198,361, 'text'=>'107', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,300,353,300,329,260,329,260,353, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Smoking' $floorItems['Smoking'] = i TkcText.new(w,280,341, 'text'=>'Smoking', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,314,135,314,170,306,170,306,246,177,246,177,135, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '123' $floorItems['123'] = i TkcText.new(w,245.5,190.5, 'text'=>'123', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,217,248,301,248,301,326,257,326,257,310,217,310, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '103' $floorItems['103'] = i TkcText.new(w,259,287, 'text'=>'103', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,396,188,377,188,377,169,316,169,316,131,396,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '124' $floorItems['124'] = i TkcText.new(w,356,150, 'text'=>'124', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,397,226,407,226,407,189,377,189,377,246,397,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '125' $floorItems['125'] = i TkcText.new(w,392,217.5, 'text'=>'125', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,399,187,409,187,409,207,474,207,474,164,399,164, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '126' $floorItems['126'] = i TkcText.new(w,436.5,185.5, 'text'=>'126', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,409,209,409,229,399,229,399,253, 486,253,486,239,474,239,474,209, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '127' $floorItems['127'] = i TkcText.new(w,436.5,'231', 'text'=>'127', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,501,164,501,174,495,174,495,188, 490,188,490,204,476,204,476,164, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'MShower' $floorItems['MShower'] = i TkcText.new(w,488.5,'184', 'text'=>'MShower', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,497,176,513,176,513,204,492,204,492,190,497,190, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Closet' $floorItems['Closet'] = i TkcText.new(w,502.5,190, 'text'=>'Closet', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,476,237,476,206,513,206,513,254,488,254,488,237, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'WShower' $floorItems['WShower'] = i TkcText.new(w,494.5,230, 'text'=>'WShower', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,486,131,558,131,558,135,724,135,724,166, 697,166,697,275,553,275,531,254,515,254, 515,174,503,174,503,161,486,161, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '130' $floorItems['130'] = i TkcText.new(w,638.5,205, 'text'=>'130', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,308,242,339,242,339,248,342,248, 342,246,397,246,397,276,393,276, 393,309,300,309,300,248,308,248, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '102' $floorItems['102'] = i TkcText.new(w,367.5,278.5, 'text'=>'102', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,397,255,486,255,486,276,397,276, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '128' $floorItems['128'] = i TkcText.new(w,441.5,265.5, 'text'=>'128', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,510,309,486,309,486,255,530,255, 552,277,561,277,561,325,510,325, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '129' $floorItems['129'] = i TkcText.new(w,535.5,293, 'text'=>'129', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,696,281,740,281,740,387,642,387, 642,389,561,389,561,277,696,277, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '133' $floorItems['133'] = i TkcText.new(w,628.5,335, 'text'=>'133', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,742,387,742,281,800,281,800,387, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '132' $floorItems['132'] = i TkcText.new(w,771,334, 'text'=>'132', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,800,168,800,280,699,280,699,168, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '134' $floorItems['134'] = i TkcText.new(w,749.5,224, 'text'=>'134', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,726,131,726,166,800,166,800,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '135' $floorItems['135'] = i TkcText.new(w,763,148.5, 'text'=>'135', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,340,360,335,363,331,365,326,366,304,366, 304,312,396,312,396,288,400,288,404,288, 409,290,413,292,418,297,421,302,422,309, 421,318,417,325,411,330,405,332,397,333, 344,333,340,334,336,336,335,338,332,342, 331,347,332,351,334,354,336,357,341,359, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Ramona Stair' $floorItems['Ramona Stair'] = i TkcText.new(w,368,323, 'text'=>'Ramona Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,30,23,30,5,93,5,98,5,104,7,110,10,116,16,119,20, 122,28,123,32,123,68,220,68,220,87,90,87,90,23, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'University Stair' $floorItems['University Stair'] = i TkcText.new(w,155,77.5, 'text'=>'University Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,282,37,295,40,312,49,323,56,337,70,352,56, 358,48,363,39,365,29,348,25,335,22,321,14, 300,5,283,1,260,0,246,0,242,2,236,4,231,8, 227,13,223,17,221,22,220,34,260,34, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Plaza Stair' $floorItems['Plaza Stair'] = i TkcText.new(w,317.5,28.5, 'text'=>'Plaza Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,220,34,260,34,282,37,295,40,312,49, 323,56,337,70,350,83,365,94,377,100, 386,104,386,128,220,128, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Plaza Deck' $floorItems['Plaza Deck'] = i TkcText.new(w,303,81, 'text'=>'Plaza Deck', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,257,336,77,336,6,336,6,301,77,301,77,310,257,310, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '106' $floorItems['106'] = i TkcText.new(w,131.5,318.5, 'text'=>'106', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,146,110,162,110,162,91,130,91,130,115,95,115, 95,128,114,128,114,151,157,151,157,153,112,153, 112,130,97,130,97,168,175,168,175,131,146,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '119' $floorItems['119'] = i TkcText.new(w,143.5,133, 'text'=>'119', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) TkcLine.new(w,155,191,155,189, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,155,177,155,169, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,96,129,96,169, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,78,169,176,169, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,176,247,176,129, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,340,206,307,206, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,340,187,340,170, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,340,210,340,201, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,340,247,340,224, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,340,241,307,241, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,376,246,376,170, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,307,247,307,170, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,376,170,307,170, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,315,129,315,170, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,147,129,176,129, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,202,133,176,133, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,398,129,315,129, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,258,352,258,387, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,60,387,60,391, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,0,337,0,391, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,60,391,0,391, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,3,114,3,337, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,258,387,60,387, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,52,237,52,273, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,52,189,52,225, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,52,140,52,177, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,395,306,395,311, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,531,254,398,254, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,475,178,475,238, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,502,162,398,162, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,398,129,398,188, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,383,188,376,188, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,408,188,408,194, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,398,227,398,254, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,408,227,398,227, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,408,222,408,227, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,408,206,408,210, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,408,208,475,208, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,484,278,484,311, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,484,311,508,311, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,508,327,508,311, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,559,327,508,327, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,644,391,559,391, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,644,389,644,391, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,514,205,475,205, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,496,189,496,187, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,559,129,484,129, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,484,162,484,129, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,725,133,559,133, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,559,129,559,133, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,725,149,725,167, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,725,129,802,129, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,802,389,802,129, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,739,167,802,167, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,396,188,408,188, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,0,337,9,337, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,58,337,21,337, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,43,391,43,337, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,105,337,75,337, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,91,387,91,337, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,154,337,117,337, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,139,387,139,337, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,227,337,166,337, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,258,337,251,337, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,258,328,302,328, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,302,355,302,311, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,395,311,302,311, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,484,278,395,278, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,395,294,395,278, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,473,278,473,275, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,473,256,473,254, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,533,257,531,254, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,553,276,551,274, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,698,276,553,276, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,559,391,559,327, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,802,389,644,389, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,741,314,741,389, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,698,280,698,167, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,707,280,698,280, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,802,280,731,280, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,741,280,741,302, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,698,167,727,167, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,725,137,725,129, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,514,254,514,175, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,496,175,514,175, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,502,175,502,162, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,475,166,475,162, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,496,176,496,175, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,491,189,496,189, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,491,205,491,189, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,487,238,475,238, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,487,240,487,238, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,487,252,487,254, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,315,133,304,133, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,256,133,280,133, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,78,247,270,247, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,307,247,294,247, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,214,133,232,133, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,217,247,217,266, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,217,309,217,291, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,217,309,172,309, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,154,309,148,309, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,175,300,175,309, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,151,300,175,300, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,151,247,151,309, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,78,237,78,265, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,78,286,78,309, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,106,309,78,309, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,130,309,125,309, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,99,309,99,247, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,127,299,99,299, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,127,309,127,299, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,155,191,137,191, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,137,169,137,191, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,78,171,78,169, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,78,190,78,218, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,86,192,86,169, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,86,192,78,192, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,52,301,3,301, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,52,286,52,301, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,52,252,3,252, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,52,203,3,203, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,3,156,52,156, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,8,25,8,114, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,63,114,3,114, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,75,114,97,114, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,108,114,129,114, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,129,114,129,89, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,52,114,52,128, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,132,89,88,89, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,88,25,88,89, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,88,114,88,89, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,218,89,144,89, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,147,111,147,129, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,162,111,147,111, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,162,109,162,111, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,162,96,162,89, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,218,89,218,94, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,218,89,218,119, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,8,25,88,25, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,258,337,258,328, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,113,129,96,129, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,302,355,258,355, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,386,104,386,129, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,377,100,386,104, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,365,94,377,100, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,350,83,365,94, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,337,70,350,83, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,337,70,323,56, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,312,49,323,56, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,295,40,312,49, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,282,37,295,40, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,260,34,282,37, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,253,34,260,34, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,386,128,386,104, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,113,152,156,152, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,113,152,156,152, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,113,152,113,129, 'fill'=>color, 'tags'=>['floor1','wall']) end |
#floor_fg2(w, color) ⇒ Object
floor_fg2 – This method represents part of the floorplan database. When invoked, it instantiates the foreground information for the second floor (office outlines and numbers).
Arguments: w - The canvas window. color - Color to use for drawing foreground information.
800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 |
# File 'sample/demos-en/floor.rb', line 800 def floor_fg2(w,color) i = TkcPolygon.new(w,748,188,755,188,755,205,758,205,758,222, 800,222,800,168,748,168, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '238' $floorItems['238'] = i TkcText.new(w,774,195, 'text'=>'238', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,726,188,746,188,746,166,800,166,800,131,726,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '237' $floorItems['237'] = i TkcText.new(w,763,148.5, 'text'=>'237', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,497,187,497,204,559,204,559,324,641,324, 643,324,643,291,641,291,641,205,696,205, 696,291,694,291,694,314,715,314,715,291, 715,205,755,205,755,190,724,190,724,187, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '246' $floorItems['246'] = i TkcText.new(w,600,264, 'text'=>'246', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,694,279,643,279,643,314,694,314, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '247' $floorItems['247'] = i TkcText.new(w,668.5,296.5, 'text'=>'247', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,232,250,308,250,308,242,339,242,339,246, 397,246,397,255,476,255,476,250,482,250,559,250, 559,274,482,274,482,278,396,278,396,274,232,274, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '202' $floorItems['202'] = i TkcText.new(w,285.5,260, 'text'=>'202', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,53,228,53,338,176,338,233,338,233,196, 306,196,306,180,175,180,175,169,156,169, 156,196,176,196,176,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '206' $floorItems['206'] = i TkcText.new(w,143,267, 'text'=>'206', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,51,277,6,277,6,338,51,338, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '212' $floorItems['212'] = i TkcText.new(w,28.5,307.5, 'text'=>'212', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,557,276,486,276,486,309,510,309,510,325,557,325, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '245' $floorItems['245'] = i TkcText.new(w,521.5,300.5, 'text'=>'245', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,560,389,599,389,599,326,560,326, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '244' $floorItems['244'] = i TkcText.new(w,579.5,357.5, 'text'=>'244', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,601,389,601,326,643,326,643,389, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '243' $floorItems['243'] = i TkcText.new(w,622,357.5, 'text'=>'243', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,688,316,645,316,645,365,688,365, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '242' $floorItems['242'] = i TkcText.new(w,666.5,340.5, 'text'=>'242', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,802,367,759,367,759,226,802,226, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = 'Barbecue Deck' $floorItems['Barbecue Deck'] = i TkcText.new(w,780.5,296.5, 'text'=>'Barbecue Deck', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,755,262,755,314,717,314,717,262, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '240' $floorItems['240'] = i TkcText.new(w,736,288, 'text'=>'240', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,755,316,689,316,689,365,755,365, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '241' $floorItems['241'] = i TkcText.new(w,722,340.5, 'text'=>'241', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,755,206,717,206,717,261,755,261, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '239' $floorItems['239'] = i TkcText.new(w,736,233.5, 'text'=>'239', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,695,277,643,277,643,206,695,206, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '248' $floorItems['248'] = i TkcText.new(w,669,241.5, 'text'=>'248', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,676,135,676,185,724,185,724,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '236' $floorItems['236'] = i TkcText.new(w,700,160, 'text'=>'236', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,675,135,635,135,635,145,628,145,628,185,675,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '235' $floorItems['235'] = i TkcText.new(w,651.5,160, 'text'=>'235', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,626,143,633,143,633,135,572,135, 572,143,579,143,579,185,626,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '234' $floorItems['234'] = i TkcText.new(w,606,160, 'text'=>'234', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,557,135,571,135,571,145,578,145, 578,185,527,185,527,131,557,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '233' $floorItems['233'] = i TkcText.new(w,552.5,158, 'text'=>'233', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,476,249,557,249,557,205,476,205, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '230' $floorItems['230'] = i TkcText.new(w,516.5,227, 'text'=>'230', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,476,164,486,164,486,131,525,131,525,185,476,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '232' $floorItems['232'] = i TkcText.new(w,500.5,158, 'text'=>'232', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,476,186,495,186,495,204,476,204, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '229' $floorItems['229'] = i TkcText.new(w,485.5,195, 'text'=>'229', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,474,207,409,207,409,187,399,187,399,164,474,164, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '227' $floorItems['227'] = i TkcText.new(w,436.5,185.5, 'text'=>'227', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,399,228,399,253,474,253,474,209,409,209,409,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '228' $floorItems['228'] = i TkcText.new(w,436.5,231, 'text'=>'228', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,397,246,397,226,407,226,407,189,377,189,377,246, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '226' $floorItems['226'] = i TkcText.new(w,392,217.5, 'text'=>'226', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,377,169,316,169,316,131,397,131,397,188,377,188, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '225' $floorItems['225'] = i TkcText.new(w,356.5,150, 'text'=>'225', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,234,198,306,198,306,249,234,249, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '224' $floorItems['224'] = i TkcText.new(w,270,223.5, 'text'=>'224', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,270,179,306,179,306,170,314,170,314,135,270,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '223' $floorItems['223'] = i TkcText.new(w,292,157, 'text'=>'223', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,268,179,221,179,221,135,268,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '222' $floorItems['222'] = i TkcText.new(w,244.5,157, 'text'=>'222', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,177,179,219,179,219,135,177,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '221' $floorItems['221'] = i TkcText.new(w,198,157, 'text'=>'221', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,299,327,349,327,349,284,341,284,341,276,299,276, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '204' $floorItems['204'] = i TkcText.new(w,324,301.5, 'text'=>'204', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,234,276,297,276,297,327,257,327,257,338,234,338, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '205' $floorItems['205'] = i TkcText.new(w,265.5,307, 'text'=>'205', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,256,385,256,340,212,340,212,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '207' $floorItems['207'] = i TkcText.new(w,234,362.5, 'text'=>'207', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,210,340,164,340,164,385,210,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '208' $floorItems['208'] = i TkcText.new(w,187,362.5, 'text'=>'208', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,115,340,162,340,162,385,115,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '209' $floorItems['209'] = i TkcText.new(w,138.5,362.5, 'text'=>'209', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,89,228,89,156,53,156,53,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '217' $floorItems['217'] = i TkcText.new(w,71,192, 'text'=>'217', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,89,169,97,169,97,190,89,190, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '217A' $floorItems['217A'] = i TkcText.new(w,93,179.5, 'text'=>'217A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,89,156,89,168,95,168,95,135,53,135,53,156, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '216' $floorItems['216'] = i TkcText.new(w,71,145.5, 'text'=>'216', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,51,179,51,135,6,135,6,179, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '215' $floorItems['215'] = i TkcText.new(w,28.5,157, 'text'=>'215', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,51,227,6,227,6,180,51,180, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '214' $floorItems['214'] = i TkcText.new(w,28.5,203.5, 'text'=>'214', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,51,275,6,275,6,229,51,229, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '213' $floorItems['213'] = i TkcText.new(w,28.5,252, 'text'=>'213', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,114,340,67,340,67,385,114,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '210' $floorItems['210'] = i TkcText.new(w,90.5,362.5, 'text'=>'210', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,59,389,59,385,65,385,65,340,1,340,1,389, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '211' $floorItems['211'] = i TkcText.new(w,33,364.5, 'text'=>'211', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,393,309,350,309,350,282,342,282,342,276,393,276, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '203' $floorItems['203'] = i TkcText.new(w,367.5,292.5, 'text'=>'203', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,99,191,91,191,91,226,174,226,174,198, 154,198,154,192,109,192,109,169,99,169, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '220' $floorItems['220'] = i TkcText.new(w,132.5,208.5, 'text'=>'220', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = 'Priv Lift2' $floorItems['Priv Lift2'] = i TkcText.new(w,323,188, 'text'=>'Priv Lift2', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = 'Pub Lift 2' $floorItems['Pub Lift 2'] = i TkcText.new(w,323,223, 'text'=>'Pub Lift 2', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '218' $floorItems['218'] = i TkcText.new(w,136,149.5, 'text'=>'218', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '219' $floorItems['219'] = i TkcText.new(w,132.5,180, 'text'=>'219', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '201' $floorItems['201'] = i TkcText.new(w,358,209, 'text'=>'201', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) TkcLine.new(w,641,186,678,186, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,757,350,757,367, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,634,133,634,144, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,634,144,627,144, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,572,133,572,144, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,572,144,579,144, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,398,129,398,162, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,174,197,175,197, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,175,197,175,227, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,757,206,757,221, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,396,188,408,188, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,727,189,725,189, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,747,167,802,167, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,747,167,747,189, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,755,189,739,189, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,769,224,757,224, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,802,224,802,129, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,802,129,725,129, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,725,189,725,129, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,725,186,690,186, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,676,133,676,186, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,627,144,627,186, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,629,186,593,186, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,579,144,579,186, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,559,129,559,133, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,725,133,559,133, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,484,162,484,129, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,559,129,484,129, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,526,129,526,186, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,540,186,581,186, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,528,186,523,186, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,511,186,475,186, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,496,190,496,186, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,496,205,496,202, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,475,205,527,205, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,558,205,539,205, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,558,205,558,249, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,558,249,475,249, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,662,206,642,206, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,695,206,675,206, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,695,278,642,278, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,642,291,642,206, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,695,291,695,206, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,716,208,716,206, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,757,206,716,206, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,757,221,757,224, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,793,224,802,224, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,757,262,716,262, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,716,220,716,264, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,716,315,716,276, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,757,315,703,315, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,757,325,757,224, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,757,367,644,367, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,689,367,689,315, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,647,315,644,315, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,659,315,691,315, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,600,325,600,391, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,627,325,644,325, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,644,391,644,315, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,615,325,575,325, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,644,391,558,391, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,563,325,558,325, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,558,391,558,314, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,558,327,508,327, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,558,275,484,275, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,558,302,558,275, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,508,327,508,311, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,484,311,508,311, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,484,275,484,311, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,475,208,408,208, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,408,206,408,210, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,408,222,408,227, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,408,227,398,227, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,398,227,398,254, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,408,188,408,194, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,383,188,376,188, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,398,188,398,162, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,398,162,484,162, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,475,162,475,254, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,398,254,475,254, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,484,280,395,280, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,395,311,395,275, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,307,197,293,197, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,278,197,233,197, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,233,197,233,249, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,307,179,284,179, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,233,249,278,249, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,269,179,269,133, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,220,179,220,133, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,155,191,110,191, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,90,190,98,190, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,98,169,98,190, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,52,133,52,165, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,52,214,52,177, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,52,226,52,262, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,52,274,52,276, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,234,275,234,339, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,226,339,258,339, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,211,387,211,339, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,214,339,177,339, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,258,387,60,387, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,3,133,3,339, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,165,339,129,339, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,117,339,80,339, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,68,339,59,339, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,0,339,46,339, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,60,391,0,391, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,0,339,0,391, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,60,387,60,391, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,258,329,258,387, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,350,329,258,329, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,395,311,350,311, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,398,129,315,129, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,176,133,315,133, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,176,129,96,129, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,3,133,96,133, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,66,387,66,339, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,115,387,115,339, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,163,387,163,339, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,234,275,276,275, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,288,275,309,275, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,298,275,298,329, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,341,283,350,283, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,321,275,341,275, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,375,275,395,275, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,315,129,315,170, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,376,170,307,170, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,307,250,307,170, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,376,245,376,170, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,340,241,307,241, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,340,245,340,224, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,340,210,340,201, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,340,187,340,170, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,340,206,307,206, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,293,250,307,250, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,271,179,238,179, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,226,179,195,179, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,176,129,176,179, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,182,179,176,179, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,174,169,176,169, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,162,169,90,169, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,96,169,96,129, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,175,227,90,227, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,90,190,90,227, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,52,179,3,179, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,52,228,3,228, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,52,276,3,276, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,155,177,155,169, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,110,191,110,169, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,155,189,155,197, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,350,283,350,329, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,162,197,155,197, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,341,275,341,283, 'fill'=>color, 'tags'=>['floor2','wall']) end |
#floor_fg3(w, color) ⇒ Object
floor_fg3 – This method represents part of the floorplan database. When invoked, it instantiates the foreground information for the third floor (office outlines and numbers).
Arguments: w - The canvas window. color - Color to use for drawing foreground information.
1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 |
# File 'sample/demos-en/floor.rb', line 1282 def floor_fg3(w,color) i = TkcPolygon.new(w,89,228,89,180,70,180,70,228, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '316' $floorItems['316'] = i TkcText.new(w,79.5,204, 'text'=>'316', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,115,368,162,368,162,323,115,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '309' $floorItems['309'] = i TkcText.new(w,138.5,345.5, 'text'=>'309', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,164,323,164,368,211,368,211,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '308' $floorItems['308'] = i TkcText.new(w,187.5,345.5, 'text'=>'308', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,256,368,212,368,212,323,256,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '307' $floorItems['307'] = i TkcText.new(w,234,345.5, 'text'=>'307', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,244,276,297,276,297,327,260,327,260,321,244,321, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '305' $floorItems['305'] = i TkcText.new(w,270.5,301.5, 'text'=>'305', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,251,219,251,203,244,203,244,219, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '324B' $floorItems['324B'] = i TkcText.new(w,247.5,211, 'text'=>'324B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,251,249,244,249,244,232,251,232, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '324A' $floorItems['324A'] = i TkcText.new(w,247.5,240.5, 'text'=>'324A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,223,135,223,179,177,179,177,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '320' $floorItems['320'] = i TkcText.new(w,200,157, 'text'=>'320', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,114,368,114,323,67,323,67,368, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '310' $floorItems['310'] = i TkcText.new(w,90.5,345.5, 'text'=>'310', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,23,277,23,321,68,321,68,277, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '312' $floorItems['312'] = i TkcText.new(w,45.5,299, 'text'=>'312', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,23,229,68,229,68,275,23,275, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '313' $floorItems['313'] = i TkcText.new(w,45.5,252, 'text'=>'313', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,68,227,23,227,23,180,68,180, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '314' $floorItems['314'] = i TkcText.new(w,40.5,203.5, 'text'=>'314', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,95,179,95,135,23,135,23,179, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '315' $floorItems['315'] = i TkcText.new(w,59,157, 'text'=>'315', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,99,226,99,204,91,204,91,226, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '316B' $floorItems['316B'] = i TkcText.new(w,95,215, 'text'=>'316B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,91,202,99,202,99,180,91,180, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '316A' $floorItems['316A'] = i TkcText.new(w,95,191, 'text'=>'316A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,97,169,109,169,109,192,154,192,154,198, 174,198,174,226,101,226,101,179,97,179, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '319' $floorItems['319'] = i TkcText.new(w,141.5,209, 'text'=>'319', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,65,368,58,368,58,389,1,389,1,333,23,333,23,323,65,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '311' $floorItems['311'] = i TkcText.new(w,29.5,361, 'text'=>'311', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '318' $floorItems['318'] = i TkcText.new(w,132.5,180, 'text'=>'318', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '317' $floorItems['317'] = i TkcText.new(w,136,149.5, 'text'=>'317', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,274,194,274,221,306,221,306,194, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '323' $floorItems['323'] = i TkcText.new(w,290,207.5, 'text'=>'323', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,306,222,274,222,274,249,306,249, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '325' $floorItems['325'] = i TkcText.new(w,290,235.5, 'text'=>'325', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,263,179,224,179,224,135,263,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '321' $floorItems['321'] = i TkcText.new(w,243.5,157, 'text'=>'321', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,314,169,306,169,306,192,273,192, 264,181,264,135,314,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '322' $floorItems['322'] = i TkcText.new(w,293.5,163.5, 'text'=>'322', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = 'Pub Lift3' $floorItems['Pub Lift3'] = i TkcText.new(w,323,223, 'text'=>'Pub Lift3', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = 'Priv Lift3' $floorItems['Priv Lift3'] = i TkcText.new(w,323,188, 'text'=>'Priv Lift3', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,350,284,376,284,376,276,397,276,397,309,350,309, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '303' $floorItems['303'] = i TkcText.new(w,373.5,292.5, 'text'=>'303', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,272,203,272,249,252,249,252,230, 244,230,244,221,252,221,252,203, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '324' $floorItems['324'] = i TkcText.new(w,262,226, 'text'=>'324', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,299,276,299,327,349,327,349,284,341,284,341,276, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '304' $floorItems['304'] = i TkcText.new(w,324,301.5, 'text'=>'304', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '301' $floorItems['301'] = i TkcText.new(w,358,209, 'text'=>'301', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,397,246,377,246,377,185,397,185, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '327' $floorItems['327'] = i TkcText.new(w,387,215.5, 'text'=>'327', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,316,131,316,169,377,169,377,185,397,185,397,131, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '326' $floorItems['326'] = i TkcText.new(w,365.5,150, 'text'=>'326', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,308,251,242,251,242,274,342,274,342,282,375, 282, 375,274,397,274,397,248,339,248,339,242,308,242, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '302' $floorItems['302'] = i TkcText.new(w,319.5,261, 'text'=>'302', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,70,321,242,321,242,200,259,200,259,203,272,203, 272,193,263,180,242,180,175,180,175,169,156,169, 156,196,177,196,177,228,107,228,70,228,70,275,107,275, 107,248,160,248,160,301,107,301,107,275,70,275, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '306' $floorItems['306'] = i TkcText.new(w,200.5,284.5, 'text'=>'306', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) TkcLine.new(w,341,275,341,283, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,162,197,155,197, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,396,247,399,247, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,399,129,399,311, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,258,202,243,202, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,350,283,350,329, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,251,231,243,231, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,243,220,251,220, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,243,250,243,202, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,155,197,155,190, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,110,192,110,169, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,155,192,110,192, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,155,177,155,169, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,176,197,176,227, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,69,280,69,274, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,21,276,69,276, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,69,262,69,226, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,21,228,69,228, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,21,179,75,179, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,69,179,69,214, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,90,220,90,227, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,90,204,90,202, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,90,203,100,203, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,90,187,90,179, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,90,227,176,227, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,100,179,100,227, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,100,179,87,179, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,96,179,96,129, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,162,169,96,169, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,173,169,176,169, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,182,179,176,179, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,176,129,176,179, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,195,179,226,179, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,224,133,224,179, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,264,179,264,133, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,238,179,264,179, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,273,207,273,193, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,273,235,273,250, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,273,224,273,219, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,273,193,307,193, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,273,222,307,222, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,273,250,307,250, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,384,247,376,247, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,340,206,307,206, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,340,187,340,170, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,340,210,340,201, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,340,247,340,224, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,340,241,307,241, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,376,247,376,170, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,307,250,307,170, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,376,170,307,170, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,315,129,315,170, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,376,283,366,283, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,376,283,376,275, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,399,275,376,275, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,341,275,320,275, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,341,283,350,283, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,298,275,298,329, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,308,275,298,275, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,243,322,243,275, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,243,275,284,275, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,258,322,226,322, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,212,370,212,322, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,214,322,177,322, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,163,370,163,322, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,165,322,129,322, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,84,322,117,322, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,71,322,64,322, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,115,322,115,370, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,66,322,66,370, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,52,322,21,322, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,21,331,0,331, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,21,331,21,133, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,96,133,21,133, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,176,129,96,129, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,315,133,176,133, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,315,129,399,129, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,399,311,350,311, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,350,329,258,329, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,258,322,258,370, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,60,370,258,370, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,60,370,60,391, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,0,391,0,331, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,60,391,0,391, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,307,250,307,242, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,273,250,307,250, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,258,250,243,250, 'fill'=>color, 'tags'=>['floor3','wall']) end |
#floorDisplay(w, active) ⇒ Object
floorDisplay – Recreate the floorplan display in the canvas given by “w”. The floor given by “active” is displayed on top with its office structure visible.
Arguments: w - Name of the canvas window. active - Number of active floor (1, 2, or 3).
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'sample/demos-en/floor.rb', line 19 def floorDisplay(w,active) return if $activeFloor == active w.delete('all') $activeFloor = active # First go through the three floors, displaying the backgrounds for # each floor. floor_bg1(w,$floor_colors['bg1'],$floor_colors['outline1']) floor_bg2(w,$floor_colors['bg2'],$floor_colors['outline2']) floor_bg3(w,$floor_colors['bg3'],$floor_colors['outline3']) # Raise the background for the active floor so that it's on top. w.raise("floor#{active}") # Create a dummy item just to mark this point in the display list, # so we can insert highlights here. TkcRectangle.new(w,0,100,1,101, 'fill'=>'', 'outline'=>'', 'tags'=>'marker') # Add the walls and labels for the active floor, along with # transparent polygons that define the rooms on the floor. # Make sure that the room polygons are on top. $floorLabels.clear $floorItems.clear send("floor_fg#{active}", w, $floor_colors['offices']) w.raise('room') # Offset the floors diagonally from each other. w.move('floor1', '2c', '2c') w.move('floor2', '1c', '1c') # Create items for the room entry and its label. TkcWindow.new(w, 600, 100, 'anchor'=>'w', 'window'=>$floor_entry) TkcText.new(w, 600, 100, 'anchor'=>'e', 'text'=>"Room: ") w['scrollregion'] = w.bbox('all') end |
#floorDisplay2(w, active) ⇒ Object
floorDisplay2 – Recreate the floorplan display in the canvas given by “w”. The floor given by “active” is displayed on top with its office structure visible.
Arguments: w - Name of the canvas window. active - Number of active floor (1, 2, or 3).
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'sample/demos-en/floor2.rb', line 19 def floorDisplay2(w,active) return if $activeFloor2 == active w.delete('all') $activeFloor2 = active # First go through the three floors, displaying the backgrounds for # each floor. floor2_bg1(w,$floor2_colors['bg1'],$floor2_colors['outline1']) floor2_bg2(w,$floor2_colors['bg2'],$floor2_colors['outline2']) floor2_bg3(w,$floor2_colors['bg3'],$floor2_colors['outline3']) # Raise the background for the active floor so that it's on top. w.raise("floor#{active}") # Create a dummy item just to mark this point in the display list, # so we can insert highlights here. w.create(TkcRectangle,0,100,1,101,'fill'=>'','outline'=>'','tags'=>'marker') # Add the walls and labels for the active floor, along with # transparent polygons that define the rooms on the floor. # Make sure that the room polygons are on top. $floorLabels2.clear $floorItems2.clear send("floor2_fg#{active}", w, $floor2_colors['offices']) w.raise('room') # Offset the floors diagonally from each other. w.move('floor1', '2c', '2c') w.move('floor2', '1c', '1c') # Create items for the room entry and its label. w.create(TkcWindow, 600, 100, 'anchor'=>'w', 'window'=>$floor2_entry) w.create(TkcText, 600, 100, 'anchor'=>'e', 'text'=>"Room: ") w['scrollregion'] = w.bbox('all') end |
#focusAndFlash(widget, fg, bg, count = 5) ⇒ Object
focusAndFlash – Error handler for entry widgets that forces the focus onto the widget and makes the widget flash by exchanging the foreground and background colours at intervals of 200ms (i.e. at approximately 2.5Hz).
Arguments: widget - entry widget to flash fg - Initial foreground colour bg - Initial background colour count - Counter to control the number of times flashed
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'sample/demos-en/entry3.rb', line 64 def focusAndFlash(, fg, bg, count=5) return if count <= 0 if fg && !fg.empty? && bg && !bg.empty? TkTimer.new(200, count, proc{.configure(:foreground=>bg, :background=>fg)}, proc{.configure(:foreground=>fg, :background=>bg)} ).start else # TkTimer.new(150, 3){Tk.bell}.start Tk.bell TkTimer.new(200, count, proc{.configure(:foreground=>'white', :background=>'black')}, proc{.configure(:foreground=>'black', :background=>'white')} ).at_end{begin .configure(:foreground=>fg, :background=>bg) rescue # ignore end}.start end .focus(true) end |
#focusMonitor ⇒ Object
849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 |
# File 'sample/tkextlib/tile/demo.rb', line 849 def focusMonitor $FocusInf[:Widget] = focus_win = Tk.focus if focus_win $FocusInf[:WidgetClass] = focus_win.winfo_classname $FocusInf[:WidgetNext] = Tk.focus_next(focus_win) else $FocusInf[:WidgetClass] = $FocusInf[:WidgetNext] = '' end $FocusInf[:Grab] = grab_wins = Tk.current_grabs unless grab_wins.empty? $FocusInf[:GrabStatus] = grab_wins[0].grab_status else $FocusInf[:GrabStatus] = '' end $Timers[:FocusMonitor] = Tk.after(200, proc{ focusMonitor() }) end |
#foreachWidget(wins, cmd) ⇒ Object
Utilities:
152 153 154 155 156 157 |
# File 'sample/tkextlib/tile/demo.rb', line 152 def foreachWidget(wins, cmd) wins.each{|w| cmd.call(w) foreachWidget(w.winfo_children, cmd) } end |
#get_ext_list ⇒ Object
553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 |
# File 'extconf.rb', line 553 def get_ext_list() exts = [CONFIG['DLEXT']] exts.concat %w(dll) if is_win32? exts.concat %w(bundle dylib) if is_macosx? if TkLib_Config["tcltk-stubs"] || TkLib_Config['enable-shared'] == false exts.unshift "lib" if is_win32? exts.unshift "a" exts.unshift CONFIG['LIBEXT'] end if is_win32? exts.map!{|ext| [ext.downcase, ext.upcase]}.flatten! end exts end |
#get_files(file) ⇒ Object
6 7 8 9 10 11 12 |
# File 'sample/tkextlib/iwidgets/sample/hierarchy.rb', line 6 def get_files(file) dir = (file.empty?)? ENV['HOME'] : TkComm._fromUTF8(file) Dir.chdir(dir) rescue return '' Dir['*'].sort.collect{|f| [TkComm._toUTF8(File.join(dir, f)), TkComm._toUTF8(f)] } end |
#get_libpath(lib_flag, lib_spec) ⇒ Object
404 405 406 407 |
# File 'extconf.rb', line 404 def get_libpath(lib_flag, lib_spec) # get libpath from {TCL,Tk}_LIB_FLAG and {TCL,Tk}_LIB_SPEC lib_spec.gsub(/(#{lib_flag}|-L)/, "").strip end |
#get_pkg_list(file) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/tkextlib/pkg_checker.rb', line 67 def get_pkg_list(file) pkg_list = [] File.foreach(file){|l| if l =~ /^(?:[^#]+\s|\s*)(?:|;\s*)TkPackage\s*\.\s*require\s*\(?\s*(["'])((\w|:)+)\1/ pkg = [$2, :package] pkg_list << pkg unless pkg_list.member?(pkg) end if l =~ /^(?:[^#]+\s|\s*)(?:|;\s*)Tk\s*\.\s*load_tcllibrary\s*\(?\s*(["'])((\w|:)+)\1/ pkg = [$2, :library] pkg_list << pkg unless pkg_list.member?(pkg) end if l =~ /^(?:[^#]+\s|\s*)(?:|;\s*)Tk\s*\.\s*load_tclscript\s*\(?\s*(["'])((\w|:)+)\1/ pkg = [$2, :script] pkg_list << pkg unless pkg_list.member?(pkg) end if l =~ /^(?:[^#]+\s|\s*)(?:|;\s*)require\s*\(?\s*(["'])((\w|\/|:)+)\1/ pkg = [$2, :require_ruby_lib] pkg_list << pkg unless pkg_list.member?(pkg) end } pkg_list end |
#get_shlib_path_head ⇒ Object
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 |
# File 'extconf.rb', line 194 def get_shlib_path_head path_head = [] path_dirs = [] if TkLib_Config["ActiveTcl"].kind_of?(String) # glob path # path_head << TkLib_Config["ActiveTcl"] path_head.concat Dir.glob(TkLib_Config["ActiveTcl"], File::FNM_CASEFOLD).sort.reverse # path_dirs.concat Dir.glob(File.join(TkLib_Config["ActiveTcl"], 'lib'), File::FNM_CASEFOLD).sort.reverse end if CROSS_COMPILING elsif is_win32? if TkLib_Config["ActiveTcl"] path_head.concat ["c:/ActiveTcl", "c:/Program Files/ActiveTcl", "c:/Program Files (x86)/ActiveTcl"] end path_head.concat [ "c:/Tcl", "c:/Program Files/Tcl", "c:/Program Files (x86)/Tcl", "/Tcl", "/Program Files/Tcl", "/Program Files (x86)/Tcl" ] path_head.uniq! #path_head.each{|dir| path_dirs << dir.dup if File.directory? dir} path_head.each{|dir| path_dirs << File.(dir) if File.directory? dir} # for MinGW ["/usr/local/lib64", "/usr/lib64", "/usr/local/lib", "/usr/lib"].each{|dir| #path_dirs << dir if File.directory? dir path_dirs << File.(dir) if File.directory? dir } path_dirs |= ENV['LIBRARY_PATH'].split(';').find_all{|dir| File.directory? dir}.map{|dir| File.(dir)} if ENV['LIBRARY_PATH'] path_dirs |= ENV['PATH'].split(';').find_all{|dir| File.directory? dir}.map{|dir| File.(dir)} if ENV['PATH'] else [ '/opt', '/pkg', '/share', '/usr/local/opt', '/usr/local/pkg', '/usr/local/share', '/usr/local', '/usr/opt', '/usr/pkg', '/usr/share', '/usr/contrib', '/usr' ].each{|dir| next unless File.directory?(dir) path_dirs << "#{dir}/lib64" if maybe_64bit? path_dirs << "#{dir}/lib" path_dirs << "#{dir}" unless Dir.glob("#{dir}/lib*.*", File::FNM_CASEFOLD).empty? dirnames = [] if TkLib_Config["ActiveTcl"] dirnames.concat ["ActiveTcl"] end dirnames.concat ["TclTk","Tcl_Tk","Tcl-Tk"] dirnames.each{|name| path_dirs << "#{dir}/#{name}" if File.directory?("#{dir}/#{name}") path_head << "#{dir}/#{name}" unless Dir.glob("#{dir}/#{name}[-89_]*", File::FNM_CASEFOLD).empty? } } end unless TkLib_Config["space-on-tk-libpath"] path_head.delete_if{|path| path =~ / /} path_dirs.delete_if{|path| path =~ / /} end [path_head, path_dirs] end |
#get_shlib_versions(major = 8, minor_max = 9, minor_min = 0, ext = "") ⇒ Object
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
# File 'extconf.rb', line 166 def get_shlib_versions(major = 8, minor_max = 9, minor_min = 0, ext = "") if tclcfg = TkLib_Config["tclConfig_info"] major = tclcfg['TCL_MAJOR_VERSION'].to_i minor_min = tclcfg['TCL_MINOR_VERSION'].to_i elsif TkLib_Config["tcltkversion"] tclver, tkver = TkLib_Config["tcltkversion"] if tclver =~ /8\.?(\d)(.*)/ minor_min = $1.to_i ext = $2 else # unsupported version return [""] end end # if disable-stubs, version is fixed. minor_max = minor_min unless TkLib_Config["tcltk-stubs"] vers = [] minor_max.downto(minor_min){|minor| vers << "#{major}.#{minor}#{ext}" unless ext.empty? vers << "#{major}.#{minor}" } vers << "" end |
#get_tclConfig(tclConfig_file, tkConfig_file, tclConfig_dir, tkConfig_dir) ⇒ Object
893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 |
# File 'extconf.rb', line 893 def get_tclConfig(tclConfig_file, tkConfig_file, tclConfig_dir, tkConfig_dir) use_tclConfig = tclConfig_file != false && tclConfig_dir != false use_tkConfig = tkConfig_file != false && tkConfig_dir != false unless use_tclConfig || use_tkConfig puts("Don't use [tclConfig.sh, tkConfig.sh]") return [nil, nil] end tclConfig_file = nil unless tclConfig_file.kind_of? String tkConfig_file = nil unless tkConfig_file.kind_of? String tclConfig_dir = nil unless tclConfig_dir.kind_of? String tkConfig_dir = nil unless tkConfig_dir.kind_of? String if use_tclConfig && !tclConfig_dir if tclConfig_file tclConfig_dir = File.dirname(tclConfig_file) elsif tkConfig_dir tclConfig_dir = tkConfig_dir end end if use_tkConfig && !tkConfig_dir if tkConfig_file tkConfig_dir = File.dirname(tkConfig_file) elsif tclConfig_dir tkConfig_dir = tclConfig_dir end end tkConfig_dir ||= tclConfig_dir if use_tclConfig TkLib_Config["tclConfig-file"] = tclConfig_file TkLib_Config["tclConfig-dir"] = tclConfig_dir else tclConfig_file = false tclConfig_dir = false end if use_tkConfig TkLib_Config["tkConfig-file"] = tkConfig_file TkLib_Config["tkConfig-dir"] = tkConfig_dir else tkConfig_file = false tkConfig_dir = false end print ("Don't use tclConfig.sh (specified by configure option).\n") unless use_tclConfig print ("Don't use tkConfig.sh (specified by configure option).\n") unless use_tkConfig print("Search ") print("tclConfig.sh", (tclConfig_dir)? " (in #{tclConfig_dir})": "") if use_tclConfig print((use_tclConfig)? " and ": "", "tkConfig.sh", (tkConfig_dir)? " (in #{tkConfig_dir})": "") if use_tkConfig print(".") if tclConfig_dir || tkConfig_dir || !use_tclConfig || !use_tkConfig tclConfig, tkConfig = search_tclConfig([ ((tclConfig_file)? tclConfig_file: tclConfig_dir), ((tkConfig_file)? tkConfig_file: tkConfig_dir) ]) else tclConfig, tkConfig = search_tclConfig() end print("\n") # TclConfig_Info = TkLib_Config["tclConfig_info"] # TkConfig_Info = TkLib_Config["tkConfig_info"] if tclConfig || tkConfig dirs = TkLib_Config["tclConfig_paths"].map{|tclpath, tkpath| [ (tclpath)? File.dirname(tclpath): nil, (tkpath)? File.dirname(tkpath): nil ] } dirs |= dirs puts("Valid [tclConfig.sh, tkConfig.sh] are found in #{dirs.inspect}") puts("Use [tclConfig.sh, tkConfig.sh] == #{[tclConfig, tkConfig].inspect}") $LIBPATH ||= [] $LIBPATH |= [File.dirname(tclConfig)] if tclConfig $LIBPATH |= [File.dirname(tkConfig)] if tkConfig #TkLib_Config["tclConfig_paths"].each{|tclcfg, tkcfg| # $LIBPATH |= [File.dirname(tclcfg)] | [File.dirname(tkcfg)] #} else puts("Fail to find [tclConfig.sh, tkConfig.sh]") end [tclConfig, tkConfig] end |
#get_tclConfig_dirs ⇒ Object
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 |
# File 'extconf.rb', line 409 def get_tclConfig_dirs config_dir = [] if CROSS_COMPILING elsif is_win32? if TkLib_Config["ActiveTcl"] dirs = [] if TkLib_Config["ActiveTcl"].kind_of?(String) dirs << File.join(TkLib_Config["ActiveTcl"], 'lib') end dirs.concat [ "c:/ActiveTcl*/lib", "c:/Tcl*/lib", "c:/Program Files*/ActiveTcl*/lib", "c:/Program Files*/Tcl*/lib", "/ActiveTcl*/lib", "/Tcl*/lib", "/Program Files*/ActiveTcl*/lib", "/Program Files*/Tcl*/lib" ] else dirs = [ "c:/Tcl*/lib", "c:/Program Files*/Tcl*/lib", "/Tcl*/lib", "/Program Files*/Tcl*/lib" ] end dirs = dirs.collect{|d| Dir.glob(d, File::FNM_CASEFOLD)}.flatten.uniq dirs |= ENV['LIBRARY_PATH'].split(';') if ENV['LIBRARY_PATH'] dirs |= ENV['PATH'].split(';') if ENV['PATH'] exeext = RbConfig::CONFIG['EXEEXT'] ENV['PATH'].split(File::PATH_SEPARATOR).each{|dir| dir.tr!(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR next if Dir.glob(File.join(dir, "{tclsh,wish}*#{exeext}"), File::FNM_CASEFOLD).empty? dirs << File.(File.join(dir, '..', 'lib')) dirs << dir # dirs << File.expand_path(File.join(dir, '..')) } unless TkLib_Config["space-on-tk-libpath"] dirs.delete_if{|path| path =~ / /} end config_dir.concat(dirs.zip(dirs)) else if framework = find_macosx_framework() config_dir.unshift(framework) end if activeTcl = TkLib_Config['ActiveTcl'] # check latest version at first if is_macosx? base = File.(activeTcl) config_dir << [ File.join(base, 'Tcl.framework'), File.join(base, 'Tk.framework') ] config_dir << [ File.join(base, 'Tcl.framework', 'Versions', 'Current'), File.join(base, 'Tk.framework', 'Versions', 'Current') ] Dir.glob(File.join(base, 'Tcl.framework', 'Versions', '*')).sort.reverse.each{|dir| next if dir =~ /Current/ config_dir << [dir, dir.gsub(/Tcl/, 'Tk')] } else config_dir.concat(Dir.glob(File.join(activeTcl, 'lib'), File::FNM_CASEFOLD).sort.reverse) end end config_dir << RbConfig::CONFIG['libdir'] ((maybe_64bit?)? ['lib64', 'lib']: ['lib']).each{|dir| config_dir.concat [ File.join(RbConfig::CONFIG['exec_prefix'], dir), File.join(RbConfig::CONFIG['prefix'], dir), "/usr/local/opt/#{dir}", "/usr/local/pkg/#{dir}", "/usr/local/share/#{dir}", "/usr/local/#{dir}", "/usr/opt/#{dir}", "/usr/pkg/#{dir}", "/usr/share/#{dir}", "/usr/contrib/#{dir}", "/usr/#{dir}" ] } config_dir.concat [ '/opt', '/pkg', '/share', '/usr/local/opt', '/usr/local/pkg', '/usr/local/share', '/usr/local', '/usr/opt', '/usr/pkg', '/usr/share', '/usr/contrib', '/usr' ].map{|dir| Dir.glob(dir + "/{tcltk,tcl,tk}[#{TkLib_Config['major_nums']}*/lib", File::FNM_CASEFOLD) Dir.glob(dir + "/{tcltk,tcl,tk}[#{TkLib_Config['major_nums']}*", File::FNM_CASEFOLD) Dir.glob(dir + '/{tcltk,tcl,tk}/lib', File::FNM_CASEFOLD) Dir.glob(dir + '/{tcltk,tcl,tk}', File::FNM_CASEFOLD) }.flatten! exeext = RbConfig::CONFIG['EXEEXT'] ENV['PATH'].split(File::PATH_SEPARATOR).each{|dir| dir.tr!(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR next if Dir.glob(File.join(dir, "{tclsh,wish}*#{exeext}"), File::FNM_CASEFOLD).empty? config_dir << File.(File.join(dir, '..', 'lib')) } # for MacOS X paths = [ #"~/Library/Tcl", "/Library/Tcl", "/Network/Library/Tcl", "/System/Library/Tcl" ] paths.reverse! unless TkLib_Config["ActiveTcl"] paths.each{|path| config_dir << path config_dir.concat(Dir.glob(File.join(path, '{tcl,tk}*'), File::FNM_CASEFOLD).sort.reverse.find_all{|d| File.directory?(d)}) } paths = [ #"~/Library/Frameworks", "/Library/Frameworks", "/Network/Library/Frameworks", "/System/Library/Frameworks" ] paths.reverse! unless TkLib_Config["ActiveTcl"] paths.each{|frmwk| base = File.(frmwk) config_dir << [ File.join(base, 'Tcl.framework'), File.join(base, 'Tk.framework') ] config_dir << [ File.join(base, 'Tcl.framework', 'Versions', 'Current'), File.join(base, 'Tk.framework', 'Versions', 'Current') ] Dir.glob(File.join(base, 'Tcl.framework', 'Versions', '*')).sort.reverse.each{|dir| next if dir =~ /Current/ config_dir << [dir, dir.gsub(/Tcl/, 'Tk')] } } end config_dir end |
#help_msg ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/tkextlib/pkg_checker.rb', line 17 def help_msg print "Usage: #{$0} [-l] [-v] [-h] [--] [dir]\n" print "\tIf dir is omitted, check the directory that this command exists.\n" print "\tAvailable options are \n" print "\t -l : Add dir to $LOAD_PATH\n" print "\t (If dir == '<parent>/tkextlib', add <parent> also.)\n" print "\t -v : Verbose mode (show reason of fail)\n" print "\t -h : Show this message\n" print "\t -- : End of options\n" end |
#helpButton1(w, x, y) ⇒ Object
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
# File 'sample/tkextlib/treectrl/help.rb', line 288 def helpButton1(w, x, y) w.set_focus id = w.identify(x, y) @Priv['buttonMode'] = '' if id[0] == 'header' Tk::TreeCtrl::BindCallback.(w, x, y) elsif id[0] == 'item' item = id[1] # didn't click an element return if id.length != 6 if w.selection_includes(item) w.toggle(item) return end if w.selection_get.length > 0 item2 = w.selection_get[0] if $Version_1_1_OrLater w.item_collapse(item2) else # TreeCtrl 1.0 w.collapse(item2) end w.item_ancestors(item2).each{|i| if $Version_1_1_OrLater w.item_collapse(i) if w.compare(item, '!=', i) else # TreeCtrl 1.0 w.collapse(i) if w.compare(item, '!=', i) end } end w.activate(item) if $Version_1_1_OrLater w.item_ancestors(item).each{|i| w.(i) } w.item_toggle(item) else # TreeCtrl 1.0 w.(*(w.item_ancestors(item))) w.toggle(item) end w.selection_modify(item, :all) end end |
#helpLeave1(w, x, y) ⇒ Object
338 339 340 341 342 343 344 345 346 |
# File 'sample/tkextlib/treectrl/help.rb', line 338 def helpLeave1(w, x, y) # This is called when I do ButtonPress-1 on Unix for some reason, # and buttonMode is undefined. return unless @Priv.exist?('buttonMode') case @Priv['buttonMode'] when 'header' w.column_configure(@Priv['column'], :sunken=>false) end end |
#helpMotion(w, x, y) ⇒ Object
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 |
# File 'sample/tkextlib/treectrl/help.rb', line 356 def helpMotion(w, x, y) id = w.identify(x, y) if id.empty? elsif id[0] == 'header' elsif id[0] == 'item' item = id[1] if id.length == 6 if @Priv[:help, :prev] != TkComm._get_eval_string(item) if @Priv[:help, :prev] != '' w.item_state_set(@Priv[:help, :prev], '!mouseover') end w.item_state_set(item, 'mouseover') @Priv[:help, :prev] = item end return end end if @Priv[:help, :prev] != '' w.item_state_set(@Priv[:help, :prev], '!mouseover') @Priv[:help, :prev] = '' end end |
#helpMotion1(w, x, y) ⇒ Object
331 332 333 334 335 336 |
# File 'sample/tkextlib/treectrl/help.rb', line 331 def helpMotion1(w, x, y) case @Priv['buttonMode'] when 'resize', 'header' Tk::TreeCtrl::BindCallback.motion1(w, x, y) end end |
#helpMotion2(w, x, y) ⇒ Object
Alternate implementation doesn’t rely on mouseover state
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 |
# File 'sample/tkextlib/treectrl/help.rb', line 380 def helpMotion2(w, x, y) id = w.identify(x, y) if id[0] == 'header' elsif !id.empty? item = id[1] if id.kength == 6 if @Priv[:help, :prev] != TkComm._get_eval_string(item) if @Priv[:help, :prev] != '' style = w.item_style_set(@Priv[:help, :prev], 0) style.sub!(/\.f$/, '') w.item_style_map(@Priv[:help, :prev], 0, style, ['e5', 'e3']) end style = w.item_style_set(item, 0) w.item_style_map(item, 0, style + '.f', ['e3', 'e5']) @Priv[:help, :prev] = item end return end end if @Priv[:help, :prev] != '' style = w.item_style_set(@Priv[:help, :prev], 0) style.sub!(/\.f$/, '') w.item_style_map(@Priv[:help, :prev], 0, style, ['e5', 'e3']) @Priv[:help, :prev] = '' end end |
#helpRelease1(w, x, y) ⇒ Object
348 349 350 351 352 353 354 |
# File 'sample/tkextlib/treectrl/help.rb', line 348 def helpRelease1(w, x, y) case @Priv['buttonMode'] when 'resize', 'header' Tk::TreeCtrl::BindCallback.release1(w, x, y) end @Priv['buttonMode'] = '' end |
#iMovieButton1(w, x, y) ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'sample/tkextlib/treectrl/imovie.rb', line 88 def iMovieButton1(w, x, y) w.set_focus id = w.identify(x,y) if id.empty? # Click outside any item elsif id[0] == 'header' # Click in header Tk::TreeCtrl::BindCallback.(w, x, y) elsif id[0] == 'item' # Click in item Tk::TreeCtrl::BindCallback.(w, x, y) Tk.update where, item, arg1, arg2, arg3, arg4 = id case arg1 when 'column' i = id[1] if id.length == 6 e = id[-1] if e == 'elemName' exists = TkWinfo.exist?(w.path + '.entry') Tk::TreeCtrl::BindCallback.entryOpen(w, i, 0, e) ent = TkComm.window(w.path + '.entry') unless exists ent.configure(:borderwidth=>0, :justify=>:center, :background=>'#ffdc5a') x1, y1, x2, y2 = w.item_bbox(i, 0, e) ent.place(:y=>y1 - 1) end ent.selection_clear x1, y1, x2, y2 = w.item_bbox(i) ent.place(:x=>x1 + 1, :width=>x2 - x1 - 5) puts "@#{x - (x1 + 1)}" # ent.icursor = ent.index("@#{x - (x1 + 1)}") ent.icursor = ent.index(TkComm._at(x - (x1 + 1))) end end end end Tk.callback_break end |
#is_macosx? ⇒ Boolean
122 123 124 |
# File 'extconf.rb', line 122 def is_macosx? /darwin/ =~ RUBY_PLATFORM end |
#is_win32? ⇒ Boolean
fuctions
118 119 120 |
# File 'extconf.rb', line 118 def is_win32? /mswin|mingw|cygwin|bccwin/ =~ RUBY_PLATFORM end |
#itemDrag(c, x, y) ⇒ Object
367 368 369 370 371 372 373 |
# File 'sample/demos-en/items.rb', line 367 def itemDrag(c,x,y) x = c.canvasx(x) y = c.canvasy(y) c.move 'current', x - $lastX, y - $lastY $lastX = x $lastY = y end |
#itemEnter(c) ⇒ Object
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 |
# File 'sample/demos-en/items.rb', line 289 def itemEnter (c) if TkWinfo.depth(c).to_i == 1 $restoreCmd = nil return end type = c.itemtype('current') if type == TkcWindow $restoreCmd = nil return end if type == TkcBitmap bg = (c.itemconfiginfo('current', 'background'))[4] $restoreCmd = proc{c.itemconfigure 'current', 'background', bg} c.itemconfigure 'current', 'background', 'SteelBlue2' return end fill = (c.itemconfiginfo('current', 'fill'))[4] if (type == TkcRectangle || type == TkcOval || type == TkcArc) && fill == [] outline = (c.itemconfiginfo('current', 'outline'))[4] $restoreCmd = proc{c.itemconfigure 'current', 'outline', outline} c.itemconfigure 'current', 'outline', 'SteelBlue2' else $restoreCmd = proc{c.itemconfigure 'current', 'fill', fill} c.itemconfigure 'current', 'fill', 'SteelBlue2' end end |
#itemLeave(c) ⇒ Object
316 317 318 |
# File 'sample/demos-en/items.rb', line 316 def itemLeave(c) $restoreCmd.call if $restoreCmd end |
#itemMark(c, x, y) ⇒ Object
Utility methods for stroking out a rectangle and printing what’s underneath the rectangle’s area.
323 324 325 326 327 |
# File 'sample/demos-en/items.rb', line 323 def itemMark(c,x,y) $areaX1 = c.canvasx(x) $areaY1 = c.canvasy(y) c.delete 'area' end |
#itemStartDrag(c, x, y) ⇒ Object
Utility methods to support dragging of items.
362 363 364 365 |
# File 'sample/demos-en/items.rb', line 362 def itemStartDrag(c,x,y) $lastX = c.canvasx(x) $lastY = c.canvasy(y) end |
#itemStroke(c, x, y) ⇒ Object
329 330 331 332 333 334 335 336 337 338 339 |
# File 'sample/demos-en/items.rb', line 329 def itemStroke(c,x,y) x = c.canvasx(x) y = c.canvasy(y) if $areaX1 != x && $areaY1 != y c.delete 'area' c.addtag_withtag 'area', TkcRectangle.new(c, $areaX1, $areaY1, x, y, '-outline', 'black') $areaX2 = x $areaY2 = y end end |
#itemsUnderArea(c) ⇒ Object
341 342 343 344 345 346 347 348 349 350 351 352 353 |
# File 'sample/demos-en/items.rb', line 341 def itemsUnderArea(c) area = c.find_withtag('area') items = [] c.find_enclosed($areaX1,$areaY1,$areaX2,$areaY2).each{|i| items.push(i) if i..include?($tag_item) } print "Items enclosed by area: #{items.inspect}\n"; STDOUT.flush items.clear c.find_overlapping($areaX1,$areaY1,$areaX2,$areaY2).each{|i| items.push(i) if i..include?($tag_item) } print "Items overlapping area: #{items.inspect}\n"; STDOUT.flush end |
#killClone(win, cnt) ⇒ Object
54 55 56 57 |
# File 'sample/demos-en/textpeer.rb', line 54 def killClone(win, cnt) Tk.destroy("#{win.path}.text#{cnt}", "#{win.path}.sb#{cnt}", "#{win.path}.clone#{cnt}", "#{win.path}.kill#{cnt}") end |
#kroc_rb_settings ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'sample/tkextlib/tile/themes/kroc.rb', line 18 def kroc_rb_settings # Tk::Tile::Style.default(TkRoot, :background=>'#FCB64F', # :troughcolor=>'#F8C278', :borderwidth=>1) # or # Tk::Tile::Style.default(Tk.root, :background=>'#FCB64F', # :troughcolor=>'#F8C278', :borderwidth=>1) # or # Tk::Tile::Style.default('.', :background=>'#FCB64F', # :troughcolor=>'#F8C278', :borderwidth=>1) # or # Tk::Tile::Style.default(nil, :background=>'#FCB64F', # :troughcolor=>'#F8C278', :borderwidth=>1) # or Tk::Tile::Style.default(:background=>'#FCB64F', :troughcolor=>'#F8C278', :borderwidth=>1) # Tk::Tile::Style.default(TkRoot, :font=>Tk::Tile::Font::Default, # :borderwidth=>1) # or # Tk::Tile::Style.default(Tk.root, :font=>Tk::Tile::Font::Default, # :borderwidth=>1) # or # Tk::Tile::Style.default('.', :font=>Tk::Tile::Font::Default, # :borderwidth=>1) # or # Tk::Tile::Style.default(nil, :font=>Tk::Tile::Font::Default, # :borderwidth=>1) # or Tk::Tile::Style.default(:font=>Tk::Tile::Font::Default, :borderwidth=>1) # Tk::Tile::Style.map(TkRoot, :background=>[:active, '#694418']) # or # Tk::Tile::Style.map(Tk.root, :background=>[:active, '#694418']) # or # Tk::Tile::Style.map('.', :background=>[:active, '#694418']) # or # Tk::Tile::Style.map(nil, :background=>[:active, '#694418']) # or Tk::Tile::Style.map(:background=>[:active, '#694418']) Tk::Tile::Style.map(:foreground=>[:disabled, '#B2B2B2', :active, '#FFE7CB']) # Tk::Tile::Style.default('TButton', :padding=>[10,4]) Tk::Tile::Style.default(Tk::Tile::TButton, :padding=>[10,4]) # Tk::Tile::Style.default('TNotebook.Tab', Tk::Tile::Style.default($TNotebook_Tab, :padding=>[10, 3], :font=>Tk::Tile::Font::Default) # Tk::Tile::Style.map('TNotebook.Tab', Tk::Tile::Style.map($TNotebook_Tab, :background=>[:selected, '#FCB64F', '', '#FFE6BA'], :foreground=>['', 'black'], :padding=>[:selected, [10, 6, 10, 3]]) # Tk::Tile::Style.map('TScrollbar', Tk::Tile::Style.map(Tk::Tile::TScrollbar, :background=>[:pressed, '#694418'], :arrowcolor=>[:pressed, '#FEF7CB'], :relief=>[:pressed, :sunken]) # Tk::Tile::Style.layout('Vertical.TScrollbar', Tk::Tile::Style.layout(Tk::Tile.style('Vertical', Tk::Tile::TScrollbar), ['Scrollbar.trough', {:children=>[ 'Scrollbar.uparrow', {:side=>:top}, 'Scrollbar.downarrow', {:side=>:bottom}, 'Scrollbar.uparrow', {:side=>:bottom}, 'Scrollbar.thumb', {:side=>:top, :expand=>true} ]} ]) # Tk::Tile::Style.layout('Horizontal.TScrollbar', Tk::Tile::Style.layout(Tk::Tile.style('Horizontal', Tk::Tile::TScrollbar), ['Scrollbar.trough', {:children=>[ 'Scrollbar.leftarrow', {:side=>:left}, 'Scrollbar.rightarrow', {:side=>:right}, 'Scrollbar.leftarrow', {:side=>:right}, 'Scrollbar.thumb', {:side=>:left, :expand=>true} ]} ]) # # Elements: # if Tk::Tile::TILE_SPEC_VERSION_ID >= 8 Tk::Tile::Style.element_create('Button.button', :image, [ $images['button-n'], :pressed, $images['button-p'], :active, $images['button-h'], ], :border=>3, :sticky=>:ew) Tk::Tile::Style.element_create('Checkbutton.indicator', :image, [ $images['check-nu'], [:pressed, :selected],$images['check-nc'], :pressed, $images['check-nu'], [:active, :selected], $images['check-hc'], :active, $images['check-hu'], :selected, $images['check-nc'], ], :sticky=>:w) Tk::Tile::Style.element_create('Radiobutton.indicator', :image, [ $images['radio-nu'], [:pressed,:selected],$images['radio-nc'], :pressed, $images['radio-nu'], [:active,:selected], $images['radio-hc'], :active, $images['radio-hu'], :selected, $images['radio-nc'], ], :sticky=>:w) elsif TkPackage.vcompare(Tk::Tile.package_version, '0.5') >= 0 Tk::Tile::Style.element_create('Button.button', :image, $images['button-n'], :map=>[ :pressed, $images['button-p'], :active, $images['button-h'], ], :border=>3, :sticky=>:ew) Tk::Tile::Style.element_create('Checkbutton.indicator', :image, $images['check-nu'], :map=>[ [:pressed, :selected],$images['check-nc'], :pressed, $images['check-nu'], [:active, :selected], $images['check-hc'], :active, $images['check-hu'], :selected, $images['check-nc'], ], :sticky=>:w) Tk::Tile::Style.element_create('Radiobutton.indicator', :image, $images['radio-nu'], :map=>[ [:pressed, :selected],$images['radio-nc'], :pressed, $images['radio-nu'], [:active, :selected], $images['radio-hc'], :active, $images['radio-hu'], :selected, $images['radio-nc'], ], :sticky=>:w) else # tile 0.4 or earlier Tk::Tile::Style.element_create('Button.button', :pixmap, :images=>[ :pressed, $images['button-p'], :active, $images['button-h'], '', $images['button-n'] ], :border=>3, :tiling=>:tile) Tk::Tile::Style.element_create('Checkbutton.indicator', :pixmap, :images=>[ [:pressed, :selected],$images['check-nc'], :pressed, $images['check-nu'], [:active, :selected], $images['check-hc'], :active, $images['check-hu'], :selected, $images['check-nc'], '', $images['check-nu'], ], :tiling=>:fixed) Tk::Tile::Style.element_create('Radiobutton.indicator', :pixmap, :images=>[ [:pressed, :selected],$images['radio-nc'], :pressed, $images['radio-nu'], [:active, :selected], $images['radio-hc'], :active, $images['radio-hu'], :selected, $images['radio-nc'], '', $images['radio-nu'], ], :tiling=>:fixed) end # # Settings: # # Tk::Tile::Style.layout(Tk::Tile::TButton, Tk::Tile::Style.layout('TButton', [ 'Button.button', {:children=>[ 'Button.focus', {:children=>[ 'Button.padding', {:children=>[ 'Button.label', {:expand=>true, :sticky=>''} ]} ]} ]} ]) # Tk::Tile::Style.layout(Tk::Tile::TCheckbutton, Tk::Tile::Style.layout('TCheckbutton', [ 'Checkbutton.background', # this is not needed in tile 0.5 or later 'Checkbutton.border', {:children=>[ 'Checkbutton.padding', {:children=>[ 'Checkbutton.indicator', {:side=>:left}, 'Checkbutton.focus', {:side=>:left, :children=>[ 'Checkbutton.label' ]} ]} ]} ]) # Tk::Tile::Style.layout(Tk::Tile::TRadiobutton, Tk::Tile::Style.layout('TRadiobutton', [ 'Radiobutton.background', # this is not needed in tile 0.5 or later 'Radiobutton.border', {:children=>[ 'Radiobutton.padding', {:children=>[ 'Radiobutton.indicator', {:side=>:left}, 'Radiobutton.focus', {:expand=>true, :sticky=>:w, :children=>[ 'Radiobutton.label', {:side=>:right, :expand=>true} ]} ]} ]} ]) end |
#lfEnableButtons(w) ⇒ Object
70 71 72 73 74 75 76 77 78 79 |
# File 'sample/demos-en/labelframe.rb', line 70 def lfEnableButtons(w) TkWinfo.children(w).each{|child| next if child.path =~ /\.cb$/ if $lfdummy == 1 child.state(:normal) else child.state(:disabled) end } end |
#libcheck_for_tclConfig(tcldir, tkdir, tclconf, tkconf) ⇒ Object
571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 |
# File 'extconf.rb', line 571 def libcheck_for_tclConfig(tcldir, tkdir, tclconf, tkconf) tcllib_ok = tklib_ok = false if TkLib_Config["tcltk-stubs"] stub = "stub" tclfunc = "Tcl_InitStubs" tkfunc = "Tk_InitStubs" else stub = "" tclfunc = "Tcl_FindExecutable" tkfunc = "Tk_Init" end incflags = ($INCFLAGS ||= "").dup libpath = ($LIBPATH ||= []).dup libs_param = ($libs ||= "").dup tcllibs = nil mkmf_param = nil tclver, tkver = TkLib_Config["tcltkversion"] exts = "(" + get_ext_list.join('|') + ")" if tclver tcl_glob = "*tcl#{stub}#{tclver}.*" tcl_regexp = /^.*(tcl#{stub}#{tclver}.*)\.(#{exts}).*$/ elsif tclconf tcl_glob = "*tcl#{stub}#{tclconf['TCL_MAJOR_VERSION']}{.,}#{tclconf['TCL_MINOR_VERSION']}*.*" tcl_regexp = /^.*(tcl#{stub}#{tclconf['TCL_MAJOR_VERSION']}(?:\.|)#{tclconf['TCL_MINOR_VERSION']}.*)\.(#{exts}).*$/ end if tkver tk_glob = "*tk#{stub}#{tkver}.*" tk_regexp = /^.*(tk#{stub}#{tkver}.*)\.(#{exts}).*$/ elsif tkconf tk_glob = "*tk#{stub}#{tkconf['TK_MAJOR_VERSION']}{.,}#{tkconf['TK_MINOR_VERSION']}*.*" tk_regexp = /^.*(tk#{stub}#{tkconf['TK_MAJOR_VERSION']}(?:\.|)#{tkconf['TK_MINOR_VERSION']}.*)\.#{exts}.*$/ end tcllib_ok ||= !tclconf || Dir.glob(File.join(tcldir, tcl_glob), File::FNM_CASEFOLD).find{|file| if file =~ tcl_regexp libname = $1 ext = $2.downcase begin $INCFLAGS = incflags.dup << " " << tclconf["TCL_INCLUDE_SPEC"] #puts "check #{file} #{$1} #{tclfunc} #{tcldir}" #find_library($1, tclfunc, tcldir) if (tclconf && tclconf["TCL_SHARED_BUILD"] == "0") || (ext != CONFIG['DLEXT'] && ext == CONFIG['LIBEXT']) || ext == "a" # static link tcllibs = $libs + " -DSTATIC_BUILD " + file.quote # FIX ME: avoid pathname trouble (fail to find) on MinGW. # e.g. TCL_INCLUDE_SPEC describes "-I/usr/local/include", # but compiler can find "-IC:/msys/1.0/local/include" only. $INCFLAGS << " -I" << File.join(File.dirname(File.dirname(file)),"include") if is_win32? else tcllibs = append_library($libs, libname) tcllibs = "#{libpathflag([tcldir])} #{tcllibs}" # FIX ME: avoid pathname trouble (fail to find) on MinGW. $INCFLAGS << " -I" << File.join(File.dirname(tcldir),"include") if is_win32? end $LIBPATH = libpath | [tcldir] try_func(tclfunc, tcllibs, ["tcl.h"]) || ( try_func(tclfunc, tcllibs << " " << tclconf['TCL_LIBS'], ["tcl.h"]) if tclconf['TCL_LIBS'] ) ensure mkmf_param = { 'PATH' => file, 'LIBNAME' => libname, 'libs' => tcllibs.dup, 'INCFLAGS' => $INCFLAGS.dup, 'LIBPATH' => $LIBPATH.dup, } $LIBPATH = libpath.dup $libs = libs_param.dup end end } tclconf['MKMF_PARAMS'] = mkmf_param if tclconf && tcllib_ok tklib_ok ||= !tkconf || Dir.glob(File.join(tkdir, tk_glob), File::FNM_CASEFOLD).find{|file| if file =~ tk_regexp libname = $1 ext = $2.downcase begin #puts "check #{file} #{$1} #{tkfunc} #{tkdir}" # find_library($1, tkfunc, tkdir) if (tkconf && tkconf["TCL_SHARED_BUILD"] == "0") || (ext != CONFIG['DLEXT'] && ext == CONFIG['LIBEXT']) || ext == "a" # static link tklibs = " -DSTATIC_BUILD " + file.quote # FIX ME: avoid pathname trouble (fail to find) on MinGW. $INCFLAGS << " -I" << File.join(File.dirname(File.dirname(file)),"include") if is_win32? else tklibs = append_library("", libname) #tklibs = append_library("", $1) tklibs = "#{libpathflag([tkdir])} #{tklibs}" # FIX ME: avoid pathname trouble (fail to find) on MinGW. $INCFLAGS << " -I" << File.join(File.dirname(tcldir),"include") if is_win32? end tklibs << " " << tcllibs if tcllibs tmp_tklibs = tklibs.dup $LIBPATH = libpath | [tkdir] try_func(tkfunc, tklibs, ["tcl.h", "tk.h"]) || ( try_func(tkfunc, tklibs << " " << tkconf['TK_LIBS'], ["tcl.h", "tk.h"]) if tkconf['TK_LIBS'] ) || ( try_func(tkfunc, (tklibs = tmp_tklibs.dup) << " " << tkconf['TK_XLIBSW'], ["tcl.h", "tk.h"]) if tkconf['TK_XLIBSW'] ) || ( try_func(tkfunc, tklibs << " " << tkconf['TK_LIBS'], ["tcl.h", "tk.h"]) if tkconf['TK_LIBS'] ) ensure mkmf_param = { 'PATH' => file, 'LIBNAME' => libname, 'libs' => tklibs.dup, 'INCFLAGS' => $INCFLAGS.dup, 'LIBPATH' => $LIBPATH.dup, } $LIBPATH = libpath.dup $libs = libs_param.dup end end } $INCFLAGS = incflags.dup tkconf['MKMF_PARAMS'] = mkmf_param if tkconf && tklib_ok [tcllib_ok, tklib_ok] end |
#loadDir(w) ⇒ Object
メソッド定義
97 98 99 100 101 102 |
# File 'sample/demos-jp/image2.rb', line 97 def loadDir(w) w.delete(0,'end') Dir.glob([$dirName,'*'].join(File::Separator)).sort.each{|f| w.insert('end',File.basename(f)) } end |
#loadDir3(w) ⇒ Object
26 27 28 29 30 31 |
# File 'sample/demos-en/image3.rb', line 26 def loadDir3(w) w.delete(0,'end') Dir.glob([$dirName,'*'].join(File::Separator)).sort.each{|f| w.insert('end',File.basename(f)) } end |
#loadIcons(file) ⇒ Object
139 140 141 142 143 144 145 |
# File 'sample/tkextlib/tile/demo.rb', line 139 def loadIcons(file) Tk.load_tclscript(file) img_data = TkVarAccess.new('ImgData') img_data.keys.each{|icon| $ICON[icon] = TkPhotoImage.new(:data=>img_data[icon]) } end |
#loadImage(img, w, x, y) ⇒ Object
105 106 107 |
# File 'sample/demos-en/image2.rb', line 105 def loadImage(img,w,x,y) img.file([$dirName, w.get("@#{x},#{y}")].join(File::Separator)) end |
#loadImage3(w, x, y) ⇒ Object
50 51 52 |
# File 'sample/demos-jp/image3.rb', line 50 def loadImage3(w,x,y) $image3a.file([$dirName, w.get("@#{x},#{y}")].join(File::Separator)) end |
#makeClone(count, win, txt) ⇒ Object
Procedures to make and kill clones; most of this is just so that the demo looks nice…
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'sample/demos-en/textpeer.rb', line 38 def makeClone(count, win, txt) cnt = (count[0] += 1) peer = TkText::Peer.new(txt, win, :widgetname=>"text#{cnt}") = TkScrollbar.new(win, :widgetname=>"sb#{cnt}") peer. b1 = TkButton.new(win, :widgetname=>"clone#{cnt}", :text=>'Make Peer', :command=>proc{makeClone(count, win, peer)}) b2 = TkButton.new(win, :widgetname=>"kill#{cnt}", :text=>'Delete Peer', :command=>proc{killClone(win, cnt)}) row = cnt * 2 TkGrid.configure(peer, , b1, :sticky=>'nsew', :row=>row) TkGrid.configure('^', '^', b2, :sticky=>'nsew', :row=>(row+=1)) TkGrid.configure(b1, b2, :sticky=>'new') TkGrid.rowconfigure(win, b2, :weight=>1) end |
#makeCompoundMenu(mb) ⇒ Object
Toolbar :compound control:
271 272 273 274 275 276 277 278 279 |
# File 'sample/tkextlib/tile/demo.rb', line 271 def makeCompoundMenu(mb) = TkMenu.new(mb) %w(text image none top bottom left right center).each{|str| .add(:radiobutton, :label=>Tk.tk_call('string', 'totitle', str), :variable=>$V.ref(:COMPOUND), :value=>str, :command=>proc{ () }) } end |
#makeNotebook ⇒ Object
Notebook demonstration:
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 |
# File 'sample/tkextlib/tile/demo.rb', line 328 def makeNotebook nb = Tk::Tile::Notebook.new($BASE, :padding=>6) nb.enable_traversal client = Tk::Tile::Frame.new(nb) nb.add(client, :text=>'Demo', :underline=>0) nb.select(client) scales = Tk::Tile::Frame.new(nb) nb.add(scales, :text=>'Scales') combo = Tk::Tile::Frame.new(nb) nb.add(combo, :text=>'Combobox', :underline=>7) tree = Tk::Tile::Frame.new(nb) nb.add(tree, :text=>'Tree') others = Tk::Tile::Frame.new(nb) nb.add(others, :text=>'Others', :underline=>4) [nb, client, scales, combo, tree, others] end |
#makeThemeControl(parent) ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'sample/tkextlib/tile/demo.rb', line 85 def makeThemeControl(parent) c = Tk::Tile::Labelframe.new(parent, :text=>'Theme') $THEMELIST.each{|theme, name| b = Tk::Tile::Radiobutton.new(c, :text=>name, :value=>theme, :variable=>$V.ref(:THEME), :command=>proc{setTheme(theme)}) b.grid(:sticky=>:ew) unless (TkPackage.names.find{|n| n =~ /(tile|ttk)::theme::#{theme}/}) b.ttk_state(:disabled) end } $RUBY_THEMELIST.each{|theme, name, available| b = Tk::Tile::Radiobutton.new(c, :text=>name, :value=>theme, :variable=>$V.ref(:THEME), :command=>proc{setTheme(theme)}) b.grid(:sticky=>:ew) b.ttk_state(:disabled) unless available } c end |
#makeThemeMenu(parent) ⇒ Object
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'sample/tkextlib/tile/demo.rb', line 106 def makeThemeMenu(parent) m = TkMenu.new(parent) $THEMELIST.each{|theme, name| m.add(:radiobutton, :label=>name, :variable=>$V.ref(:THEME), :value=>theme, :command=>proc{setTheme(theme)}) unless (TkPackage.names.find{|n| n =~ /(tile|ttk)::theme::#{theme}/}) m.entryconfigure(:end, :state=>:disabled) end } $RUBY_THEMELIST.each{|theme, name, available| m.add(:radiobutton, :label=>name, :variable=>$V.ref(:THEME), :value=>theme, :command=>proc{setTheme(theme)}) m.entryconfigure(:end, :state=>:disabled) unless available } m end |
#makeToolbars ⇒ Object
Toolbar button standard vs. tile comparison:
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
# File 'sample/tkextlib/tile/demo.rb', line 204 def # # Tile toolbar: # tb = Tk::Tile::Frame.new($BASE, :class=>'Toolbar') $TOOLBARS << tb i = 0 $BUTTONS.each{|icon| i += 1 Tk::Tile::Button.new(tb, :text=>icon, :image=>$ICON[icon], :compound=>$V[:COMPOUND], :style=>:Toolbutton).grid(:row=>0, :column=>i, :sticky=>:news) } $CHECKBOXES.each{|icon| i += 1 Tk::Tile::Checkbutton.new(tb, :text=>icon, :image=>$ICON[icon], :variable=>$V.ref(icon), :compound=>$V[:COMPOUND], :style=>:Toolbutton).grid(:row=>0, :column=>i, :sticky=>:news) } mb = Tk::Tile::Menubutton.new(tb, :text=>'toolbar', :image=>$ICON['file'], :compound=>$V[:COMPOUND]) mb.configure(:menu=>makeCompoundMenu(mb)) i += 1 mb.grid(:row=>0, :column=>i, :sticky=>:news) i += 1 tb.grid_columnconfigure(i, :weight=>1) # # Standard toolbar: # tb = TkFrame.new($BASE, :class=>'Toolbar') $TOOLBARS << tb i = 0 $BUTTONS.each{|icon| i += 1 TkButton.new(tb, :text=>icon, :image=>$ICON[icon], :compound=>$V[:COMPOUND], :relief=>:flat, :overrelief=>:raised).grid(:row=>0, :column=>i, :sticky=>:news) } $CHECKBOXES.each{|icon| i += 1 TkCheckbutton.new(tb, :text=>icon, :image=>$ICON[icon], :variable=>$V.ref(icon), :compound=>$V[:COMPOUND], :indicatoron=>false, :selectcolor=>'', :relief=>:flat, :overrelief=>:raised).grid(:row=>0, :column=>i, :sticky=>:news) } mb = TkMenubutton.new(tb, :text=>'toolbar', :image=>$ICON['file'], :compound=>$V[:COMPOUND]) mb.configure(:menu=>makeCompoundMenu(mb)) i += 1 mb.grid(:row=>0, :column=>i, :sticky=>:news) i += 1 tb.grid_columnconfigure(i, :weight=>1) end |
#maybe_64bit? ⇒ Boolean
126 127 128 |
# File 'extconf.rb', line 126 def maybe_64bit? /64|universal|s390x/ =~ RUBY_PLATFORM end |
#messageReadDelayed(t) ⇒ Object
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'sample/tkextlib/treectrl/outlook-newgroup.rb', line 187 def (t) @Message[:afterId].delete(:id) i = @Message[:afterId][:item] return unless t.selection_includes(i) # This message is not read unless @Message[:read][i] # Read the message t.item_state_set(i, 'read') @Message[:read][i] = true # Check ancestors (except root) t.item_ancestors(i)[0..-2].each{|i2| # This ancestor has no more unread descendants t.item_state_set(i2, '!unread') unless anyUnreadDescendants(t, i2) } end end |
#mkTextConfig(w, x, y, option, value, color) ⇒ Object
Next, create some items that allow the text’s anchor position to be edited.
103 104 105 106 107 108 |
# File 'sample/demos-en/ctext.rb', line 103 def mkTextConfig(w,x,y,option,value,color) item = TkcRectangle.new(w, x, y, x+30, y+30, 'outline'=>'black', 'fill'=>color, 'width'=>1) item.bind('1', proc{$ctag_text.configure option, value}) w.addtag_withtag('config', item) end |
#newRoom(w) ⇒ Object
newRoom – This method is invoked whenever the mouse enters a room in the floorplan. It changes tags so that the current room is highlighted.
Arguments: w - The name of the canvas window.
69 70 71 72 73 |
# File 'sample/demos-en/floor.rb', line 69 def newRoom(w) id = w.find_withtag('current')[0] $currentRoom.value = $floorLabels[id.id] if id != "" Tk.update(true) end |
#newRoom2(w) ⇒ Object
newRoom2 – This method is invoked whenever the mouse enters a room in the floorplan. It changes tags so that the current room is highlighted.
Arguments: w - The name of the canvas window.
69 70 71 72 73 |
# File 'sample/demos-en/floor2.rb', line 69 def newRoom2(w) id = w.find_withtag('current')[0] $currentRoom2.value = $floorLabels2[id.id] if id != "" Tk.update(true) end |
#open_file(canvas, fname) ⇒ Object
define methods for menu
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 |
# File 'sample/figmemo_sample.rb', line 301 def open_file(canvas, fname) if canvas.modified? ret = Tk.(:icon=>'warning',:type=>'okcancel',:default=>'cancel', :message=>'Canvas may be modified. Really erase? ') return if ret == 'cancel' end filetypes = [ ['GIF Files', '.gif'], ['GIF Files', [], 'GIFF'], ['PPM Files', '.ppm'], ['PGM Files', '.pgm'] ] begin if Tk::Img::package_version != '' filetypes << ['JPEG Files', ['.jpg', '.jpeg']] filetypes << ['PNG Files', '.png'] filetypes << ['PostScript Files', '.ps'] filetypes << ['PDF Files', '.pdf'] filetypes << ['Windows Bitmap Files', '.bmp'] filetypes << ['Windows Icon Files', '.ico'] filetypes << ['PCX Files', '.pcx'] filetypes << ['Pixmap Files', '.pixmap'] filetypes << ['SGI Files', '.sgi'] filetypes << ['Sun Raster Files', '.sun'] filetypes << ['TGA Files', '.tga'] filetypes << ['TIFF Files', '.tiff'] filetypes << ['XBM Files', '.xbm'] filetypes << ['XPM Files', '.xpm'] end rescue end filetypes << ['ALL Files', '*'] fpath = Tk.getOpenFile(:filetypes=>filetypes) return if fpath.empty? begin canvas.load_photo(fpath) rescue => e Tk.(:icon=>'error', :type=>'ok', :message=>"Fail to read '#{fpath}'.\n#{e.}") end canvas.fig_erase canvas.reset_region fname.value = fpath end |
#optionButton1(w, x, y) ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'sample/tkextlib/treectrl/www-options.rb', line 111 def optionButton1(w, x, y) w.set_focus id = w.identify(x, y) if id[0] == 'header' Tk::TreeCtrl::BindCallback.(w, x, y) elsif id.empty? @Priv['buttonMode'] = '' else @Priv['buttonMode'] = '' item = id[1] w.selection_modify(item, :all) w.activate(item) return if @Option[:option, item] == '' group = @Option[:group, item] if group == '' # a checkbutton w.item_state_set(item, '~on') if @Option[:setting, item] == 'on' setting = :off else setting = :on end @Option[:setting, item] = setting else # a radiobutton current = @Option[:current, group] return if current == item.to_s w.item_state_set(current, '!on') w.item_state_set(item, 'on') @Option[:setting, item] = :on @Option[:current, group] = item end end end |
#optionButton1_2(w, x, y) ⇒ Object
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
# File 'sample/tkextlib/treectrl/www-options.rb', line 239 def optionButton1_2(w, x, y) w.set_focus id = w.identify(x, y) if id[0] == 'header' Tk::TreeCtrl::BindCallback.(w, x, y) elsif id.empty? @Priv['buttonMode'] = '' else @Priv['buttonMode'] = '' item = id[1] w.selection_modify(item, :all) w.activate(item) return if @Option[:option, item] == '' group = @Option[:group, item] if group == '' # a checkbutton if @Option[:setting, item] == 'on' setting = :off else setting = :on end w.item_element_configure(item, 0, 'e1', :image=>@images["internet-check-#{setting}"]) @Option[:setting, item] = setting else # a radiobutton current = @Option[:current, group] return if current == item.to_s w.item_element_configure(current, 0, 'e1', :image=>@images["internet-radio-off"]) w.item_element_configure(item, 0, 'e1', :image=>@images["internet-radio-on"]) @Option[:setting, item] = :on @Option[:current, group] = item end end end |
#optionLeave1(w, x, y) ⇒ Object
284 285 286 287 288 289 290 291 292 293 294 295 296 |
# File 'sample/tkextlib/treectrl/www-options.rb', line 284 def optionLeave1(w, x, y) # This is called when I do ButtonPress-1 on Unix for some reason, # and buttonMode is undefined. begin mode = @Priv['buttonMode'] rescue else case mode when 'header' t.column_configure(@Priv['column'], :sunken=>false) end end end |
#optionMenu(menubutton, varName, firstValue, *rest) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'sample/demos-en/menubu.rb', line 9 def optionMenu(, varName, firstValue, *rest) varName.value = firstValue = {'textvariable'=>varName,'indicatoron'=>'on', 'relief'=>'raised','borderwidth'=>2,'highlightthickness'=>2, 'anchor'=>'c','direction'=>'flush'} .each {|key, value| .configure(key, value) } = TkMenu.new() { tearoff 'off' add 'radio', 'label'=>firstValue, 'variable'=>varName } .() for i in rest .add 'radio', 'label'=>i, 'variable'=>varName end return end |
#optionMotion1(w, x, y) ⇒ Object
277 278 279 280 281 282 |
# File 'sample/tkextlib/treectrl/www-options.rb', line 277 def optionMotion1(w, x, y) case @Priv['buttonMode'] when 'resize', 'header' Tk::TreeCtrl::BindCallback.motion1(w, x, y) end end |
#optionRelease1(w, x, y) ⇒ Object
298 299 300 301 302 303 304 |
# File 'sample/tkextlib/treectrl/www-options.rb', line 298 def optionRelease1(w, x, y) case @Priv['buttonMode'] when 'resize', 'header' Tk::TreeCtrl::BindCallback.release1(w, x, y) end @Priv['buttonMode'] = '' end |
#parse_tclConfig(file) ⇒ Object
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
# File 'extconf.rb', line 388 def parse_tclConfig(file) # check tclConfig.sh/tkConfig.sh tbl = Hash.new{|h,k| h[k] = ""} return tbl unless file IO.foreach(file){|line| line.strip! next if line !~ /^([^\#=][^=]*)=(['"]|)(.*)\2$/ key, val = $1, $3 tbl[key] = val.gsub(/\$\{([^}]+)\}/){|s| subst = $1 (tbl[subst])? tbl[subst]: s } rescue nil } tbl end |
#parse_TK_LIBS(tklibs) ⇒ Object
1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 |
# File 'extconf.rb', line 1189 def parse_TK_LIBS(tklibs) sfx = "lib|shlib|dll|so" re = /(("|')[^"']+\.(#{sfx})\2|[^"' ]+\.(#{sfx})|-l("|')[^"']+\5|-l[^" ]+)/#' tklibs.scan(re).map{|lib,| if lib =~ /^("|')([^"]+)\.(#{sfx})\1/ "\"-l#{$2}\"" elsif lib =~ /([^" ]+)\.(#{sfx})/ "-l#{$1}" else lib end }.join(' ') end |
#pbMode(progress, vprogress) ⇒ Object
515 516 517 518 519 520 521 522 |
# File 'sample/tkextlib/tile/demo.rb', line 515 def pbMode(progress, vprogress) if vprogress.mode != $V[:PBMODE] vprogress.value(vprogress.maximum - vprogress.value) end progress.mode $V[:PBMODE] vprogress.mode $V[:PBMODE] end |
#pbStart(progress, vprogress) ⇒ Object
526 527 528 529 530 531 |
# File 'sample/tkextlib/tile/demo.rb', line 526 def pbStart(progress, vprogress) # $V[:PBMODE] = 'indeterminate' pbMode(progress, vprogress) progress.start 10 vprogress.start end |
#pbStop(progress, vprogress) ⇒ Object
535 536 537 538 |
# File 'sample/tkextlib/tile/demo.rb', line 535 def pbStop(progress, vprogress) progress.stop vprogress.stop end |
#phoneSkipLeft(widget) ⇒ Object
phoneSkipLeft – Skip over fixed characters in a phone-number string when moving left.
Arguments: widget - The entry widget containing the phone-number.
126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'sample/demos-en/entry3.rb', line 126 def phoneSkipLeft() idx = .index('insert') if idx == 8 # Skip back two extra characters .cursor = idx - 2 elsif idx == 7 || idx == 12 # Skip back one extra character .cursor = idx - 1 elsif idx <= 3 # Can't move any further Tk.bell Tk.callback_break end end |
#phoneSkipRight(widget, add = 0) ⇒ Object
phoneSkipRight – Skip over fixed characters in a phone-number string when moving right.
Arguments: widget - The entry widget containing the phone-number. add - Offset to add to index before calculation (used by validation.)
147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'sample/demos-en/entry3.rb', line 147 def phoneSkipRight(, add = 0) idx = .index('insert') if (idx + add == 5) # Skip forward two extra characters .cursor = idx + 2 elsif (idx + add == 6 || idx + add == 10) # Skip forward one extra character .cursor = idx + 1 elsif (idx + add == 15 && add == 0) # Can't move any further Tk.bell Tk.callback_break end end |
#plotDown(w, x, y) ⇒ Object
plotDown – This method is invoked when the mouse is pressed over one of the data points. It sets up state to allow the point to be dragged.
Arguments: w - The canvas window. x, y - The coordinates of the mouse press.
104 105 106 107 108 109 110 |
# File 'sample/demos-en/plot.rb', line 104 def plotDown (w, x, y) w.dtag 'selected' w.addtag_withtag 'selected', 'current' w.raise 'current' $plot['lastX'] = x $plot['lastY'] = y end |
#plotMove(w, x, y) ⇒ Object
plotMove – This method is invoked during mouse motion events. It drags the current item.
Arguments: w - The canvas window. x, y - The coordinates of the mouse.
120 121 122 123 124 |
# File 'sample/demos-en/plot.rb', line 120 def plotMove (w, x, y) w.move 'selected', x - $plot['lastX'], y - $plot['lastY'] $plot['lastX'] = x $plot['lastY'] = y end |
#pop_up ⇒ Object
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'sample/tkbiff.rb', line 122 def pop_up outcount = 0; $list.delete 0, 'end' f = open($spool, "r") while !f.eof? mail = Mail.new(f) date, from, subj = mail.header['Date'], mail.header['From'], mail.header['Subject'] next if !date y = m = d = 0 y, m, d = parsedate(date) if date from = "sombody@somewhere" if ! from subj = "(nil)" if ! subj from = decode_b(from) subj = decode_b(subj) $list.insert 'end', format('%-02d/%02d/%02d [%-28.28s] %s',y,m,d,from,subj) outcount += 1 end f.close if outcount == 0 $list.insert 'end', "You have no mail." else $list.see 'end' end $top.deiconify Tk.after 2000, proc{$top.iconify} end |
#populate_roots(tree) ⇒ Object
Code to populate the roots of the tree (can be more than one on Windows)
57 58 59 60 61 62 |
# File 'sample/demos-en/tree.rb', line 57 def populate_roots(tree) TkComm.simplelist(Tk.tk_call('file', 'volumes')).sort.each{|dir| populate_tree(tree, tree.insert(nil, :end, :text=>dir, :values=>[dir, 'directory'])) } end |
#populate_tree(tree, node) ⇒ Object
Code to populate a node of the tree
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'sample/demos-en/tree.rb', line 65 def populate_tree(tree, node) return if tree.get(node, :type) != 'directory' path = tree.get(node, :fullpath) tree.delete(tree.children(node)) Dir.glob("#{path}/*").sort.each{|f| type = File.ftype(f) rescue nil id = tree.insert(node, :end, :text=>File.basename(f), :values=>[f, type]).id if type == 'directory' ## Make it so that this node is openable tree.insert(id, 0, :text=>'dummy') tree.itemconfigure(id, :text=>File.basename(f)) elsif type == 'file' size = File.size(f) if size >= 1024*1024*1024 size = '%.1f GB' % (size.to_f/1024/1024/1024) elsif size >= 1024*1024 size = '%.1f MB' % (size.to_f/1024/1024) elsif size >= 1024 size = '%.1f KB' % (size.to_f/1024) else size = '%.1f bytes' % (size.to_f/1024) end tree.set(id, :size, size) end } # Stop this code from rerunning on the current node tree.set(node, :type, 'processed_directory') end |
#ps_print(canvas, fname) ⇒ Object
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 |
# File 'sample/figmemo_sample.rb', line 384 def ps_print(canvas, fname) initname = fname.value if initname != '-' initname = File.basename(initname, File.extname(initname)) fpath = Tk.getSaveFile(:filetypes=>[ ['Postscript Files', '.ps'], ['ALL Files', '*'] ], :initialfile=>initname) else fpath = Tk.getSaveFile(:filetypes=>[ ['Postscript Files', '.ps'], ['ALL Files', '*'] ]) end return if fpath.empty? bbox = canvas.bbox('all') canvas.postscript(:file=>fpath, :x=>bbox[0], :y=>bbox[1], :width=>bbox[2] - bbox[0], :height=>bbox[3] - bbox[1]) end |
#pthread_check ⇒ Object
1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 |
# File 'extconf.rb', line 1634 def pthread_check() tcl_major_ver = nil tcl_minor_ver = nil # Is tcl-thread given by user ? case enable_config("tcl-thread") when true tcl_enable_thread = true when false tcl_enable_thread = false else tcl_enable_thread = nil end if TclConfig_Info['config_file_path'] if tcl_enable_thread == true puts("Warning: definition of tclConfig.sh is ignored, because --enable-tcl-thread option is given.") elsif tcl_enable_thread == false puts("Warning: definition of tclConfig.sh is ignored, because --disable-tcl-thread option is given.") else # tcl-thread is unknown and tclConfig.sh is given if TclConfig_Info['TCL_THREADS'] tcl_enable_thread = (TclConfig_Info['TCL_THREADS'] == "1") else tcl_major_ver = TclConfig_Info['TCL_MAJOR_VERSION'].to_i tcl_minor_ver = TclConfig_Info['TCL_MINOR_VERSION'].to_i if tcl_major_ver < 8 || (tcl_major_ver == 8 && tcl_minor_ver == 0) tcl_enable_thread = false end end if tcl_enable_thread == nil # cannot find definition if tcl_major_ver puts("Warning: '#{TclConfig_Info['config_file_path']}' doesn't include TCL_THREADS definition.") else puts("Warning: '#{TclConfig_Info['config_file_path']}' may not be a tclConfig file.") end #tclConfig = false end end end if tcl_enable_thread == nil && !TclConfig_Info['config_file_path'] # tcl-thread is unknown and tclConfig is unavailable begin try_run("int main() { exit(0); }") rescue Exception # cannot try_run. Is CROSS-COMPILE environment? puts(%Q'\ ***************************************************************************** ** ** NATIVETHREAD SUPPORT CHECK WARNING: ** ** We cannot check the consistency of nativethread support between ** Ruby and the Tcl/Tk library in your environment (are you perhaps ** cross-compiling?). If nativethread support for these 2 packages ** is inconsistent you may find you get errors when running Ruby/Tk ** (e.g. hangs or segmentation faults). We strongly recommend ** you to check the consistency manually. ** ***************************************************************************** ') return true end end if tcl_enable_thread == nil # tcl-thread is unknown if try_run(<<EOF) #include <tcl.h> int main() { Tcl_Interp *ip; ip = Tcl_CreateInterp(); exit((Tcl_Eval(ip, "set tcl_platform(threaded)") == TCL_OK)? 0: 1); } EOF tcl_enable_thread = true elsif try_run(<<EOF) #include <tcl.h> static Tcl_ThreadDataKey dataKey; int main() { exit((Tcl_GetThreadData(&dataKey, 1) == dataKey)? 1: 0); } EOF tcl_enable_thread = true else tcl_enable_thread = false end end # check pthread mode if (TkLib_Config["ruby_with_thread"]) $CPPFLAGS ||= "" # ruby -> enable unless tcl_enable_thread # ruby -> enable && tcl -> disable puts(%Q'\ ***************************************************************************** ** ** NATIVETHREAD SUPPORT MODE WARNING: ** ** Ruby is compiled with --enable-pthread, but your Tcl/Tk library ** seems to be compiled without nativethread support. Although you can ** create the tcltklib library, this combination may cause errors (e.g. ** hangs or segmentation faults). If you have no reason to keep the ** current nativethread support status, we recommend you reconfigure and ** recompile the libraries so that both or neither support nativethreads. ** ** If you want change the status of nativethread support, please recompile ** Ruby without "--enable-pthread" configure option (If you use Ruby 1.9.x ** or later, you cannot remove this option, because it requires native- ** thread support.) or recompile Tcl/Tk with "--enable-threads" configure ** option (if your Tcl/Tk is later than or equal to Tcl/Tk 8.1). ** ***************************************************************************** ') end # ruby -> enable && tcl -> enable/disable if tcl_enable_thread $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=1' else $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=0' end return true else # ruby -> disable if tcl_enable_thread # ruby -> disable && tcl -> enable puts(%Q'\ ***************************************************************************** ** ** NATIVETHREAD SUPPORT MODE ERROR: ** ** Ruby is not compiled with --enable-pthread, but your Tcl/Tk ** library seems to be compiled with nativethread support. This ** combination may cause frequent hang or segmentation fault ** errors when Ruby/Tk is working. We recommend that you NEVER ** create the library with such a combination of nativethread support. ** ** Please recompile Ruby with the "--enable-pthread" configure option ** or recompile Tcl/Tk with the "--disable-threads" configure option. ** ***************************************************************************** ') $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=1' return false else # ruby -> disable && tcl -> disable $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=0' return true end end end |
#puzzleSwitch(w, num) ⇒ Object
puzzleSwitch – This procedure is invoked when the user clicks on a particular button; if the button is next to the empty space, it moves the button into the empty space.
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'sample/demos-en/puzzle.rb', line 117 def puzzleSwitch(w, num) if ( ($ypos[num] >= ($ypos['space'] - 0.01)) \ && ($ypos[num] <= ($ypos['space'] + 0.01)) \ && ($xpos[num] >= ($xpos['space'] - 0.26)) \ && ($xpos[num] <= ($xpos['space'] + 0.26))) \ || (($xpos[num] >= ($xpos['space'] - 0.01)) \ && ($xpos[num] <= ($xpos['space'] + 0.01)) \ && ($ypos[num] >= ($ypos['space'] - 0.26)) \ && ($ypos[num] <= ($ypos['space'] + 0.26))) tmp = $xpos['space'] $xpos['space'] = $xpos[num] $xpos[num] = tmp tmp = $ypos['space'] $ypos['space'] = $ypos[num] $ypos[num] = tmp w.place('relx'=>$xpos[num], 'rely'=>$ypos[num]) end end |
#quit(canvas) ⇒ Object
403 404 405 406 |
# File 'sample/figmemo_sample.rb', line 403 def quit() print "You pressed the \"#{}\" button; bye-bye!\n" exit end |
#rand_bool ⇒ Object
29 30 31 |
# File 'sample/tkextlib/vu/vu_demo.rb', line 29 def rand_bool end |
#random_N ⇒ Object
frozen_string_literal: false
3 4 5 |
# File 'sample/tkextlib/treectrl/random.rb', line 3 def random_N @RandomN[0] || 500 end |
#randomAutoScanCheck(t, x, y) ⇒ Object
Same as TreeCtrl::AutoScanCheck, but calls RandomMotion and RandomAutoScanCheckAux
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 |
# File 'sample/tkextlib/treectrl/random.rb', line 455 def randomAutoScanCheck(t, x, y) x1, y1, x2, y2 = t.contentbox margin = t.winfo_pixels(t.scrollmargin) if x < x1 + margin || x >= x2 - margin || y < y1 + margin || y >= y2 - margin if ! @Priv.exist?(:autoscan, :afterId, t) if y >= y2 - margin t.yview(:scroll, 1, :units) delay = t.yscrolldelay elsif y < y1 + margin t.yview(:scroll, -1, :units) delay = t.yscrolldelay elsif x >= x2 - margin t.xview(:scroll, 1, :units) delay = t.xscrolldelay elsif x < x1 + margin t.xview(:scroll, -1, :units) delay = t.xscrolldelay end if @Priv.exist?(:autoscan, :scanning, t) delay = delay[1] if delay.kind_of?(Array) else delay = delay[0] if delay.kind_of?(Array) @Priv[:autoscan, :scanning, t] = true end case @Priv['buttonMode'] when 'drag', 'marquee' randomMotion(t, x, y) end @Priv[:autoscan, :afterId, t] = Tk.after(delay, proc{ randomAutoScanCheckAux(t) }) end return end Tk::TreeCtrl::BindCallback.autoScanCancel(t) end |
#randomAutoScanCheckAux(t) ⇒ Object
491 492 493 494 495 496 |
# File 'sample/tkextlib/treectrl/random.rb', line 491 def randomAutoScanCheckAux(t) @Priv.unset(:autoscan, :afterId, t) x = t.winfo_pointerx - t.winfo_rootx y = t.winfo_pointery - t.winfo_rooty randomAutoScanCheck(t, x, y) end |
#randomButton1(t, x, y) ⇒ Object
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
# File 'sample/tkextlib/treectrl/random.rb', line 177 def randomButton1(t, x, y) t.set_focus id = t.identify(x, y) puts id.inspect @Priv['buttonMode'] = '' # Click outside any item if id.empty? t.selection_clear # Click in header elsif id[0] == 'header' Tk::TreeCtrl::BindCallback.(t, x, y) # Click in item else where, item, arg1, arg2, arg3, arg4 = id case arg1 when 'button' if $Version_1_1_OrLater t.item_toggle(item) else # TreeCtrl 1.0 t.toggle(item) end when 'line' if $Version_1_1_OrLater t.item_toggle(arg2) else # TreeCtrl 1.0 t.toggle(arg2) end when 'column' ok = false # Clicked an element if id.length == 6 column = id[3] e = id[5] @Priv.list_element(:sensitive, t).each{|lst| c, s, *eList = TkComm.simplelist(lst) next if column != t.column_index(c) next if t.item_style_set(item, c) != s next if eList.find{|le| le == e} == nil ok = true break } end unless ok t.selection_clear return end @Priv[:drag, :motion] = 0 @Priv[:drag, :x] = t.canvasx(x) @Priv[:drag, :y] = t.canvasy(y) @Priv[:drop] = '' if @Priv['selectMode'] == 'add' Tk::TreeCtrl::BindCallback.beginExtend(t, item) elsif @Priv['selectMode'] == 'toggle' Tk::TreeCtrl::BindCallback.beginToggle(t, item) elsif ! t.selection_includes(item) Tk::TreeCtrl::BindCallback.beginSelect(t, item) end t.activate(item) if t.selection_includes(item) @Priv['buttonMode'] = 'drag' end end end end |
#randomDrop(t, target, src, pos) ⇒ Object
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
# File 'sample/tkextlib/treectrl/random.rb', line 374 def randomDrop(t, target, src, pos) parentList = [] case pos when 'lastchild' parent = target when 'prevsibling' parent = t.item_parent(target) when 'nextsibling' parent = t.item_parent(target) end src.each{|item| # Ignore any item whose ancestor is also selected ignore = false t.item_ancestors(item).each{|ancestor| if src.find{|val| val.to_s == ancestor.to_s} ignore = true break end } next if ignore # Update the old parent of this moved item later unless parentList.find{|val| val.to_s == item.to_s} parentList << t.item_parent(item) end # Add to target t.__send__("item_#{pos}", target, item) # Update text: parent t.item_element_configure(item, 'parent', 'e6', :text=>parent) # Update text: depth t.item_element_configure(item, 'depth', 'e6', :text=>t.depth(item)) # Recursively update text: depth itemList = [] item = t.item_firstchild(item) itemList << item if item != '' while item = itemList.pop t.item_element_configure(item, 'depth', 'e6', :text=>t.depth(item)) item2 = t.item_nextsibling(item) itemList << item2 if item2 != '' item2 = t.item_firstchild(item) itemList << item2 if item2 != '' end } # Update items that lost some children parentList.each{|item| numChildren = t.item_numchildren(item) if numChildren == 0 if $Version_1_1_OrLater t.item_configure(item, :button=>false) else # TreeCtrl 1.0 t.(item, false) end t.item_style_map(item, 'item', 's2', ['e3', 'e3']) else t.item_element_configure(item, 'item', 'e4', :text=>"(#{numChildren})") end } # Update the target that gained some children if t.item_style_set(parent, 0) != 's1' if $Version_1_1_OrLater t.item_configure(parent, :button=>true) else # TreeCtrl 1.0 t.(parent, true) end t.item_style_map(parent, 'item', 's1', ['e3', 'e3']) end numChildren = t.item_numchildren(parent) t.item_element_configure(parent, 'item', 'e4', :text=>"(#{numChildren})") end |
#randomLeave1(t, x, y) ⇒ Object
347 348 349 350 351 352 353 354 355 |
# File 'sample/tkextlib/treectrl/random.rb', line 347 def randomLeave1(t, x, y) # This is called when I do ButtonPress-1 on Unix for some reason, # and buttonMode is undefined. return unless @Priv.exist?('buttonMode') case @Priv['buttonMode'] when 'header' Tk::TreeCtrl::BindCallback.leave1(t, x, y) end end |
#randomMotion(t, x, y) ⇒ Object
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 |
# File 'sample/tkextlib/treectrl/random.rb', line 260 def randomMotion(t, x, y) case @Priv['buttonMode'] when 'resize', 'header' Tk::TreeCtrl::BindCallback.motion1(t, x, y) when 'drag' # Detect initial mouse movement unless @Priv.bool_element(:drag, :motion) @Priv[:selection] = t.selection_get @Priv[:drop] = '' t.dragimage_clear # For each selected item, add 2nd and 3rd elements of # column "item" to the dragimage @Priv.list_element(:selection).each{|i| @Priv.list_element(:dragimage,t).each{|lst| c, s, *eList = TkComm.simplelist(lst) if t.item_style_set(i, c) == s t.dragimage_add(i, c, *eList) end } } @Priv[:drag,:motion] = true end # Find the item under the cursor cursor = 'X_cursor' drop = '' id = t.identify(x, y) ok = false if !id.empty? && id[0] == 'item' && id.length == 6 item = id[1] column = id[3] e = id[5] @Priv.list_element(:sensitive,t).each{|lst| c, s, *eList = TkComm.simplelist(lst) next if column != t.column_index(c) next if t.item_style_set(item, c) != s next unless eList.find{|val| val.to_s == e.to_s} ok = true break } ok = true if @Priv.list_element(:sensitive,t).find{|val| TkComm.simplelist(val).index(e)} end if ok # If the item is not in the pre-drag selection # (i.e. not being dragged) see if we can drop on it unless @Priv.list_element(:selection).find{|val| val.to_s == item.to_s} drop = item # We can drop if dragged item isn't an ancestor @Priv.list_element(:selection).each{|item2| if t.item_isancestor(item2, item) drop = '' break end } if drop != '' x1, y1, x2, y2 = t.item_bbox(drop) if y < y1 + 3 cursor = 'top_side' @Priv[:drop,:pos] = 'prevsibling' elsif y >= y2 - 3 cursor = 'bottom_side' @Priv[:drop,:pos] = 'nextsibling' else cursor = '' @Priv[:drop,:pos] = 'lastchild' end end end end t[:cursor] = cursor if t[:cursor] != cursor # Select the item under the cursor (if any) and deselect # the previous drop-item (if any) t.selection_modify(drop, @Priv[:drop]) @Priv[:drop] = drop # Show the dragimage in its new position x = t.canvasx(x) - @Priv.numeric_element(:drag,:x) y = t.canvasx(y) - @Priv.numeric_element(:drag,:y) t.dragimage_offset(x, y) t.dragimage_configure(:visible=>true) end end |
#randomMotion1(t, x, y) ⇒ Object
250 251 252 253 254 255 256 257 258 |
# File 'sample/tkextlib/treectrl/random.rb', line 250 def randomMotion1(t, x, y) case @Priv['buttonMode'] when 'resize', 'header' Tk::TreeCtrl::BindCallback.motion1(t, x, y) when 'drag' randomAutoScanCheck(t, x, y) randomMotion(t, x, y) end end |
#randomRelease1(t, x, y) ⇒ Object
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
# File 'sample/tkextlib/treectrl/random.rb', line 357 def randomRelease1(t, x, y) case @Priv['buttonMode'] when 'resize', 'header' Tk::TreeCtrl::BindCallback.release1(t, x, y) when 'drag' Tk::TreeCtrl::BindCallback.autoScanCancel(t) t.dragimage_configure(:visible=>false) t.selection_modify('', @Priv[:drop]) t[:cursor] = '' if @Priv[:drop] != '' randomDrop(t, @Priv[:drop], @Priv.list_element(:selection), @Priv[:drop, :pos]) end end @Priv['buttonMode'] = '' end |
#repeatDemo ⇒ Object
Repeating buttons demo:
959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 |
# File 'sample/tkextlib/tile/demo.rb', line 959 def repeatDemo if defined?($repeatDemo) && $repeatDemo.exist? $repeatDemo.deiconify; return end $repeatDemo = TkToplevel.new(:title=>'Repeating button') f = Tk::Tile::Frame.new($repeatDemo) b = Tk::Tile::Button.new(f, :class=>'Repeater', :text=>'Press and hold') if version?('0.6') p = Tk::Tile::Progressbar.new(f, :orient=>:horizontal, :maximum=>10) else # progressbar is not supported p = Tk::Tile::Progress.new(f, :orient=>:horizontal, :from=>0, :to=>10) def p.step i = self.get + 1 i = self.from if i > self.to self.set(i) end end b.command {p.step} b.pack(:side=>:left, :expand=>false, :fill=>:none, :padx=>6, :pady=>6) p.pack(:side=>:right, :expand=>true, :fill=>:x, :padx=>6, :pady=>6) f.pack(:expand=>true, :fill=>:both) end |
#roomChanged(w, *args) ⇒ Object
roomChanged – This method is invoked whenever the currentRoom variable changes. It highlights the current room and unhighlights any previous room.
Arguments: w - The canvas window displaying the floorplan. args - Not used.
83 84 85 86 87 88 89 90 |
# File 'sample/demos-en/floor.rb', line 83 def roomChanged(w,*args) w.delete('highlight') item = $floorItems[$currentRoom.value] return if item == nil new = TkcPolygon.new(w, *(w.coords(item))) new.configure('fill'=>$floor_colors['active'], 'tags'=>'highlight') w.raise(new, 'marker') end |
#roomChanged2(w, *args) ⇒ Object
roomChanged2 – This method is invoked whenever the currentRoom variable changes. It highlights the current room and unhighlights any previous room.
Arguments: w - The canvas window displaying the floorplan. args - Not used.
83 84 85 86 87 88 89 90 |
# File 'sample/demos-en/floor2.rb', line 83 def roomChanged2(w,*args) w.delete('highlight') item = $floorItems2[$currentRoom2.value] return if item == nil new = TkcPolygon.new(w, *(w.coords(item))) new.configure('fill'=>$floor2_colors['active'], 'tags'=>'highlight') w.raise(new, 'marker') end |
#rulerMkTab(c, x, y) ⇒ Object
rulerMkTab – This method creates a new triangular polygon in a canvas to represent a tab stop.
Arguments: c - The canvas window. x, y - Coordinates at which to create the tab stop.
18 19 20 21 |
# File 'sample/demos-en/ruler.rb', line 18 def rulerMkTab(c,x,y) v = $demo_rulerInfo TkcPolygon.new(c, x, y, x+v.size, y+v.size, x-v.size, y+v.size) end |
#rulerMoveTab(c, x, y) ⇒ Object
rulerMoveTab – This method is invoked during mouse motion events to drag a tab. It adjusts the position of the tab, and changes its appearance if it is about to be dragged out of the ruler.
Arguments: c - The canvas widget. x, y - The coordinates of the mouse.
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'sample/demos-en/ruler.rb', line 168 def rulerMoveTab(c,x,y) v = $demo_rulerInfo return if c.find_withtag('active') == [] cx = c.canvasx(x,v.grid) cy = c.canvasy(y) cx = v.left if cx < v.left cx = v.right if cx > v.right if (cy >= v.top && cy <= v.bottom) cy = v.top+2 c.itemconfigure('active', v.activeStyle) else cy = cy-v.size-2 c.itemconfigure('active', v.deleteStyle) end c.move('active', cx-v.x, cy-v.y) v.x = cx v.y = cy end |
#rulerNewTab(c, x, y) ⇒ Object
rulerNewTab – Does all the work of creating a tab stop, including creating the triangle object and adding tags to it to give it tab behavior.
Arguments: c - The canvas window. x, y - The coordinates of the tab stop.
131 132 133 134 135 136 137 138 |
# File 'sample/demos-en/ruler.rb', line 131 def rulerNewTab(c,x,y) v = $demo_rulerInfo c.addtag_withtag('active', rulerMkTab(c,x,y)) c.addtag_withtag('tab', 'active') v.x = x v.y = y rulerMoveTab(c,x,y) end |
#rulerReleaseTab(c) ⇒ Object
rulerReleaseTab – This method is invoked during button release events that end a tab drag operation. It deselects the tab and deletes the tab if it was dragged out of the ruler.
Arguments: c - The canvas widget. x, y - The coordinates of the mouse.
196 197 198 199 200 201 202 203 204 205 |
# File 'sample/demos-en/ruler.rb', line 196 def rulerReleaseTab(c) v = $demo_rulerInfo return if c.find_withtag('active') == [] if v.y != v.top+2 c.delete('active') else c.itemconfigure('active', v.normalStyle) c.dtag('active') end end |
#rulerSelectTab(c, x, y) ⇒ Object
rulerSelectTab – This method is invoked when mouse button 1 is pressed over a tab. It remembers information about the tab so that it can be dragged interactively.
Arguments: c - The canvas widget. x, y - The coordinates of the mouse (identifies the point by
which the tab was picked up for dragging).
150 151 152 153 154 155 156 157 |
# File 'sample/demos-en/ruler.rb', line 150 def rulerSelectTab(c,x,y) v = $demo_rulerInfo v.x = c.canvasx(x, v.grid) v.y = v.top+2 c.addtag_withtag('active', 'current') c.itemconfigure('active', v.activeStyle) c.raise('active') end |
#save_memo(canvas, fname) ⇒ Object
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 |
# File 'sample/figmemo_sample.rb', line 354 def save_memo(canvas, fname) initname = fname.value if initname != '-' initname = File.basename(initname, File.extname(initname)) fpath = Tk.getSaveFile(:filetypes=>[ ['Text Files', '.txt'], ['ALL Files', '*'] ], :initialfile=>initname) else fpath = Tk.getSaveFile(:filetypes=>[ ['Text Files', '.txt'], ['ALL Files', '*'] ]) end return if fpath.empty? begin fid = open(fpath, 'w') rescue => e Tk.(:icon=>'error', :type=>'ok', :message=>"Fail to open '#{fname.value}'.\n#{e.}") end begin canvas.get_texts.each{|txt| fid.print(txt, "\n") } ensure fid.close end end |
#sbstub(sb, cmd, num, units = 'units') ⇒ Object
sbstub Used as the :command option for a scrollbar, updates the scrollbar’s position.
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'sample/tkextlib/tile/demo.rb', line 163 def sbstub(sb, cmd, num, units = 'units') num = TkComm.number(num) case cmd.to_s when 'moveto' sb.set(num, num+0.5) when 'scroll' if units.to_s == 'pages' delta = 0.2 else delta = 0.05 end current = sb.get sb.set(current[0] + delta * num, current[1] + delta * num) end end |
#scrollbarResizeDemo ⇒ Object
791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 |
# File 'sample/tkextlib/tile/demo.rb', line 791 def if $scrollbars begin $scrollbars.destroy rescue end end $scrollbars = TkToplevel.new(:title=>'Scrollbars', :geometry=>'200x200') f = TkFrame.new($scrollbars, :height=>200) tsb = Tk::Tile::Scrollbar.new(f, :command=>proc{|*args| sbstub(tsb, *args)}) sb = TkScrollbar.new(f, :command=>proc{|*args| sbstub(sb, *args)}) Tk.grid(tsb, sb, :sticky=>:news) sb.set(0, 0.5) # prevent backwards-compatibility mode for old SB f.grid_columnconfigure(0, :weight=>1) f.grid_columnconfigure(1, :weight=>1) f.grid_rowconfigure(0, :weight=>1) f.pack(:expand=>true, :fill=>:both) end |
#scrollButton(c) ⇒ Object
132 133 134 135 136 |
# File 'sample/demos-en/cscroll.rb', line 132 def scrollButton(c) id = c.find_withtag('current')[0].id id += 1 unless c.('current').include?('text') print "You buttoned at #{c.itemconfiginfo(id,'text')[4]}\n" end |
#scrolledWidget(parent, klass, themed, *args) ⇒ Object
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 |
# File 'sample/tkextlib/tile/demo.rb', line 302 def scrolledWidget(parent, klass, themed, *args) if themed f = Tk::Tile::Frame.new(parent) t = klass.new(f, *args) vs = Tk::Tile::Scrollbar.new(f) hs = Tk::Tile::Scrollbar.new(f) else f = TkFrame.new(parent) t = klass.new(f, *args) vs = TkScrollbar.new(f) hs = TkScrollbar.new(f) end t.(vs) t.(hs) TkGrid.configure(t, vs, :sticky=>:news) TkGrid.configure(hs, 'x', :sticky=>:news) TkGrid.rowconfigure(f, 0, :weight=>1) TkGrid.columnconfigure(f, 0, :weight=>1) [f, t] end |
#scrollEnter(c) ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 |
# File 'sample/demos-en/cscroll.rb', line 113 def scrollEnter(c) id = c.find_withtag('current')[0].id id -= 1 if c.('current').include?('text') $oldFill = c.itemconfiginfo(id, 'fill')[4] if TkWinfo.depth(c) > 1 c.itemconfigure(id, 'fill'=>'SeaGreen1') else c.itemconfigure(id, 'fill'=>'black') c.itemconfigure(id+1, 'fill'=>'white') end end |
#scrollLeave(c) ⇒ Object
125 126 127 128 129 130 |
# File 'sample/demos-en/cscroll.rb', line 125 def scrollLeave(c) id = c.find_withtag('current')[0].id id -= 1 if c.('current').include?('text') c.itemconfigure(id, 'fill'=>$oldFill) c.itemconfigure(id+1, 'fill'=>'black') end |
#search_tclConfig(*paths) ⇒ Object
libdir list or [tcl-libdir|file, tk-libdir|file]
703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 |
# File 'extconf.rb', line 703 def search_tclConfig(*paths) # libdir list or [tcl-libdir|file, tk-libdir|file] TkLib_Config["tclConfig_paths"] = [] paths.compact! if paths.empty? config_dir = get_tclConfig_dirs elsif paths.length == 1 && !paths[0][0] && !paths[0][1] config_dir = get_tclConfig_dirs.map{|dir| if dir.kind_of? Array [ (paths[0][0] == false)? nil: dir[0], (paths[0][1] == false)? nil: dir[1] ] else [ (paths[0][0] == false)? nil: dir, (paths[0][1] == false)? nil: dir ] end } else # fixed tclConfig config_dir = [] paths.each{|path| if path.kind_of?(Array) config_dir << path else dirs = Dir.glob(path, File::FNM_CASEFOLD) config_dir.concat(dirs.zip(dirs)) end } end tclver, tkver = TkLib_Config['tcltkversion'] if tclver && tclver =~ /^\D*(\d)\.?(\d)?/ # ignore PATCH_LEVEL tclver_major = $1 tclver_minor = $2 else tclver_major = nil tclver_minor = nil end if tkver && tkver =~ /^\D*(\d)\.?(\d)?/ # ignore PATCH_LEVEL tkver_major = $1 tkver_minor = $2 else tkver_major = nil tkver_minor = nil end conf = nil progress_flag = false config_dir.uniq! config_dir.map{|dir| if dir.kind_of? Array [ (dir[0])? dir[0].strip.chomp('/'): nil, (dir[1])? dir[1].strip.chomp('/'): nil ] else dir.strip.chomp('/') end }.each{|dir| print("."); progress_flag = true # progress # print("check #{dir} ==>"); if dir.kind_of? Array tcldir, tkdir = dir else tcldir = tkdir = dir end tails = ['Config-shared.sh', 'config-shared.sh', 'Config.sh', 'config.sh'] if tcldir if File.file?(tcldir) tclcfg_files = [tcldir] * tails.length else tclcfg_files = tails.map{|f| File.join(tcldir, 'tcl' << f)} end else tclcfg_files = [nil] * tails.length end if tkdir if File.file?(tkdir) tkcfg_files = [tkdir] * tails.length else tkcfg_files = tails.map{|f| File.join(tkdir, 'tk' << f)} end else tkcfg_files = [nil] * tails.length end tclcfg_files.zip(tkcfg_files).map{|tclpath, tkpath| [ (tclpath && File.exist?(tclpath))? File.(tclpath): tclpath, (tkpath && File.exist?(tkpath))? File.(tkpath): tkpath ] }.uniq.each{|tclpath, tkpath| next if tclpath && !File.exist?(tclpath) next if tkpath && !File.exist?(tkpath) # parse tclConfig.sh/tkConfig.sh tclconf = (tclpath)? parse_tclConfig(tclpath): nil if tclconf if tclver && ((tclver_major && tclver_major != tclconf['TCL_MAJOR_VERSION']) || (tclver_minor && tclver_minor != tclconf['TCL_MINOR_VERSION'])) print("\n") if progress_flag puts "Ignore \"#{tclpath}\" (unmatch with configured version)." progress_flag = false next end if TkLib_Config['unsupported_versions'].find{|ver| ver == "#{tclconf['TCL_MAJOR_VERSION']}.#{tclconf['TCL_MINOR_VERSION']}"} print("\n") if progress_flag puts "Ignore \"#{tclpath}\" (unsupported version of Tcl/Tk)." progress_flag = false next end end tkconf = (tkpath)? parse_tclConfig(tkpath): nil if tkconf if tkver && ((tkver_major && tkver_major != tkconf['TK_MAJOR_VERSION']) || (tkver_minor && tkver_minor != tkconf['TK_MINOR_VERSION'])) print("\n") if progress_flag puts "Ignore \"#{tkpath}\" (unmatch with configured version)." progress_flag = false next end if TkLib_Config['unsupported_versions'].find{|ver| ver == "#{tkconf['TK_MAJOR_VERSION']}.#{tkconf['TK_MINOR_VERSION']}"} print("\n") if progress_flag puts "Ignore \"#{tkpath}\" (unsupported version of Tcl/Tk)." progress_flag = false next end end # nativethread check if !TkLib_Config["ruby_with_thread"] if tclconf if tclconf['TCL_THREADS'] == '1' puts "\nWARNING: found #{tclpath.inspect}, but it WITH nativethread-support under ruby WITHOUT nativethread-support. So, ignore it." TkLib_Config["tcl-NG-path"] << File.dirname(tclpath) next end else puts "\nWARNING: When not refer tclConfig.sh, cannot check native-thread support on Tcl/Tk libraries. Ruby, which is used now, does NOT support native-thread. So, if Tcl/Tk libraries support native-thread, it will NOT work properly." end end # find tclConfig.sh & tkConfig.sh conf = [tclconf, tkconf] unless conf # check Tcl library if is_macosx? && TkLib_Config["tcltk-framework"] # if use framework, not check (believe it is installed properly) tcllib_ok = tklib_ok = true else tcllib_ok, tklib_ok = libcheck_for_tclConfig((tclpath)? File.dirname(tclpath): nil, (tkpath)? File.dirname(tkpath): nil, tclconf, tkconf) end unless tcllib_ok && tklib_ok unless tcllib_ok puts "\nWARNING: found #{tclpath.inspect}, but cannot find valid Tcl library for the tclConfig.sh. So, ignore it." TkLib_Config["tcl-NG-path"] << File.dirname(tclpath) end unless tklib_ok puts "\nWARNING: found #{tkpath.inspect}, but cannot find valid Tk library for the tkConfig.sh. So, ignore it." TkLib_Config["tk-NG-path"] << File.dirname(tkpath) end next end #return [tclpath, tkpath] # print(" #{[tclpath, tkpath].inspect}"); TkLib_Config["tclConfig_paths"] << [tclpath, tkpath] } # print("\n"); } if is_macosx? && TkLib_Config["tcltk-stubs"] CONFIG['LDSHARED'] << " -Xlinker -bind_at_load" if config_string('LDSHAREDXX') config_string('LDSHAREDXX') << " -Xlinker -bind_at_load" end end if TkLib_Config["tclConfig_paths"].empty? [nil, nil] else # find tclConfig.sh and tkConfig.sh TkLib_Config["tclConfig_info"], TkLib_Config["tkConfig_info"] = conf TkLib_Config["tclConfig_paths"][0] end end |
#search_vers_on_path(vers, path, *heads) ⇒ Object
1054 1055 1056 1057 1058 |
# File 'extconf.rb', line 1054 def search_vers_on_path(vers, path, *heads) exts = get_ext_list.join(',') files = Dir.glob(File.join(path, "*{#{heads.join(',')}}*.{#{exts}}"), File::FNM_CASEFOLD) vers.find_all{|ver| files.find{|f| f =~ /(#{ver}|#{ver.delete('.')})/} } end |
#search_X_libraries ⇒ Object
1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 |
# File 'extconf.rb', line 1590 def search_X_libraries use_tkConfig = false if TkConfig_Info['config_file_path'] # use definitions on tkConfig.sh if (TkConfig_Info['TK_XINCLUDES'] && !TkConfig_Info['TK_XINCLUDES'].strip.empty?) || (TkConfig_Info['TK_XLIBSW'] && !TkConfig_Info['TK_XLIBSW'].strip.empty?) use_tkConfig = true #use_X = true && with_config("X11", ! is_win32?) use_X = with_config("X11", true) else #use_X = false || with_config("X11", false) use_X = with_config("X11", false) end else # depend on configure options use_X = with_config("X11", !(is_win32? || TkLib_Config["tcltk-framework"])) end if TkConfig_Info['TK_XINCLUDES'] && !TkConfig_Info['TK_XINCLUDES'].strip.empty? ($INCFLAGS ||= "") << " " << TkConfig_Info['TK_XINCLUDES'].strip end if use_X puts("Use X11 libraries (or use TK_XINCLUDES/TK_XLIBSW information on tkConfig.sh).") x11_idir, x11_ldir = dir_config("X11") x11_ldir2 = with_config("X11-lib") unless find_X11(x11_ldir2, x11_ldir) puts("Can't find X11 libraries. ") if use_tkConfig && TkConfig_Info['TK_XLIBSW'] && !TkConfig_Info['TK_XLIBSW'].strip.empty? puts("But, try to use TK_XLIBSW information (believe tkCOnfig.sh).") ($libs ||= "") << " " << TkConfig_Info['TK_XLIBSW'] << " " else puts("So, can't make tcltklib.so which is required by Ruby/Tk.") exit end end end use_X end |
#selectAndLoadDir3(w, lbox) ⇒ Object
selectAndLoadDir3 – This procedure pops up a dialog to ask for a directory to load into the listobx and (if the user presses OK) reloads the directory listbox from the directory named in the demo’s entry.
Arguments: w - Name of the toplevel window of the demo.
40 41 42 43 44 45 46 47 |
# File 'sample/demos-en/image3.rb', line 40 def selectAndLoadDir3(w, lbox) dir = Tk.chooseDirectory(:initialdir=>$dirName.value, :parent=>w, :mustexist=>true) if dir.length > 0 $dirName.value = dir loadDir3(lbox) end end |
#set_class_bind ⇒ Object
14 15 16 17 18 19 |
# File 'sample/bindtag_sample.rb', line 14 def set_class_bind TkButton.bind('ButtonPress-1', proc{puts 'bind "ButtonPress-1" of TkButton class'}) TkButton.bind('ButtonRelease-1', proc{puts 'bind "ButtonRelease-1" of TkButton class'}) end |
#set_msg(x, y, bhelp, parent) ⇒ Object
CASE4b : command is a Method object and takes 4 arguemnts
203 204 205 |
# File 'sample/tkballoonhelp.rb', line 203 def set_msg(x, y, bhelp, parent) bhelp.text "current index == #{parent.nearest(y)}" end |
#setColor(w, button, name, options) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 |
# File 'sample/demos-en/clrpick.rb', line 65 def setColor(w,,name,) w.grab initialColor = [name] color = Tk.chooseColor('title'=>"Choose a #{name} color", 'parent'=>w, 'initialcolor'=>initialColor) if color != "" setColor_helper(w,,color) end w.grab('release') end |
#setColor_helper(w, options, color) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 |
# File 'sample/demos-en/clrpick.rb', line 77 def setColor_helper(w, , color) .each{|opt| begin w[opt] = color rescue end } TkWinfo.children(w).each{|child| setColor_helper child, , color } end |
#setHeight(w, height) ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'sample/demos-en/vscale.rb', line 45 def setHeight(w, height) height = height + 21 y2 = height - 30 if y2 < 21 y2 = 21 end w.coords 'poly',15,20,35,20,35,y2,45,y2,25,height,5,y2,15,y2,15,20 w.coords 'line',15,20,35,20,35,y2,45,y2,25,height,5,y2,15,y2,15,20 end |
#setState(root, value, *excepts) ⇒ Object
Helper procedure for the top checkbutton
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'sample/demos-en/ttkbut.rb', line 47 def setState(root, value, *excepts) return if excepts.member?(root) ## Non-Ttk widgets (e.g. the toplevel) will fail, so make it silent begin root.state = value rescue end ## Recursively invoke on all children of this root that are in the same ## toplevel widget root.winfo_children.each{|w| setState(w, value, *excepts) if w.winfo_toplevel == root.winfo_toplevel } end |
#setTheme(theme) ⇒ Object
123 124 125 126 127 128 129 130 |
# File 'sample/tkextlib/tile/demo.rb', line 123 def setTheme(theme) if (pkg = TkPackage.names.find{|n| n =~ /(tile|ttk)::theme::#{theme}/}) unless Tk::Tile::Style.theme_names.find{|n| n == theme} TkPackage.require(pkg) end end Tk::Tile::Style.theme_use(theme) end |
#setup_for_macosx_framework(tclver, tkver) ⇒ Object
1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 |
# File 'extconf.rb', line 1532 def setup_for_macosx_framework(tclver, tkver) # use framework, but no tclConfig.sh unless $LIBS && $LIBS.include?('-framework') ($LIBS ||= "") << ' -framework Tk -framework Tcl' end if TkLib_Config["tcl-framework-header"] TclConfig_Info['TCL_INCLUDE_SPEC'][0,0] = " -I#{TkLib_Config["tcl-framework-header"].quote} " else tcl_base = File.join(TkLib_Config["tcltk-framework"], 'Tcl.framework') if tclver TclConfig_Info['TCL_INCLUDE_SPEC'] << " -I#{File.join(tcl_base, 'Versions', tclver, 'Headers').quote} " end TclConfig_Info['TCL_INCLUDE_SPEC'] << File.join(tcl_base, 'Headers') unless tclver dir = Dir.glob(File.join(tcl_base, 'Versions', '*', 'Headers'), File::FNM_CASEFOLD).sort.reverse[0] TclConfig_Info['TCL_INCLUDE_SPEC'] << "-I#{dir.quote} " if dir end end if TkLib_Config["tk-framework-header"] TkConfig_Info['TK_INCLUDE_SPEC'][0,0] = " -I#{TkLib_Config["tk-framework-header"].quote} " else tk_base = File.join(TkLib_Config["tcltk-framework"], 'Tk.framework') if tkver TkConfig_Info['TK_INCLUDE_SPEC'] << " -I#{File.join(tk_base, 'Versions', tkver, 'Headers').quote} " end TkConfig_Info['TK_INCLUDE_SPEC'] << File.join(tk_base, 'Headers') unless tkver dir = Dir.glob(File.join(tk_base, 'Versions', '*', 'Headers'), File::FNM_CASEFOLD).sort.reverse[0] TkConfig_Info['TK_INCLUDE_SPEC'] << "-I#{dir.quote} " if dir end end end |
#setWidth(w, width) ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'sample/demos-en/hscale.rb', line 42 def setWidth(w, width) width = width + 21 x2 = width - 30 if x2 < 21 x2 = 21 end w.coords 'poly',20,15,20,35,x2,35,x2,45,width,25,x2,5,x2,15,20,15 w.coords 'line',20,15,20,35,x2,35,x2,45,width,25,x2,5,x2,15,20,15 end |
#show_loupe(setting = nil) ⇒ Object
1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 |
# File 'sample/tkextlib/treectrl/demo.rb', line 1275 def show_loupe(setting=nil) loupe = (setting.kind_of?(Hash))? setting: {} loupe[:zoom] = 3 unless loupe[:zoom] loupe[:x] = 0 unless loupe[:x] loupe[:y] = 0 unless loupe[:y] loupe[:auto] = true unless loupe[:auto] loupe[:delay] = 500 unless loupe[:delay] loupe[:image] = TkPhotoImage.new(:width=>150, :height=>150) unless loupe[:image] top = TkToplevel.new(:geometry=>'-0+30', :title=>'A little screen magnifier for X11') TkLabel.new(top, :image=>loupe[:image]).pack TkTimer.new(proc{loupe[:delay]}, -1, proc{ x, y = TkWinfo.pointerxy(Tk.root) if loupe[:auto] || loupe[:x] != x || loupe[:y] != y w = loupe[:image].width h = loupe[:image].height Tk::TreeCtrl.loupe(loupe[:image], x, y, w, h, loupe[:zoom]) loupe[:x] = x loupe[:y] = y end }).start end |
#showHelp ⇒ Object
184 185 186 |
# File 'sample/tkextlib/tile/demo.rb', line 184 def showHelp() Tk.(:message=>'No help yet...') end |
#showMessageBox(w) ⇒ Object
83 84 85 86 87 88 89 90 |
# File 'sample/demos-en/msgbox.rb', line 83 def showMessageBox(w) = Tk.('icon'=>$msgboxIcon.value, 'type'=>$msgboxType.value, 'title'=>'Message', 'parent'=>w, 'message'=>"This is a \"#{$msgboxType.value}\" type messagebox with the \"#{$msgboxIcon.value}\" icon") Tk.('icon'=>'info', 'type'=>'ok', 'parent'=>w, 'message'=>"You have selected \"#{}\"") end |
#showMessageBox2(w) ⇒ Object
83 84 85 86 87 88 89 90 91 |
# File 'sample/demos-en/msgbox2.rb', line 83 def showMessageBox2(w) = Tk.('icon'=>$msgboxIcon.value, 'type'=>$msgboxType.value, 'title'=>'Message', 'parent'=>w, 'message'=>"\"#{$msgboxType.value}\" Type MessageBox", 'detail'=>"This is a \"#{$msgboxType.value}\" type messagebox with the \"#{$msgboxIcon.value}\" icon. Please click one of the following button.") Tk.('icon'=>'info', 'type'=>'ok', 'parent'=>w, 'message'=>"You have selected \"#{}\"") end |
#sort_by(tree, col, direction) ⇒ Object
Code to do the sorting of the tree contents when clicked on
112 113 114 115 116 117 118 |
# File 'sample/demos-en/mclist.rb', line 112 def sort_by(tree, col, direction) tree.children(nil).map!{|row| [tree.get(row, col), row.id]} . sort(&((direction)? proc{|x, y| y <=> x}: proc{|x, y| x <=> y})) . each_with_index{|info, idx| tree.move(info[1], nil, idx)} tree.heading_configure(col, :command=>proc{sort_by(tree, col, ! direction)}) end |
#start_random ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'sample/tkline.rb', line 6 def start_random return if $tkline_init $tkline_init = TRUE if defined? Thread Thread.start do loop do sleep 2 Line.new($c, rand(400), rand(200), rand(400), rand(200)) end end end end |
#stateMonitor ⇒ Object
929 930 931 932 |
# File 'sample/tkextlib/tile/demo.rb', line 929 def stateMonitor updateStates() if $Widget.value != '' $Timers[:StateMonitor] = Tk.after(200, proc{ stateMonitor() }) end |
#subdir_check(dir, verbose = false) ⇒ Object
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/tkextlib/pkg_checker.rb', line 144 def subdir_check(dir, verbose=false) Dir.foreach(dir){|f| next if f == '.' || f == '..' if File.directory?(f) subdir_check(File.join(dir, f)) elsif File.extname(f) == '.rb' path = File.join(dir, f) suc, err = check_pkg(path, verbose) if err.empty? print 'Ready : ', path, ' : require->', suc.inspect, "\n" else print '*LACK : ', path, ' : require->', suc.inspect, ' FAIL->', err.inspect, "\n" end end } end |
#table_validate(w, idx) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'sample/tkextlib/tktable/dynarows.rb', line 15 def table_validate(w, idx) return unless idx =~ /^(\d+),(\d+)$/ row = Integer($1) col = Integer($2) val = w.get(idx) [w, idx] nrows = w[:rows] return if row == nrows - 1 && val == '' begin time = Tk.tk_call('clock', 'scan', val) date = [] Tk.tk_call('clock', 'format', time, :format=>'%m %d %Y').split(' ').each{|item| date << item.sub(/^\s*0*/,'') } w.set(idx, date.join('/')) if row == nrows - 1 if w.get([row,1]) != '' && w.get([row,2]) != '' w.tag_row_reset(row) w.set([row,0], row) nrows += 1 row += 1 w.configure(:rows=>nrows) w.tag_row('unset', row) w.set([row,0], '*') w.see([row,1]) w.activate([row,1]) end end rescue Tk.bell w.activate(idx) w.selection_clear_all w.selection_set(:active) w.see(:active) end end |
#tag_binding_for_bind_demo(tag, enter_style, leave_style) ⇒ Object
bind 用メソッド
43 44 45 46 |
# File 'sample/demos-en/bind.rb', line 43 def tag_binding_for_bind_demo(tag, enter_style, leave_style) tag.bind('Any-Enter', proc{tag.configure enter_style}) tag.bind('Any-Leave', proc{tag.configure leave_style}) end |
#tb_btn ⇒ Object
Arrange contents
105 106 |
# File 'sample/demos-en/toolbar.rb', line 105 Tk.grid(tb_btn, tb_chk, tb_mbtn, tb_combo, :in=>contents, :padx=>2, :sticky=>'ns') |
#test ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'sample/tcltklib/sample0.rb', line 8 def test # インタプリタを生成する ip1 = TclTkIp.new() # 評価してみる print ip1._return_value().inspect, "\n" print ip1._eval("puts {abc}").inspect, "\n" # ボタンを作ってみる print ip1._return_value().inspect, "\n" print ip1._eval("button .lab -text exit -command \"destroy .\"").inspect, "\n" print ip1._return_value().inspect, "\n" print ip1._eval("pack .lab").inspect, "\n" print ip1._return_value().inspect, "\n" # インタプリタから ruby コマンドを評価してみる # print ip1._eval(%q/ruby {print "print by ruby\n"}/).inspect, "\n" print ip1._eval(%q+puts [ruby {print "print by ruby\n"; "puts by tcl/tk"}]+).inspect, "\n" print ip1._return_value().inspect, "\n" # もう一つインタプリタを生成してみる ip2 = TclTkIp.new() ip2._eval("button .lab -text test -command \"puts test ; destroy .\"") ip2._eval("pack .lab") TclTkLib.mainloop end |
#textB1Move(w, x, y) ⇒ Object
188 189 190 |
# File 'sample/demos-en/ctext.rb', line 188 def textB1Move(w,x,y) w.select_to 'current', "@#{x},#{y}" end |
#textB1Press(w, x, y) ⇒ Object
181 182 183 184 185 186 |
# File 'sample/demos-en/ctext.rb', line 181 def textB1Press(w,x,y) w.icursor 'current', "@#{x},#{y}" w.itemfocus 'current' w.focus w.select_from 'current', "@#{x},#{y}" end |
#textBs(w) ⇒ Object
192 193 194 195 196 197 198 199 |
# File 'sample/demos-en/ctext.rb', line 192 def textBs(w) begin $ctag_text.dchars 'sel.first', 'sel.last' rescue char = $ctag_text.index('insert').to_i - 1 $ctag_text.dchars(char) if char >= 0 end end |
#textDel(w) ⇒ Object
201 202 203 204 205 206 207 |
# File 'sample/demos-en/ctext.rb', line 201 def textDel(w) begin $ctag_text.dchars 'sel.first', 'sel.last' rescue $ctag_text.dchars 'insert' end end |
#textEnter(w) ⇒ Object
160 161 162 163 |
# File 'sample/demos-en/ctext.rb', line 160 def textEnter(w) $textConfigFill = (w.itemconfiginfo 'current', 'fill')[4] w.itemconfigure 'current', 'fill', 'black' end |
#textInsert(w, string) ⇒ Object
165 166 167 168 169 170 171 172 |
# File 'sample/demos-en/ctext.rb', line 165 def textInsert(w, string) return if string == "" begin $ctag_text.dchars 'sel.first', 'sel.last' rescue end $ctag_text.insert 'insert', string end |
#textLoadFile(w, file) ⇒ Object
textLoadFile – This method below loads a file into a text widget, discarding the previous contents of the widget. Tags for the old widget are not affected, however.
Arguments: w - The window into which to load the file. Must be a
text widget.
file - The name of the file to load. Must be readable.
21 22 23 24 25 26 27 28 |
# File 'sample/demos-en/search.rb', line 21 def textLoadFile(w,file) w.delete('1.0', 'end') f = open(file, 'r') while(!f.eof?) w.insert('end', f.read(1000)) end f.close end |
#textPaste(w, pos) ⇒ Object
174 175 176 177 178 179 |
# File 'sample/demos-en/ctext.rb', line 174 def textPaste(w, pos) begin $ctag_text.insert pos, TkSelection.get rescue end end |
#textSearch(w, string, tag) ⇒ Object
textSearch – Search for all instances of a given string in a text widget and apply a given tag to each instance found.
Arguments: w - The window in which to search. Must be a text widget. string - The string to search for. The search is done using
exact matching only; no special characters.
tag - Tag to apply to each instance of a matching string.
40 41 42 43 44 45 46 47 48 49 50 |
# File 'sample/demos-en/search.rb', line 40 def textSearch(w, string, tag) tag.remove('0.0', 'end') return if string == "" cur = '1.0' loop { cur, len = w.search_with_length(string, cur, 'end') break if cur == "" tag.add(cur, "#{cur} + #{len} char") cur = w.index("#{cur} + #{len} char") } end |
#textToggle(cmd1, sleep1, cmd2, sleep2) ⇒ Object
textToggle – This method is invoked repeatedly to invoke two commands at periodic intervals. It normally reschedules itself after each execution but if an error occurs (e.g. because the window was deleted) then it doesn’t reschedule itself.
Arguments: cmd1 - Command to execute when method is called. sleep1 - Ms to sleep after executing cmd1 before executing cmd2. cmd2 - Command to execute in the next invocation of this method. sleep2 - Ms to sleep after executing cmd2 before executing cmd1 again.
64 65 66 67 68 |
# File 'sample/demos-en/search.rb', line 64 def textToggle(cmd1,sleep1,cmd2,sleep2) sleep_list = [sleep2, sleep1] TkAfter.new(proc{sleep = sleep_list.shift; sleep_list.push(sleep); sleep}, -1, cmd1, cmd2).start(sleep1) end |
#textWinBigB2(w) ⇒ Object
メソッド定義
243 244 245 |
# File 'sample/demos-en/twind2.rb', line 243 def textWinBigB2(w) w.borderwidth 15 end |
#textWinBigH2(w) ⇒ Object
249 250 251 |
# File 'sample/demos-en/twind2.rb', line 249 def textWinBigH2(w) w.highlightthickness 15 end |
#textWinBigP2(w) ⇒ Object
255 256 257 |
# File 'sample/demos-en/twind2.rb', line 255 def textWinBigP2(w) w.configure(:padx=>15, :pady=>15) end |
#textWindDel(w) ⇒ Object
279 280 281 282 283 284 285 286 287 288 |
# File 'sample/demos-en/twind.rb', line 279 def textWindDel (w) if (defined? $twind_text) && TkWinfo.exist?($twind_plot) $twind_text.delete $twind_plot $twind_plot = nil while ($twind_text.get($mark_plot) =~ /[ \t\n]/) $twind_text.delete $mark_plot end $twind_text.insert $mark_plot," " end end |
#textWindDel2(w) ⇒ Object
372 373 374 375 376 377 378 379 380 381 |
# File 'sample/demos-en/twind2.rb', line 372 def textWindDel2 (w) if (defined? $twind2_text) && TkWinfo.exist?($twind2_plot) $twind2_text.delete $twind2_plot $twind2_plot = nil while ($twind2_text.get($mark2_plot) =~ /[ \t\n]/) $twind2_text.delete $mark2_plot end $twind2_text.insert $mark2_plot," " end end |
#textWindOff(w) ⇒ Object
188 189 190 191 192 193 194 195 196 197 198 |
# File 'sample/demos-en/twind.rb', line 188 def textWindOff (w) if defined? $twind_scroll begin $twind_scroll.destroy rescue end $twind_scroll = nil end w.xscrollcommand '' w.wrap 'word' end |
#textWindOff2(w) ⇒ Object
283 284 285 286 287 288 289 290 291 292 293 294 |
# File 'sample/demos-en/twind2.rb', line 283 def textWindOff2 (w) if defined? $twind2_scroll begin $twind2_scroll.destroy rescue end $twind2_scroll = nil end w.xscrollcommand '' #w.wrap 'word' w.wrap 'char' end |
#textWindOn(w, f) ⇒ Object
メソッド定義
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'sample/demos-jp/twind.rb', line 168 def textWindOn (w,f) if defined? $twind_scroll begin $twind_scroll.destroy rescue end $twind_scroll = nil end base = TkWinfo.parent( TkWinfo.parent(w) ) $twind_scroll = TkScrollbar.new(base) {|s| orient 'horizontal' command proc{|*args| w.xview(*args)} w.xscrollcommand proc{|first,last| s.set first,last} w.wrap 'none' pack('after'=>f, 'side'=>'bottom', 'fill'=>'x') } return nil end |
#textWindOn2(w, f) ⇒ Object
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
# File 'sample/demos-en/twind2.rb', line 262 def textWindOn2 (w,f) if defined? $twind2_scroll begin $twind2_scroll.destroy rescue end $twind2_scroll = nil end base = TkWinfo.parent( TkWinfo.parent(w) ) $twind2_scroll = TkScrollbar.new(base) {|s| orient 'horizontal' command proc{|*args| w.xview(*args)} w.xscrollcommand proc{|first,last| s.set first,last} w.wrap 'none' pack('after'=>f, 'side'=>'bottom', 'fill'=>'x') } return nil end |
#textWindPlot(t) ⇒ Object
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
# File 'sample/demos-en/twind.rb', line 200 def textWindPlot (t) if (defined? $twind_plot) && TkWinfo.exist?($twind_plot) return end $twind_plot = TkCanvas.new(t) { relief 'sunken' width 450 height 300 cursor 'top_left_arrow' } if $tk_version =~ /^4.*/ font = '-Adobe-Helvetica-Medium-R-Normal--*-180-*-*-*-*-*-*' else font = 'Helvetica 18' end TkcLine.new($twind_plot, 100, 250, 400, 250, 'width'=>2) TkcLine.new($twind_plot, 100, 250, 100, 50, 'width'=>2) TkcText.new($twind_plot, 225, 20, 'text'=>"A Simple Plot", 'font'=>font, 'fill'=>'brown') (0..10).each {|i| x = 100 + (i * 30) TkcLine.new($twind_plot, x, 250, x, 245, 'width'=>2) TkcText.new($twind_plot, x, 254, 'text'=>10*i, 'font'=>font, 'anchor'=>'n') } (0..5).each {|i| y = 250 - (i * 40) TkcLine.new($twind_plot, 100, y, 105, y, 'width'=>2) TkcText.new($twind_plot, 96, y, 'text'=>"#{i*50}.0", 'font'=>font, 'anchor'=>'e') } for xx, yy in [[12,56],[20,94],[33,98],[32,120],[61,180],[75,160],[98,223]] x = 100 + (3*xx) y = 250 - (4*yy)/5 item = TkcOval.new($twind_plot, x-6, y-6, x+6, y+6, 'width'=>1, 'outline'=>'black', 'fill'=>'SkyBlue2') item.addtag 'point' end $twind_plot.itembind('point', 'Any-Enter', proc{$twind_plot.itemconfigure 'current', 'fill', 'red'}) $twind_plot.itembind('point', 'Any-Leave', proc{$twind_plot.itemconfigure 'current', 'fill', 'SkyBlue2'}) $twind_plot.itembind('point', '1', proc{|x,y| embPlotDown $twind_plot,x,y}, "%x %y") $twind_plot.itembind('point', 'ButtonRelease-1', proc{$twind_plot.dtag 'selected'}) $twind_plot.bind('B1-Motion', proc{|x,y| embPlotMove $twind_plot,x,y}, "%x %y") while ($twind_text.get($mark_plot) =~ /[ \t\n]/) $twind_text.delete $mark_plot end $twind_text.insert $mark_plot,"\n" TkTextWindow.new($twind_text, $mark_plot, 'window'=>$twind_plot) $tag_center.add $mark_plot $twind_text.insert $mark_plot,"\n" end |
#textWindPlot2(t) ⇒ Object
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 |
# File 'sample/demos-en/twind2.rb', line 296 def textWindPlot2 (t) if (defined? $twind2_plot) && (TkWinfo.exist?($twind2_plot)) return end $twind2_plot = TkCanvas.new(t) { relief 'sunken' width 450 height 300 cursor 'top_left_arrow' } #font = '-Adobe-Helvetica-Medium-R-Normal--*-180-*-*-*-*-*-*' font = 'Helvetica 18' TkcLine.new($twind2_plot, 100, 250, 400, 250, 'width'=>2) TkcLine.new($twind2_plot, 100, 250, 100, 50, 'width'=>2) TkcText.new($twind2_plot, 225, 20, 'text'=>"A Simple Plot", 'font'=>font, 'fill'=>'brown') (0..10).each {|i| x = 100 + (i * 30) TkcLine.new($twind2_plot, x, 250, x, 245, 'width'=>2) TkcText.new($twind2_plot, x, 254, 'text'=>10*i, 'font'=>font, 'anchor'=>'n') } (0..5).each {|i| y = 250 - (i * 40) TkcLine.new($twind2_plot, 100, y, 105, y, 'width'=>2) TkcText.new($twind2_plot, 96, y, 'text'=>"#{i*50}.0", 'font'=>font, 'anchor'=>'e') } for xx, yy in [[12,56],[20,94],[33,98],[32,120],[61,180],[75,160],[98,223]] x = 100 + (3*xx) y = 250 - (4*yy)/5 item = TkcOval.new($twind2_plot, x-6, y-6, x+6, y+6, 'width'=>1, 'outline'=>'black', 'fill'=>'SkyBlue2') item.addtag 'point' end $twind2_plot.itembind('point', 'Any-Enter', proc{$twind2_plot.itemconfigure 'current', 'fill', 'red'}) $twind2_plot.itembind('point', 'Any-Leave', proc{$twind2_plot.itemconfigure 'current', 'fill', 'SkyBlue2'}) $twind2_plot.itembind('point', '1', proc{|x,y| embPlotDown2 $twind2_plot,x,y}, "%x %y") $twind2_plot.itembind('point', 'ButtonRelease-1', proc{$twind2_plot.dtag 'selected'}) $twind2_plot.bind('B1-Motion', proc{|x,y| embPlotMove2 $twind2_plot,x,y}, "%x %y") while ($twind2_text.get($mark2_plot) =~ /[ \t\n]/) $twind2_text.delete $mark2_plot end $twind2_text.insert $mark2_plot,"\n" TkTextWindow.new($twind2_text, $mark2_plot, 'window'=>$twind2_plot) $tag2_center.add $mark2_plot $twind2_text.insert $mark2_plot,"\n" end |
#textWinSmallB2(w) ⇒ Object
246 247 248 |
# File 'sample/demos-en/twind2.rb', line 246 def textWinSmallB2(w) w.borderwidth $text_normal2['border'] end |
#textWinSmallH2(w) ⇒ Object
252 253 254 |
# File 'sample/demos-en/twind2.rb', line 252 def textWinSmallH2(w) w.highlightthickness $text_normal2['highlight'] end |
#textWinSmallP2(w) ⇒ Object
258 259 260 |
# File 'sample/demos-en/twind2.rb', line 258 def textWinSmallP2(w) w.configure(:padx=>$text_normal2['pad'], :pady=>$text_normal2['pad']) end |
#them ⇒ Object
Explanatory text
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'sample/demos-en/tree.rb', line 23 Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, :anchor=>'n', :padding=>[10, 2, 10, 6], :text=><<EOL).pack(:fill=>:x) Ttk is the new Tk themed widget set. \ One of the widgets it includes is a tree widget, \ which allows the user to browse a hierarchical data-set such as a filesystem. \ The tree widget not only allows for the tree part itself, \ but it also supports an arbitrary number of additional columns \ which can show additional data (in this case, the size of the files \ found in your filesystem). \ You can also change the width of the columns \ by dragging the boundary between them. EOL |
#tick ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'sample/tktimer.rb', line 36 def tick if $stopped then return end Tk.after 50, proc{tick} $hundredths+=5 if $hundredths >= 100 $hundredths=0 $seconds+=1 end $label.text format("%d.%02d", $seconds, $hundredths) end |
#TkGrid(*args) ⇒ Object
19 |
# File 'lib/tk/autoload.rb', line 19 def TkGrid(*args); TkGrid.configure(*args); end |
#TkPack(*args) ⇒ Object
22 |
# File 'lib/tk/autoload.rb', line 22 def TkPack(*args); TkPack.configure(*args); end |
#TkPlace(*args) ⇒ Object
25 |
# File 'lib/tk/autoload.rb', line 25 def TkPlace(*args); TkPlace.configure(*args); end |
#toggle_console ⇒ Object
658 659 660 661 662 663 664 |
# File 'sample/tkextlib/tile/demo.rb', line 658 def toggle_console if TkComm.bool($V[:CONSOLE]) TkConsole.show else TkConsole.hide end end |
#trackFocus ⇒ Object
819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 |
# File 'sample/tkextlib/tile/demo.rb', line 819 def trackFocus if $focus begin $focus.destroy rescue end end $focus = TkToplevel.new(:title=>'Keyboard focus') i = 0 [ ["Focus widget:", :Widget], ["Class:", :WidgetClass], ["Next:", :WidgetNext], ["Grab:", :Grab], ["Status:", :GrabStatus] ].each{|label, var_index| Tk.grid(Tk::Tile::Label.new($focus, :text=>label, :anchor=>:e), Tk::Tile::Label.new($focus, :textvariable=>$FocusInf.ref(var_index), :width=>40, :anchor=>:w, :relief=>:groove), :sticky=>:ew) i += 1 } $focus.grid_columnconfigure(1, :weight=>1) $focus.grid_rowconfigure(i, :weight=>1) $focus.bind('Destroy', proc{Tk.after_cancel($Timers[:FocusMonitor])}) focusMonitor end |
#trackStates ⇒ Object
886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 |
# File 'sample/tkextlib/tile/demo.rb', line 886 def trackStates if $states begin $state.destroy rescue end end $states = TkToplevel.new(:title=>'Widget states') l_inf = Tk::Tile::Label.new($states, :text=>"Press Control-Shift-Button-1 on any widget") l_lw = Tk::Tile::Label.new($states, :text=>'Widget:', :anchor=>:e, :relief=>:groove) l_w = Tk::Tile::Label.new($states, :textvariable=>$Widget, :anchor=>:w, :relief=>:groove) Tk.grid(l_inf, '-', :sticky=>:ew, :padx=>6, :pady=>6) Tk.grid(l_lw, l_w, :sticky=>:ew) $states_list.each{|st| cb = Tk::Tile::Checkbutton.new($states, :text=>st, :variable=>$State.ref(st), :command=>proc{ changeState(st) }) $states_btns[st] = cb Tk.grid('x', cb, :sticky=>:nsew) } $states.grid_columnconfigure(1, :weight=>1) f_cmd = Tk::Tile::Frame.new($states) Tk.grid('x', f_cmd, :sticky=>:nse) b_close = Tk::Tile::Button.new(f_cmd, :text=>'Close', :command=>proc{ $states.destroy }) Tk.grid('x', b_close, :padx=>4, :pady=>[6,4]) f_cmd.grid_columnconfigure(0, :weight=>1) $states.bind('KeyPress-Escape', proc{Tk.event_generate(b_close, '<Invoke>')}) $states.bind('Destroy', proc{Tk.after_cancel($Timers[:StateMonitor])}) stateMonitor() end |
#updateStates ⇒ Object
934 935 936 937 938 939 940 941 942 943 944 |
# File 'sample/tkextlib/tile/demo.rb', line 934 def updateStates $states_list.each{|st| begin $State[st] = $Widget.window.ttk_instate(st) rescue $states_btns[st].ttk_state('disabled') else $states_btns[st].ttk_state('!disabled') end } end |
#validate_proc(c, val) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'sample/tkextlib/tktable/valid.rb', line 36 def validate_proc(c, val) if c % 3 == 1 # AlphaNum regexp = /^[A-Za-z0-9 ]*$/ elsif c % 2 == 1 # Alpha regexp = /^[A-Za-z ]*$/ elsif c != 0 # 'Real' regexp = /^[-+]?[0-9]*\.?[0-9]*([0-9]\.?e[-+]?[0-9]*)?$/ end if val =~ regexp return true else Tk.bell return false end end |
#validatePhoneChange(widget, vmode, idx, char) ⇒ Object
validatePhoneChange – Checks that the replacement (mapped to a digit) of the given character in an entry widget at the given position will leave a valid phone number in the widget.
widget - entry widget to validate vmode - The widget’s validation mode idx - The index where replacement is to occur char - The character (or string, though that will always be
refused) to be overwritten at that point.
173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'sample/demos-en/entry3.rb', line 173 def validatePhoneChange(, vmode, idx, char) return true if idx == nil Tk.after_idle(proc{.configure(:validate=>vmode, :invcmd=>proc{Tk.bell})}) if !(idx<3 || idx==6 || idx==7 || idx==11 || idx>15) && char =~ /[0-9A-Za-z]/ .delete(idx) .insert(idx, $phoneNumberMap[char] || char) Tk.after_idle(proc{phoneSkipRight(, -1)}) return true # Tk.update(true) # <- Don't work 'update' inter validation callback. # It depends on Tcl/Tk side (tested on Tcl/Tk8.5a1). end return false end |
#version?(ver) ⇒ Boolean
20 21 22 |
# File 'sample/tkextlib/tile/demo.rb', line 20 def version?(ver) TkPackage.vcompare(Tk::Tile.package_version, ver) >= 0 end |