rwdfoldeditor 0.02 → 0.03

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. data/code/01rwdcore/01rwdcore.rb +2 -2
  2. data/code/superant.com.foldback/clearhttpview3.rb +9 -0
  3. data/code/superant.com.foldback/dictlookup.rb +20 -0
  4. data/code/superant.com.foldback/eliza.rb +8 -0
  5. data/code/superant.com.foldback/helptexthashrwdhypernote.rb +19 -0
  6. data/code/superant.com.foldback/listwordlookup.rb +37 -0
  7. data/code/superant.com.foldback/openhelpwindowrwdhyernote.rb +13 -0
  8. data/code/superant.com.foldback/runrwdshellwindow.rb +12 -0
  9. data/code/superant.com.foldeditor/0uninstallapplet.rb +2 -1
  10. data/code/superant.com.foldeditor/clearnotescreen.rb +7 -0
  11. data/code/superant.com.foldeditor/rwddisplayfoldlinks.rb +5 -5
  12. data/configuration/{rwdwfoldeditor-0.02.dist → rwdwfoldeditor-0.03.dist} +4 -4
  13. data/gui/tinkerbackwindows/superant.com.foldeditor/10aviewnote.rwd +13 -20
  14. data/gui/tinkerbackwindows/superant.com.foldeditor/15htmlview.rwd +2 -2
  15. data/gui/tinkerbackwindows/superant.com.foldwords/1appname.rwd +4 -0
  16. data/gui/tinkerbackwindows/superant.com.foldwords/1dictionary.rwd +19 -0
  17. data/gui/tinkerbackwindows/superant.com.foldwords/3ai.rwd +22 -0
  18. data/gui/tinkerbackwindows/superant.com.foldwords/4thesaurus.rwd +36 -0
  19. data/gui/tinkerbackwindows/superant.com.foldwords/77jumplinkcommands.rwd +17 -0
  20. data/gui/tinkerbackwindows/superant.com.foldwords/z9end.rwd +6 -0
  21. data/installed/{rwdwfoldeditor-0.02.inf → rwdwfoldeditor-0.03.inf} +5 -2
  22. data/lib/dict.rb +438 -0
  23. data/lib/oothesaurus.rb +76 -0
  24. data/rwd_files/HowTo_FoldEditor.txt +24 -15
  25. data/tests/makedist-rwdwfoldeditor.rb +1 -1
  26. data/tests/makedist.rb +1 -1
  27. data/zips/rwdwfoldeditor-0.03.zip +0 -0
  28. data/zips/rwdwruby-1.05.zip +0 -0
  29. metadata +24 -7
  30. data/zips/rwdwfoldeditor-0.02.zip +0 -0
  31. data/zips/rwdwschedule-1.04.zip +0 -0
  32. data/zips/rwdwshell-1.04.zip +0 -0
@@ -4,8 +4,8 @@
4
4
  # For more information about RwdTinker see http://www.rubyforge.net/projects/rwdapplications
5
5
  # This class is the top class for the RwdTinker application
6
6
 
7
- $DEBUG=false
8
- $VERBOSE=false
7
+ $DEBUG=true
8
+ $VERBOSE=true
9
9
 
10
10
  class RwdTinker < RWDialog
11
11
 
@@ -0,0 +1,9 @@
1
+ # this method clears the on screen variables
2
+ def clearthesaurus
3
+
4
+
5
+ @a_thesaurusdata = ""
6
+
7
+
8
+
9
+ end
@@ -0,0 +1,20 @@
1
+ # dictionary
2
+ def dictlookup
3
+ require 'lib/dict'
4
+ if ! @a_dictionaryinput.empty?
5
+
6
+ dict = DICT.new('dict.org', DICT::DEFAULT_PORT)
7
+ dict.client('a Ruby/DICT client')
8
+ definitions = dict.define(DICT::ALL_DATABASES, @a_dictionaryinput)
9
+ @dictionary_display = ""
10
+ if definitions
11
+ definitions.each do |d|
12
+ @dictionary_display = @dictionary_display + d.description + d.database + "\n"
13
+ d.definition.each { |line| @dictionary_display = @dictionary_display + line }
14
+ end
15
+ end
16
+
17
+ dict.disconnect
18
+ @dictionary_display = @dictionary_display + "\n\n"
19
+ end
20
+ end
@@ -0,0 +1,8 @@
1
+ require 'net/http'
2
+
3
+ def ai_eliza()
4
+ response = Net::HTTP.post_form(URI.parse("http://www-ai.ijs.si/eliza-cgi-bin/eliza_script"),{'Entry1'=>@ai_datain})
5
+
6
+ @eliza_result = response.body.split("</strong>\n").last.split("\n").first
7
+
8
+ end
@@ -0,0 +1,19 @@
1
+
2
+
3
+ Helptext.update( :rwdthesaurus_generalhelp => "This program is a thesaurus word search
4
+
5
+ If you have entered a word in this tab
6
+
7
+ You can search by clicking Display word results
8
+
9
+ This should search the thesaurus files you have set up and return a list of words on separate lines
10
+
11
+ You can click on one of those and it should be transfered to the search box, then click Display again
12
+
13
+ The words with bracketed comments won't be found, erase the bracketed part first
14
+
15
+ This uses the openoffice Thesaurus
16
+ make a link from the actual oo thesaurus files you use to rwd_files/idx and rwd_files/dat
17
+
18
+ "
19
+ )
@@ -0,0 +1,37 @@
1
+ # this code is to list the word results
2
+ def fillthesaurusword(inffile)
3
+ applet = inffile
4
+ @a_thesaurusinput = applet
5
+
6
+ end
7
+
8
+
9
+ def listwordresults
10
+ require "lib/oothesaurus"
11
+
12
+ the=OOThesaurus.new()
13
+ history=[]
14
+
15
+ filepath = "rwd_files"
16
+ filepathidx = File.join(filepath,"idx")
17
+ filepathdat = File.join(filepath,"dat")
18
+ word = @a_thesaurusinput.downcase.strip
19
+ notesarray = the::dosearch(the,history,word,true,filepathidx,filepathdat)
20
+
21
+ finalarray = []
22
+
23
+ a_thesaurusdata = ""
24
+ notesarray.each { |x| x.each { |x2|
25
+
26
+ finalarray << x2 unless x2 == "(noun)" or x2 == "(verb)" or x2 == "(adj)"
27
+ }
28
+
29
+ }
30
+ @a_thesaurusdata = finalarray.entries.sort.rwd_method("fillthesaurusword")
31
+ end
32
+
33
+
34
+
35
+
36
+
37
+
@@ -0,0 +1,13 @@
1
+ # this code is to call the help window
2
+ def runhelpwindowrwdthesaurus
3
+
4
+ $help_topic = "rwdthesaurus_generalhelp"
5
+
6
+ if @rwd_tab == "superantcomthesaurus"
7
+ $help_topic = "rwdthesaurus_generalhelp"
8
+ end
9
+
10
+ runhelpwindow
11
+ end
12
+
13
+
@@ -0,0 +1,12 @@
1
+ # Application Rwdtinker orginally (c) 2004 Steven Gibson under GPL.
2
+ # This application is a contact book
3
+ # For more information about see http://www.rubyforge.net/projects/rwdapplications
4
+
5
+ # call the window
6
+ def rwdfoldbackwindow
7
+
8
+ @rwd_window = "rwdfoldbackwindow"
9
+ @rwd_tab="dictlookup"
10
+
11
+ end
12
+
@@ -1,10 +1,11 @@
1
1
 
2
- def rwdwfoldeditor_0_02()
2
+ def rwdwfoldeditor_0_03()
3
3
  $tinkerdocumentsarray.delete_if {|x| x == "HowTo_FoldEditor.txt"}
4
4
  $tinkerhelpaboutarray.delete_if {|x| x == "RwdFoldEditor"}
5
5
  Helptext.delete_if {|key, value| key == :rwdfoldeditor_generalhelp}
6
6
  Helptext.delete_if {|key, value| key == :foldlinkview_help }
7
7
  Helptext.delete_if {|key, value| key == :foldlinkutility_help }
8
8
  $rwdjumplink.delete_if {|x| x == "RwdFoldEditor"}
9
+ $rwdjumplink.delete_if {|x| x == "FoldBackWindow"}
9
10
 
10
11
  end
@@ -0,0 +1,7 @@
1
+ # this method clears the on screen variables
2
+
3
+ def clearfoldnote
4
+ @folddocumentresult = ""
5
+
6
+
7
+ end
@@ -1,12 +1,12 @@
1
- # this method clears the on screen variables
2
- def fillziptoinstallnamex(inffile)
1
+ # this method views the fold links
2
+ def fillziptoinstallnamex(inffile)
3
3
  applet = inffile.strip
4
4
  @a_viewfoldlink = applet
5
5
 
6
6
  end
7
7
 
8
8
 
9
- def rwddisplayfoldlinks
9
+ def rwddisplayfoldlinks
10
10
  if @a_viewfoldlinkfile
11
11
  if @a_viewfoldlinkfile.empty? # a fold link file has not been selected
12
12
 
@@ -24,10 +24,10 @@ end
24
24
  tmpfilearray << line.strip
25
25
  }
26
26
 
27
- @a_displayfoldlinks01 = tmpfilearray.entries.sort.rwd_method("fillziptoinstallnamex")
27
+ @a_displayfoldlinks01 = tmpfilearray.entries.rwd_method("fillziptoinstallnamex")
28
28
  @displayfoldlinkoptions = tmpfilearray.rwd_options
29
29
 
30
30
 
31
31
 
32
32
  end
33
-
33
+
@@ -1,4 +1,4 @@
1
- ##VERSION:0.02
1
+ ##VERSION:0.03
2
2
  ##NAME:$rwdfoldeditor_directory:0
3
3
  $rwdfoldeditor_directory = "rwd_files"
4
4
  ##NAME:$foldeditorbrowser:0
@@ -7,8 +7,8 @@ $foldeditorbrowser = "firefox"
7
7
  $testharnessarray += ["rwdfoldeditor_all_tests"]
8
8
  $tinkerhelpaboutarray += ["RwdFoldEditor"]
9
9
  $tinkerdocumentsarray += ["HowTo_FoldEditor.txt"]
10
- JumpLink.update(:RwdFoldEditor=>"runrwdfoldeditorwindow")
11
- $rwdjumplink +=["RwdFoldEditor"]
10
+ JumpLink.update(:RwdFoldEditor=>"runrwdfoldeditorwindow", :FoldBackWindow=> "rwdfoldbackwindow")
11
+ $rwdjumplink +=["RwdFoldEditor","FoldBackWindow"]
12
12
  ##NAME:RwdFoldEditorVersion:0
13
- RwdFoldEditorVersion = "0.02"
13
+ RwdFoldEditorVersion = "0.03"
14
14
 
@@ -5,38 +5,31 @@ $rwdguivar=
5
5
  <table>
6
6
  <row>View your note list and detail on this Tab (only click on text files)</row>
7
7
  <row> <p> </row>
8
- <row> <p align=\"right\">Note Record:</p> <text size=40 name=\"a_viewfoldlink\"/> </row>
8
+ <row> <text size=70 name=\"a_viewfoldlink\"/> </row>
9
9
 
10
10
  </table>
11
11
  <horizontal>
12
- <button caption=\"Open Detail\" action=\"loadfolddocument\"/>
13
-
14
- <button caption=\"Create New Note\" action=\"rwdfoldeditcreatenewnote\"/>
15
-
12
+ <button caption=\"Open Detail\" action=\"loadfolddocument\"/>
13
+
14
+ <button caption=\"Create New Note\" action=\"rwdfoldeditcreatenewnote\"/>
15
+
16
16
  <button caption=\"Save Changes\" action=\"savefoldeditrecord\"/>
17
-
17
+
18
18
  <button caption=\"Help\" action=\"runhelpwindowrwdfoldeditor\"/>
19
+ <button caption=\"Clear\" action=\"clearfoldnote\"/>
19
20
 
20
21
  </horizontal>
21
22
  <textarea name=\"folddocumentresult\"/>
22
23
 
24
+ <horizontal>
23
25
 
24
- <horizontal>
25
-
26
- <button caption=\"List Directories\" action=\"rwdhypernotedirectories\"/>
27
- <button caption=\"Reset to top Directory\" action=\"rwdhypernoteresetdir\"/>
28
-
29
- </horizontal>
26
+ <button caption=\"Save Changes\" action=\"savefoldeditrecord\"/>
30
27
 
31
- <horizontal>
32
- <button caption=\"List Notes\" action=\"listnotedirs\"/>
33
- <button caption=\"Show Internal Links\" action=\"listlocalnotelinks\"/>
28
+ </horizontal>
34
29
 
35
-
36
- </horizontal>
37
30
 
38
-
39
-
40
- <p>%%folddirectoriesresult%%</p>
31
+
32
+
33
+ <p></p>
41
34
 
42
35
  </tab>"
@@ -5,8 +5,8 @@ $rwdguivar=
5
5
  <table>
6
6
 
7
7
 
8
- <row> <p align=\"right\">Note link:</p> <text size=40 name=\"a_viewfoldlink\"/> </row>
9
- <row> <p> </row>
8
+ <text size=70 name=\"a_viewfoldlink\"/>
9
+
10
10
 
11
11
  </table>
12
12
 
@@ -0,0 +1,4 @@
1
+ $rwdguivar=
2
+ "
3
+ <window name = \"rwdfoldbackwindow\" title=\"rwdwords - \">
4
+ <tabs>"
@@ -0,0 +1,19 @@
1
+ $rwdguivar=
2
+ "
3
+ <tab name=\"dictlookup\" caption=\"Dictionary Lookup\">
4
+
5
+
6
+ <table>
7
+ <row> <p align=\"right\">Word:</p> <text name=\"a_dictionaryinput\"/> </row>
8
+
9
+ </table>
10
+
11
+ <horizontal>
12
+ <button caption=\"Lookup\" action=\"dictlookup\"/>
13
+ <button caption=\"Cancel\" action=\"main\"/>
14
+
15
+ </horizontal>
16
+ <p>%dictionary_display%</p>
17
+ </tab>
18
+ "
19
+
@@ -0,0 +1,22 @@
1
+ $rwdguivar=
2
+ "
3
+ <tab name=\"aiwindow\" caption=\"ai test\">
4
+ connect to alice internet AI bot
5
+ <table>
6
+ <row> <p align=\"right\">sentence</p> <text size=70 name=\"ai_datain\"/> </row>
7
+
8
+ </table>
9
+ <horizontal>
10
+ <button caption=\"send to ai\" action=\"ai_eliza\"/>
11
+
12
+ <button caption=\"Help\" action=\"runhelpwindowrwdeliza\"/>
13
+
14
+ </horizontal>
15
+
16
+ <p>%eliza_result%</p>
17
+
18
+
19
+
20
+
21
+ </tab>"
22
+
@@ -0,0 +1,36 @@
1
+ $rwdguivar=
2
+ "
3
+ <tab name=\"superantcomthesaurus\" caption=\"Thesaurus View\">
4
+
5
+ <table>
6
+
7
+ <table>
8
+ <row> <p align=\"right\">Word:</p> <text name=\"a_thesaurusinput\"/> </row>
9
+
10
+
11
+
12
+ <row> <p> </row>
13
+
14
+ </table>
15
+ <horizontal>
16
+ <button caption=\"Display word results\" action=\"listwordresults\"/>
17
+
18
+ <button caption=\"Clear file list\" action=\"clearthesaurus\"/>
19
+
20
+ <button caption=\"Help\" action=\"runhelpwindowrwdthesaurus\"/>
21
+
22
+ </horizontal>
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+ <table>
32
+ <p>%%a_thesaurusdata%%</p>
33
+
34
+
35
+ </table>
36
+ </tab>"
@@ -0,0 +1,17 @@
1
+ $rwdguivar=
2
+ "
3
+ <tab name=RwdwordsMenu caption=Menu>
4
+ <horizontal>
5
+ <button caption=\"Show Jump Links\" action=\"showjumplinkoptions\"/>
6
+
7
+ </horizontal>
8
+ <table>
9
+ <select name=\"a_jumplinkinput\"> %%jumplinkoptions%% </select>
10
+
11
+ </table>
12
+
13
+ <horizontal>
14
+ <button caption=\"Jump to Application Location\" action=\"runjumplinkcommand\"/>
15
+ </horizontal>
16
+ </tab>
17
+ "
@@ -0,0 +1,6 @@
1
+ $rwdguivar=
2
+ "
3
+ </tabs>
4
+ </window>"
5
+
6
+
@@ -1,11 +1,14 @@
1
1
  # rwdwfoldeditor - book editor
2
2
  gui/tinkerbackwindows/superant.com.foldeditor
3
+ gui/tinkerbackwindows/superant.com.foldwords
3
4
  code/superant.com.foldeditor
5
+ code/superant.com.foldback
4
6
  tests/makedist-rwdwfoldeditor.rb
5
7
  tests/gemspec-rwdwfoldeditor
6
8
  rwd_files/HowTo_FoldEditor.txt
7
- configuration/rwdwfoldeditor-0.02.cnf
8
- configuration/rwdwfoldeditor-0.02.dist
9
+ lib/oothesaurus.rb
10
+ lib/dict.rb
11
+ configuration/rwdwfoldeditor-0.03.dist
9
12
  rwd_files/default.fld
10
13
  rwd_files/rwdhypernote-0.13.fld
11
14
 
data/lib/dict.rb ADDED
@@ -0,0 +1,438 @@
1
+ # dict.rb - a client-side implementation of the DICT protocol (RFC 2229)
2
+ #
3
+ # $Id: dict.rb,v 1.25 2003/04/19 06:53:41 ianmacd Exp $
4
+ #
5
+ # Version : 0.9.2
6
+ # Author : Ian Macdonald <ian@caliban.org>
7
+ #
8
+ # Copyright (C) 2002-2003 Ian Macdonald
9
+ #
10
+ # This program is free software; you can redistribute it and/or modify
11
+ # it under the terms of the GNU General Public License as published by
12
+ # the Free Software Foundation; either version 2, or (at your option)
13
+ # any later version.
14
+ #
15
+ # This program is distributed in the hope that it will be useful,
16
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
+ # GNU General Public License for more details.
19
+ #
20
+ # You should have received a copy of the GNU General Public License
21
+ # along with this program; if not, write to the Free Software Foundation,
22
+ # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
+
24
+ =begin
25
+
26
+ = NAME
27
+ Ruby/DICT - client-side DICT protocol library
28
+ = SYNOPSIS
29
+
30
+ require 'dict'
31
+
32
+ dict = DICT.new('dict.org', DICT::DEFAULT_PORT)
33
+ dict.client('a Ruby/DICT client')
34
+ definitions = dict.define(DICT::ALL_DATABASES, 'ruby')
35
+
36
+ if definitions
37
+ definitions.each do |d|
38
+ printf("From %s [%s]:\n\n", d.description, d.database)
39
+ d.definition.each { |line| print line }
40
+ end
41
+ end
42
+
43
+ dict.disconnect
44
+
45
+ = DESCRIPTION
46
+ Ruby/DICT is a client-side library implementation of the DICT protocol,
47
+ as described in ((<RFC 2229|URL:ftp://ftp.isi.edu/in-notes/rfc2229.txt>)).
48
+ = CLASS METHODS
49
+ --- DICT.new(hosts, port = DICT::DEFAULT_PORT, debug = false, verbose = false)
50
+ This creates a new instance of the DICT class. A DICT object has four
51
+ instance variables: ((|capabilities|)), ((|code|)), ((|message|)) and
52
+ ((|msgid|)). ((|capabilities|)) is an array of Strings relating to
53
+ capabilities implemented on the server, ((|code|)) is the last status
54
+ code returned by the server, ((|message|)) is the text of the message
55
+ related to ((|code|)), and ((|msgid|)) is the message ID returned by the
56
+ server.
57
+ = INSTANCE METHODS
58
+ --- DICT#disconnect
59
+ Disconnect from the server.
60
+ --- DICT#define(database, word)
61
+ Obtain definitions for ((|word|)) from ((|database|)). A list of valid
62
+ databases can be obtained using DICT#show(DICT::DATABASES).
63
+
64
+ To show just the first definition found, use ((|DICT::FIRST_DATABASE|))
65
+ as the database name. To show definitions from all databases, use
66
+ ((|DICT::ALL_DATABASES|)).
67
+
68
+ On success, this returns an array of Struct:Definition objects.
69
+ ((*nil*)) is returned on failure.
70
+ --- DICT#match(database, strategy, word)
71
+ Obtain matches for ((|word|)) from ((|database|)) using ((|strategy|)).
72
+
73
+ On success, a hash of arrays is returned. The keys of the hash are the
74
+ database names and the values are arrays of word matches that were found
75
+ in that database. ((*nil*)) is returned on failure.
76
+ --- DICT#show_server
77
+ This method retrieves information on the server itself.
78
+
79
+ A String is returned on success, while ((*nil*)) is returned on failure.
80
+ --- DICT#show_db
81
+ This method retrieves information on the databases offered by the server.
82
+
83
+ A Hash indexed on database name and containing database descriptions
84
+ is returned on success, while ((*nil*)) is returned on failure.
85
+ --- DICT#show_info(database)
86
+ This method retrieves information on a particular database offered by
87
+ the server.
88
+
89
+ A String is returned on success, while ((*nil*)) is returned on failure.
90
+ --- DICT#show_strat
91
+ This method retrieves information on the strategies offered by the server.
92
+
93
+ A Hash indexed on strategy name and containing strategy descriptions
94
+ is returned on success, while ((*nil*)) is returned on failure.
95
+ --- DICT#status
96
+ This method returns a single line String of status information from the
97
+ server.
98
+ --- DICT#help
99
+ This method returns a String of help information from the server,
100
+ describing the commands it implements.
101
+ --- DICT#client
102
+ This method sends a single line String of information describing a client
103
+ application to the server.
104
+ --- DICT#auth(user, secret)
105
+ This method attempts to authenticate ((|user|)) to the server using
106
+ ((|secret|)). Note that ((|secret|)) is not literally passed to the server.
107
+ = CONSTANTS
108
+ Ruby/DICT uses a lot of constants, mostly for the status codes
109
+ returned by DICT servers. See the source for details.
110
+
111
+ Some of the more interesting other constants:
112
+ : DICT::FIRST_DATABASE
113
+ Define or match, stopping at first database where match is found
114
+ : DICT::ALL_DATABASES
115
+ Define or match, gathering matches from all databases
116
+ : DICT::DEFAULT_MATCH_STRATEGY
117
+ Match using a server-dependent default strategy, which should be the best
118
+ strategy available for interactive spell checking
119
+ : DICT::DEFAULT_PORT
120
+ The default port used by DICT servers, namely 2628
121
+ : DICT::ERROR
122
+ A Regex constant matching any server status code indicating an error
123
+ = EXCEPTIONS
124
+ Exception classes are subclasses of the container class DICTError, which is,
125
+ itself, a subclass of RuntimeError
126
+ --- ConnectError.new(message, code = 2)
127
+ A ConnectError is raised if DICT::new is unable to connect to the chosen
128
+ DICT server for any reason. Program execution will terminate.
129
+ --- ProtocolError.new(message, code = 3)
130
+ A ProtocolError exception can be used if a server operation returns a
131
+ status code matching DICT::ERROR. This does not happen automatically. The
132
+ code is stored in the ((|code|)) attribute of the instance of the DICT
133
+ object. Program execution will terminate.
134
+ = AUTHOR
135
+ Written by Ian Macdonald <ian@caliban.org>
136
+ = COPYRIGHT
137
+ Copyright (C) 2002-2003 Ian Macdonald
138
+
139
+ This is free software; see the source for copying conditions.
140
+ There is NO warranty; not even for MERCHANTABILITY or FITNESS
141
+ FOR A PARTICULAR PURPOSE.
142
+ = SEE ALSO
143
+ * ((<"Ruby/DICT home page - http://www.caliban.org/ruby/"|URL:http://www.caliban.org/ruby/>))
144
+ * ((<"The DICT development group - http://www.dict.org/"|URL:http://www.dict.org/>))
145
+ * ((<"RFC 2229 - ftp://ftp.isi.edu/in-notes/rfc2229.txt"|URL:ftp://ftp.isi.edu/in-notes/rfc2229.txt>))
146
+ = BUGS
147
+ Send all bug reports, enhancement requests and patches to the
148
+ author.
149
+ = HISTORY
150
+ $Id: dict.rb,v 1.25 2003/04/19 06:53:41 ianmacd Exp $
151
+
152
+ =end
153
+
154
+
155
+ require 'socket'
156
+ require 'md5'
157
+
158
+
159
+ # lines that start with .. need to be reduced to .
160
+ #
161
+ class String
162
+ def undot!
163
+ sub!(/^\.\./, '.')
164
+ end
165
+ end
166
+
167
+
168
+ # a basic exception class for DICT errors
169
+ #
170
+ class DICTError < RuntimeError
171
+ def initialize(message, code = 1)
172
+ $stderr.puts message
173
+ exit code
174
+ end
175
+ end
176
+
177
+
178
+ # deal with connection errors
179
+ #
180
+ class ConnectError < DICTError
181
+ def initialize(message, code = 2)
182
+ super
183
+ end
184
+ end
185
+
186
+
187
+ # deal with status code errors
188
+ #
189
+ class ProtocolError < DICTError
190
+ def initialize(message, code = 3)
191
+ super
192
+ end
193
+ end
194
+
195
+ # a structure for definitions
196
+ #
197
+ Definition = Struct.new('Definition', :word, :definition, :database,
198
+ :description)
199
+
200
+ class DICT
201
+ attr_reader :capabilities, :code, :message, :msgid
202
+
203
+ DATABASES_PRESENT = '110'
204
+ STRATEGIES_AVAILABLE = '111'
205
+ DATABASE_INFORMATION = '112'
206
+ HELP_TEXT = '113'
207
+ SERVER_INFORMATION = '114'
208
+ CHALLENGE_FOLLOWS = '130'
209
+ DEFINITIONS_RETRIEVED = '150'
210
+ WORD_DEFINITION = '151'
211
+ MATCHES_PRESENT = '152'
212
+ STATUS_RESPONSE = '210'
213
+ CONNECTION_ESTABLISHED = '220'
214
+ CLOSING_CONNECTION = '221'
215
+ AUTHENTICATION_SUCCESSFUL = '230'
216
+ OK = '250'
217
+ SEND_RESPONSE = '330'
218
+ TEMPORARILY_UNAVAILABLE = '420'
219
+ SHUTTING_DOWN = '421'
220
+ UNRECOGNISED_COMMAND = '500'
221
+ ILLEGAL_PARAMETERS = '501'
222
+ COMMAND_NOT_IMPLEMENTED = '502'
223
+ PARAMETER_NOT_IMPLEMENTED = '503'
224
+ ACCESS_DENIED = '530'
225
+ AUTH_DENIED = '531'
226
+ UNKNOWN_MECHANISM = '532'
227
+ INVALID_DATABASE = '550'
228
+ INVALID_STRATEGY = '551'
229
+ NO_MATCH = '552'
230
+ NO_DATABASES_PRESENT = '554'
231
+ NO_STRATEGIES_AVAILABLE = '555'
232
+
233
+ ALL_DATABASES = '*'
234
+ DEFAULT_MATCH_STRATEGY = '.'
235
+ DEFAULT_PORT = 2628
236
+ ERROR = /^[45]/
237
+ FIRST_DATABASE = '!'
238
+ MAX_LINE_LENGTH = 1024
239
+ PAIR = /^(\S+)\s"(.+)"\r$/
240
+ REPLY_CODE = /^\d\d\d/
241
+
242
+ def initialize(hosts, port = DEFAULT_PORT, debug = false, verbose = false)
243
+ hosts.each do |host|
244
+ @debug = debug
245
+ @verbose = verbose
246
+ printf("Attempting to connect to %s:%d...\n", host, port) if @verbose
247
+
248
+ begin
249
+ @sock = TCPSocket.open(host, port)
250
+ rescue
251
+ next # cycle through list of servers, if more than one
252
+ end
253
+
254
+ break # continue if connection to this host succeeded
255
+ end
256
+
257
+ # catch failure
258
+ raise ConnectError, 'Unable to connect to host' unless defined? @sock
259
+
260
+ # check status line on connect
261
+ line = get_line
262
+ raise ConnectError, line if line =~ ERROR
263
+
264
+ caps, @msgid = /<(.+?)>\s(<.+>)/.match(line)[1..2]
265
+ @capabilities = caps.split(/\./)
266
+ if @verbose
267
+ printf("Capabilities: %s\n", @capabilities.join(', '))
268
+ printf("Msgid: %s\n", @msgid)
269
+ end
270
+ end
271
+
272
+ private
273
+
274
+ # output a line to the server
275
+ #
276
+ def send_line(command)
277
+ line = command + "\r\n"
278
+ $stderr.printf("SEND: %s", line) if @debug
279
+ @sock.print(line)
280
+ end
281
+
282
+ # get a line of input from the server
283
+ #
284
+ def get_line
285
+ line = @sock.readline("\r\n")
286
+ $stderr.printf("RECV: %s", line) if @debug
287
+ line
288
+ end
289
+
290
+ # send a command and get a response
291
+ #
292
+ def exec_cmd(command)
293
+ send_line(command)
294
+ line = get_line
295
+ @code, @message = /^(\d\d\d)\s(.*)$/.match(line)[1..2]
296
+ # remember the command just executed
297
+ @command = command
298
+ end
299
+
300
+ # determine whether we're at the end of this response
301
+ #
302
+ def end_of_text?(line)
303
+ line =~ /^\.\r$/ ? true : false
304
+ end
305
+
306
+ # generic method to issue command and parse response
307
+ #
308
+ def parse_response
309
+ return nil if @code =~ ERROR
310
+
311
+ while line = get_line
312
+ # on first pass through loop, create list as either a hash
313
+ # or a string, depending # on what data looks like
314
+ list ||= line =~ PAIR ? Hash.new : ''
315
+
316
+ # check for end of data
317
+ return list if line =~ REPLY_CODE
318
+
319
+ if ! end_of_text? line
320
+ line.undot!
321
+ (list << line; next) if list.is_a?(String) # list is just text
322
+
323
+ # list is a hash of data pairings
324
+ name, desc = PAIR.match(line)[1..2]
325
+ if @command =~ /^MATCH/
326
+ list[name] = Array.new unless list[name]
327
+ list[name] << desc
328
+ else
329
+ list[name] = desc
330
+ end
331
+
332
+ end
333
+ end
334
+ end
335
+
336
+ public
337
+
338
+ # QUIT from the server
339
+ #
340
+ def disconnect
341
+ exec_cmd('QUIT')
342
+ @sock.close
343
+ end
344
+
345
+ # DEFINE a word
346
+ #
347
+ def define(db, word)
348
+ definitions = Array.new
349
+ d = Definition.new
350
+ d.word = word
351
+ d.definition = Array.new
352
+
353
+ exec_cmd('DEFINE %s "%s"' % [ db, word ])
354
+
355
+ return nil if @code =~ ERROR
356
+
357
+ while line = get_line
358
+ return definitions if line =~ /^#{OK}/
359
+
360
+ if line =~ /^#{WORD_DEFINITION}/
361
+ word, d.database, d.description =
362
+ /^\d\d\d\s"(.+?)"\s(\S+)\s"(.+)"\r$/.match(line)[1..3]
363
+ elsif end_of_text? line # finish definition and start a new one
364
+ definitions << d
365
+ d = Definition.new
366
+ d.word = word
367
+ d.definition = Array.new
368
+ else
369
+ line.undot!
370
+ d.definition << line
371
+ end
372
+
373
+ end
374
+ end
375
+
376
+ # MATCH a word
377
+ #
378
+ def match(db, strategy, word)
379
+ exec_cmd('MATCH %s %s "%s"' % [ db, strategy, word ])
380
+ parse_response
381
+ end
382
+
383
+ # get database list
384
+ #
385
+ def show_db
386
+ exec_cmd("SHOW DB")
387
+ parse_response
388
+ end
389
+
390
+ # get strategy list
391
+ #
392
+ def show_strat
393
+ exec_cmd("SHOW STRAT")
394
+ parse_response
395
+ end
396
+
397
+ # get information on database
398
+ #
399
+ def show_info(db)
400
+ exec_cmd('SHOW INFO %s' % db)
401
+ parse_response
402
+ end
403
+
404
+ # get server information
405
+ #
406
+ def show_server
407
+ exec_cmd("SHOW SERVER")
408
+ parse_response
409
+ end
410
+
411
+ # request server STATUS information
412
+ #
413
+ def status
414
+ exec_cmd('STATUS')
415
+ @message
416
+ end
417
+
418
+ # request server-side HELP
419
+ #
420
+ def help
421
+ exec_cmd('HELP')
422
+ parse_response
423
+ end
424
+
425
+ # send CLIENT information
426
+ #
427
+ def client(info)
428
+ exec_cmd('CLIENT %s' % info)
429
+ end
430
+
431
+ # AUTHorise user
432
+ #
433
+ def auth(user, secret)
434
+ auth = MD5::new(@msgid + secret).hexdigest
435
+ exec_cmd('AUTH %s %s' % [ user, auth ])
436
+ end
437
+
438
+ end
@@ -0,0 +1,76 @@
1
+
2
+ # The Open Office Thesaurus object. Create a new object with idx file and
3
+ # main database file name and search words with "lookup".
4
+ # Works with OO Thesaurus files 2.x
5
+ # by kesiev at http://www.kesiev.com/
6
+
7
+ class OOThesaurus
8
+
9
+ def dosearch(the,history,word,add,filepathidx,filepathdat)
10
+ a = []
11
+ if add then history.push(word) end
12
+ word=word
13
+ #$itemslist.clear
14
+ rt=the.lookup(word,filepathidx,filepathdat)
15
+ if rt.length>0
16
+ rt.each { |ent|
17
+ ent.each_with_index { |line,i|
18
+ # a=itemslist.append
19
+ a[0]=(i!=0 ? "\t" : "" )+ line
20
+ }
21
+ }
22
+ else
23
+ # a=$itemslist.append
24
+ a[0]="No hits."
25
+ end
26
+ end
27
+
28
+
29
+ def lookup(word,idxfile,datfile)
30
+ Dir.chdir($progdir)
31
+ if $DEBUG
32
+ $stderr.puts "in lookup\n"
33
+ $stderr.puts idxfile.to_s
34
+ end
35
+ seek=-1
36
+ ret=[]
37
+ if File::exist?(idxfile) && File::exist?(datfile)
38
+
39
+ open(idxfile,"r").each { |f|
40
+ f.each { |line|
41
+ line=line.split("|")
42
+ if line[0]==word
43
+ seek=line[1].to_i
44
+ break
45
+ end
46
+ }
47
+ }
48
+ ret=[]
49
+ ret2 = []
50
+ if seek!=-1
51
+ open(datfile,"r") { |a|
52
+ a.seek(seek)
53
+ data=a.gets.split("|")
54
+ data[1].to_i.times {
55
+ ret << a.gets.strip.split("|")
56
+
57
+ }
58
+ }
59
+
60
+ end
61
+ end
62
+
63
+ ret
64
+ end
65
+ end
66
+
67
+
68
+
69
+
70
+ def back(history)
71
+ if word=history.pop then
72
+ #$box.text=word
73
+ dosearch(false)
74
+ end
75
+ end
76
+
@@ -62,19 +62,19 @@ Ruby I am using version 1.8.2
62
62
 
63
63
 
64
64
  I have tested this under Linux-Debian kernel 2.6.9
65
-
66
- ==Making Applets
67
-
68
- What is required in a applet for the rwdtinker framework
69
-
70
- 1. config file
71
- 2. code files - under in a unique directory under code
72
- 3. gui files - begin with window name in unique directory(s) under gui/tinkerbackwindow
73
- 4. install file ending with .inf under install directory - code directories are listed in here for live startup
74
- 5. uninstall program file in code directory - to uninstall the global variables
75
- 6. the install file, config file and uninstall method have the same name
76
-
77
- Then zip it up and it should be ready to go.
65
+
66
+ ==Making Applets
67
+
68
+ What is required in a applet for the rwdtinker framework
69
+
70
+ 1. config file
71
+ 2. code files - under in a unique directory under code
72
+ 3. gui files - begin with window name in unique directory(s) under gui/tinkerbackwindow
73
+ 4. install file ending with .inf under install directory - code directories are listed in here for live startup
74
+ 5. uninstall program file in code directory - to uninstall the global variables
75
+ 6. the install file, config file and uninstall method have the same name
76
+
77
+ Then zip it up and it should be ready to go.
78
78
 
79
79
  == PROBLEMS:
80
80
 
@@ -95,7 +95,16 @@ Don't use the back-button of the browser! Strange and unpredictable things may a
95
95
  Steven Gibson
96
96
  steven@superant.com
97
97
 
98
- == Changelog
98
+ == Changelog
99
+ version 0.03
100
+ remove sort from display of fold links (we want the default order!)
101
+ widen text boxes that display path and name of note file
102
+ remove old bad buttons from bottom of note view tab
103
+ add save button to bottom of note view tab
104
+ add dictionary search
105
+ thesaurus search - using openoffice
106
+ internet AI interface
107
+
99
108
  version 0.02
100
109
  add configuration file editing
101
110
  corrected handling of fold directory
@@ -106,4 +115,4 @@ version 0.01
106
115
  select file in a fold link file
107
116
  create new text files
108
117
  edit fold link files
109
-
118
+
@@ -12,7 +12,7 @@ $rwdjumplink = [""]
12
12
  JumpLink = Hash.new("default")
13
13
  require 'fileutils'
14
14
  DistroName = "rwdwfoldeditor"
15
- DistroVersion=0.02
15
+ DistroVersion=0.03
16
16
  load "configuration/#{DistroName}-#{DistroVersion}.dist"
17
17
 
18
18
 
data/tests/makedist.rb CHANGED
@@ -14,7 +14,7 @@ require 'fileutils'
14
14
 
15
15
  DistroName = "rwdwfoldeditor"
16
16
 
17
- DistroVersion="0.02"
17
+ DistroVersion="0.03"
18
18
 
19
19
  DistroTitle="#{DistroName}-#{DistroVersion}.dist"
20
20
  load "configuration/#{DistroTitle}"
Binary file
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rwdfoldeditor
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.02"
4
+ version: "0.03"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Gibson
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-09-14 00:00:00 -07:00
12
+ date: 2008-09-15 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -20,6 +20,7 @@ executables:
20
20
  extensions: []
21
21
 
22
22
  extra_rdoc_files:
23
+ - rwd_files/HowTo_FoldEditor.txt
23
24
  - Readme.txt
24
25
  - rwd_files/HowTo_Tinker.txt
25
26
  - rwd_files/HowTo_TinkerWin2.txt
@@ -40,6 +41,8 @@ files:
40
41
  - lib/zip/zip.rb
41
42
  - lib/zip/zipfilesystem.rb
42
43
  - lib/zip/tempfile_bugfixed.rb
44
+ - lib/dict.rb
45
+ - lib/oothesaurus.rb
43
46
  - lib/rconftool.rb
44
47
  - code/zz0applicationend/zz0end.rb
45
48
  - code/superant.com.rwdtinkerbackwindow/listgemdirs.rb
@@ -65,6 +68,13 @@ files:
65
68
  - code/superant.com.rwdtinkerbackwindow/installgemapplet.rb
66
69
  - code/superant.com.rwdtinkerbackwindow/runremoteinstall.rb
67
70
  - code/superant.com.rwdtinkerbackwindow/openappletname.rb
71
+ - code/superant.com.foldback/dictlookup.rb
72
+ - code/superant.com.foldback/listwordlookup.rb
73
+ - code/superant.com.foldback/openhelpwindowrwdhyernote.rb
74
+ - code/superant.com.foldback/eliza.rb
75
+ - code/superant.com.foldback/helptexthashrwdhypernote.rb
76
+ - code/superant.com.foldback/runrwdshellwindow.rb
77
+ - code/superant.com.foldback/clearhttpview3.rb
68
78
  - code/01rwdcore/setuptinkerdocuments.rb
69
79
  - code/01rwdcore/openhelpwindow.rb
70
80
  - code/01rwdcore/setuphelpaboutoptions.rb
@@ -87,6 +97,7 @@ files:
87
97
  - code/dd0viewphoto/dd0viewphoto.rb
88
98
  - code/superant.com.foldeditor/savehtmlhypernoterecord.rb
89
99
  - code/superant.com.foldeditor/openhelpwindowrwdhyernote.rb
100
+ - code/superant.com.foldeditor/clearnotescreen.rb
90
101
  - code/superant.com.foldeditor/changehypernotename.rb
91
102
  - code/superant.com.foldeditor/loadrwdfoldeditlinkfile.rb
92
103
  - code/superant.com.foldeditor/saveconfigurationrecord.rb
@@ -109,7 +120,7 @@ files:
109
120
  - configuration/tinkerwin2variables.dist
110
121
  - configuration/language.dist
111
122
  - configuration/rwdapplicationidentity.dist
112
- - configuration/rwdwfoldeditor-0.02.dist
123
+ - configuration/rwdwfoldeditor-0.03.dist
113
124
  - lang/en/rwdcore/languagefile.rb
114
125
  - lang/es/rwdcore/languagefile-es.rb
115
126
  - lang/fr/rwdcore/languagefile.rb
@@ -142,6 +153,13 @@ files:
142
153
  - gui/tinkerbackwindows/superant.com.versionwindow
143
154
  - gui/tinkerbackwindows/superant.com.versionwindow/helpaboutwindow.rwd
144
155
  - gui/tinkerbackwindows/superant.com.versionwindow/1appname.rwd
156
+ - gui/tinkerbackwindows/superant.com.foldwords
157
+ - gui/tinkerbackwindows/superant.com.foldwords/1appname.rwd
158
+ - gui/tinkerbackwindows/superant.com.foldwords/1dictionary.rwd
159
+ - gui/tinkerbackwindows/superant.com.foldwords/77jumplinkcommands.rwd
160
+ - gui/tinkerbackwindows/superant.com.foldwords/z9end.rwd
161
+ - gui/tinkerbackwindows/superant.com.foldwords/3ai.rwd
162
+ - gui/tinkerbackwindows/superant.com.foldwords/4thesaurus.rwd
145
163
  - gui/helpaboutzend/zzzzhelpscreen2end.rwd
146
164
  - gui/helpaboutzend/zzzzhelpabout2.rwd
147
165
  - gui/helpaboutzend/zhelpscreenstart2.rwd
@@ -155,7 +173,7 @@ files:
155
173
  - gui/frontwindowselections/00selectiontabbegin.rwd
156
174
  - gui/zzcoreguiend/yy9rwdend.rwd
157
175
  - installed/temp.rb
158
- - installed/rwdwfoldeditor-0.02.inf
176
+ - installed/rwdwfoldeditor-0.03.inf
159
177
  - rwd_files/tinker.png
160
178
  - rwd_files/favicon.ico
161
179
  - rwd_files/default.fld
@@ -169,12 +187,11 @@ files:
169
187
  - rwd_files/HowTo_FoldEditor.txt
170
188
  - zips/rwdwgutenberg-0.09.zip
171
189
  - zips/temp.rb
172
- - zips/rwdwfoldeditor-0.02.zip
190
+ - zips/rwdwfoldeditor-0.03.zip
173
191
  - zips/rwdwcalc-0.61.zip
174
- - zips/rwdwshell-1.04.zip
192
+ - zips/rwdwruby-1.05.zip
175
193
  - zips/rwdwaddresses-1.05.zip
176
194
  - zips/wrubyslippers-1.06.zip
177
- - zips/rwdwschedule-1.04.zip
178
195
  - tests/rdep.rb
179
196
  - tests/makedist-rwdwfoldeditor.rb
180
197
  - tests/cleancnf.sh
Binary file
Binary file
Binary file