Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove MonoTorrent from here, keep this Curses-only, add some tiny do…

…cs, make distcheck pass again

svn path=/trunk/mono-curses/; revision=115583
  • Loading branch information...
commit b0765c1dd40ad1f511e5e68d997cf27c8b8949b8 1 parent 791ec21
@migueldeicaza migueldeicaza authored
Showing with 74 additions and 96 deletions.
  1. +15 −39 Makefile
  2. +1 −1  configure
  3. +16 −17 docs/index.xml
  4. +42 −39 gui.cs
View
54 Makefile
@@ -10,49 +10,26 @@ SOURCES = \
EXTRA_DIST = \
configure \
Makefile \
- monotorrent.in \
binding.cs.in \
attrib.c \
mono-curses.c \
- monotorrent.cs \
mono-curses.source
DOCS_DIST = \
- docs/Mono.Terminal.xml \
+ docs/ns-Mono.Terminal.xml \
docs/index.xml
-TORRENTDIR=/cvs/bitsharp/src
-TORRENTLIBS=`pkg-config --libs monotorrent`
-
-all: config.make mono-curses.dll libmono-curses.so monotorrent.exe monotorrent mono-curses.zip
-
-monotorrent: monotorrent.in Makefile
- sed "s,@prefix@,$(prefix)," < monotorrent.in > monotorrent
- chmod +x monotorrent
+all: config.make mono-curses.dll libmono-curses.so mono-curses.zip
test.exe: test.cs mono-curses.dll libmono-curses.so
gmcs -debug test.cs -r:mono-curses.dll
-monotorrent.exe: monotorrent.cs mono-curses.dll libmono-curses.so MonoTorrent.dll
- gmcs -debug monotorrent.cs -r:mono-curses.dll $(TORRENTLIBS)
-
-MonoTorrent.dll Upnp.dll:
- if pkg-config --atleast-version=0.1 monotorrent; then \
- cp `pkg-config --variable=Libraries monotorrent` .; \
- else \
- echo You must install The Monotorrent libraries first; \
- exit 1; \
- fi
-
-run: monotorrent.exe
- DYLD_LIBRARY_PATH=. MONO_PATH=$(TORRENTDIR)/bin:$(TORRENTDIR)/Libs mono --debug monotorrent.exe || stty sane
-
mono-curses.dll mono-curses.xml: $(SOURCES)
gmcs -doc:mono-curses.xml -debug -target:library -out:mono-curses.dll -debug $(SOURCES)
#
-mono-curses.tree mono-curses.zip: mono-curses.xml mono-curses.dll docs/Mono.Terminal.xml docs/index.xml
+mono-curses.tree mono-curses.zip: mono-curses.xml mono-curses.dll docs/ns-Mono.Terminal.xml docs/index.xml
monodocer -importslashdoc:mono-curses.xml -path:docs -assembly:mono-curses.dll
mdassembler --ecma docs/ --out mono-curses
@@ -86,10 +63,9 @@ clean:
install: all
mkdir -p $(prefix)/bin
- mkdir -p $(prefix)/lib/monotorrent
- cp mono-curses.dll MonoTorrent.dll monotorrent.exe $(prefix)/lib/monotorrent
- cp libmono-curses* $(prefix)/lib/monotorrent
- cp monotorrent $(prefix)/bin
+ mkdir -p $(prefix)/lib/mono-curses
+ cp mono-curses.dll $(prefix)/lib/mono-curses
+ cp libmono-curses* $(prefix)/lib/
cp mono-curses.tree mono-curses.zip mono-curses.source `pkg-config --variable sourcesdir monodoc`
config.make:
@@ -99,21 +75,21 @@ config.make:
include config.make
dist:
- rm -rf monotorrent-curses-$(VERSION)
- mkdir monotorrent-curses-$(VERSION)
- mkdir monotorrent-curses-$(VERSION)/docs
- cp -a $(SOURCES) $(EXTRA_DIST) monotorrent-curses-$(VERSION)
- cp -a $(DOCS_DIST) monotorrent-curses-$(VERSION)/docs
- tar czvf monotorrent-curses-$(VERSION).tar.gz monotorrent-curses-$(VERSION)
- rm -rf monotorrent-curses-$(VERSION)
+ rm -rf mono-curses-$(VERSION)
+ mkdir mono-curses-$(VERSION)
+ mkdir mono-curses-$(VERSION)/docs
+ cp -a $(SOURCES) $(EXTRA_DIST) mono-curses-$(VERSION)
+ cp -a $(DOCS_DIST) mono-curses-$(VERSION)/docs
+ tar czvf mono-curses-$(VERSION).tar.gz mono-curses-$(VERSION)
+ rm -rf mono-curses-$(VERSION)
distcheck: dist
rm -rf test
- (mkdir test; cd test; tar xzvf ../monotorrent-curses-$(VERSION).tar.gz; cd monotorrent-curses-$(VERSION); \
+ (mkdir test; cd test; tar xzvf ../mono-curses-$(VERSION).tar.gz; cd mono-curses-$(VERSION); \
./configure --prefix=$$(cd `pwd`/..; pwd); \
make && make install && make dist);
rm -rf test
- echo monotorrent-curses-$(VERSION).tar.gz is ready for release
+ echo mono-curses-$(VERSION).tar.gz is ready for release
push:
scp mono-curses.tree mono-curses.zip mono-curses.source root@www.go-mono.com:/usr/lib/monodoc/sources/
View
2  configure
@@ -1,5 +1,5 @@
#!/bin/sh
-VERSION=0.2
+VERSION=0.3
prefix=/usr/local
while test x$1 != x; do
case $1 in
View
33 docs/index.xml
@@ -12,23 +12,22 @@
<Copyright>To be added.</Copyright>
<Types>
<Namespace Name="Mono.Terminal">
- <Type Name="Anchor" />
- <Type Name="Application" />
- <Type Name="Button" />
- <Type Name="Container" />
- <Type Name="Curses" />
- <Type Name="Curses+MouseEvent" />
- <Type Name="Dialog" />
- <Type Name="Entry" />
- <Type Name="Fill" />
- <Type Name="Frame" />
- <Type Name="IListProvider" />
- <Type Name="Label" />
- <Type Name="ListView" />
- <Type Name="Screen" />
- <Type Name="TrimLabel" />
- <Type Name="Widget" />
- <Type Name="Window" />
+ <Type Name="Application" Kind="Class" />
+ <Type Name="Button" Kind="Class" />
+ <Type Name="Container" Kind="Class" />
+ <Type Name="Curses" Kind="Class" />
+ <Type Name="Curses+MouseEvent" Kind="Structure" />
+ <Type Name="Dialog" Kind="Class" />
+ <Type Name="Entry" Kind="Class" />
+ <Type Name="Fill" Kind="Enumeration" />
+ <Type Name="Frame" Kind="Class" />
+ <Type Name="IListProvider" Kind="Interface" />
+ <Type Name="Label" Kind="Class" />
+ <Type Name="ListView" Kind="Class" />
+ <Type Name="Screen" Kind="Class" />
+ <Type Name="TrimLabel" Kind="Class" />
+ <Type Name="Widget" Kind="Class" />
+ <Type Name="Window" Kind="Class" />
</Namespace>
</Types>
<Title>mono-curses</Title>
View
81 gui.cs
@@ -33,19 +33,10 @@
namespace Mono.Terminal {
- [Flags]
- public enum Anchor {
- None = 0,
- Left = 1,
- Right = 2,
- Top = 4,
- Bottom = 8
- }
-
- //
- // The fill values apply from the given x, y values, they will not do
- // a full fill, you must compute x, y yourself.
- //
+ /// <summary>
+ /// The fill values apply from the given x, y values, they will not do
+ /// a full fill, you must compute x, y yourself.
+ /// </summary>
[Flags]
public enum Fill {
None = 0,
@@ -57,11 +48,13 @@ public enum Fill {
/// Base class for creating curses widgets
/// </summary>
public abstract class Widget {
+ /// <summary>
+ /// Points to the container of this widget
+ /// </summary>
public Container Container;
public int x, y, w, h;
bool can_focus;
bool has_focus;
- public Anchor Anchor;
public Fill Fill;
static StreamWriter l;
@@ -724,7 +717,8 @@ public override void ProcessMouse (Curses.MouseEvent ev)
/// letter in the button becomes the hotkey).
/// </remarks>
public class Button : Widget {
- public string text;
+ string text;
+ string shown_text;
char hot_key;
int hot_pos = -1;
bool is_default;
@@ -770,6 +764,30 @@ public class Button : Widget {
/// </remarks>
public Button (int x, int y, string s) : this (x, y, s, false) {}
+ public string Text {
+ get {
+ return text;
+ }
+
+ set {
+ text = value;
+ if (is_default)
+ shown_text = "[< " + value + " >]";
+ else
+ shown_text = "[ " + value + " ]";
+
+ int i = 0;
+ foreach (char c in shown_text){
+ if (Char.IsUpper (c)){
+ hot_key = c;
+ hot_pos = i;
+ break;
+ }
+ i++;
+ }
+ }
+ }
+
/// <summary>
/// Public constructor, creates a button based on
/// the given text at the given position.
@@ -785,27 +803,14 @@ public Button (int x, int y, string s, bool is_default)
CanFocus = true;
this.is_default = is_default;
- if (is_default)
- text = "[< " + s + " >]";
- else
- text = "[ " + s + " ]";
-
- int i = 0;
- foreach (char c in text){
- if (Char.IsUpper (c)){
- hot_key = c;
- hot_pos = i;
- break;
- }
- i++;
- }
+ Text = s;
}
public override void Redraw ()
{
Curses.attrset (HasFocus ? ColorFocus : ColorNormal);
Move (y, x);
- Curses.addstr (text);
+ Curses.addstr (shown_text);
Move (y, x + hot_pos);
Curses.attrset (HasFocus ? ColorHotFocus : ColorHotNormal);
Curses.addch (hot_key);
@@ -1443,15 +1448,6 @@ public override void DoSizeChanged ()
foreach (Widget widget in widgets){
widget.DoSizeChanged ();
- //Anchor a = w.Anchor;
- //
- //// Left/Top anchors are just x, y
- //if ((a & Anchor.Right) != 0)
- // w.x = w - border - w.w;
- //
- //if ((a & Anchor.Bottom) != 0)
- // w.y = h - border - w.h;
-
if ((widget.Fill & Fill.Horizontal) != 0){
widget.w = w - (Border*2) - widget.x;
}
@@ -1754,6 +1750,10 @@ public class Application {
static short last_color_pair;
static bool inited;
static Container empty_container;
+
+ /// <summary>
+ /// A flag indicating which mouse events are available
+ /// </summary>
public static long MouseEventsAvailable;
static int MakeColor (short f, short b)
@@ -1762,6 +1762,9 @@ static int MakeColor (short f, short b)
return Curses.ColorPair (last_color_pair);
}
+ /// <summary>
+ /// The singleton EmptyContainer that covers the entire screen.
+ /// </summary>
static public Container EmptyContainer {
get {
return empty_container;
Please sign in to comment.
Something went wrong with that request. Please try again.