Schrift
[thread]11437[/thread]

Kephra: Texteditor nur in Perl (Seite 16)

Tags: Ähnliche Threads

Leser: 92


<< |< 1 ... 13 14 15 16 17 18 19 ... 54 >| >> 539 Einträge, 54 Seiten
lichtkind
 2008-07-30 19:07
#112914 #112914
User since
2004-03-22
5709 Artikel
ModeratorIn + EditorIn
[Homepage]
user image
0.3.9.12

hat endlich ein goto line icon, bravo jenne und ich musst das andere nicht doppelt benutzen, bin auf neues config::general umgestiegen und noch was in about box gefixed. also lauter kleine sahcen aber der zug kommt wieder ins rollen. hab idee wie man druckseiten erzeugt.
Wiki:Tutorien in der Wiki, mein zeug:
kephra, baumhaus, garten, gezwitscher

Es beginnt immer mit einer Entscheidung.
pktm
 2008-07-30 19:54
#112918 #112918
User since
2003-08-07
2921 Artikel
BenutzerIn
[Homepage]
user image
lichtkind+2008-07-30 17:07:39--
hab idee wie man druckseiten erzeugt.



Welche?
http://www.intergastro-service.de (mein erstes CMS :) )
lichtkind
 2008-07-30 22:30
#112926 #112926
User since
2004-03-22
5709 Artikel
ModeratorIn + EditorIn
[Homepage]
user image
das ich die komplette seite setze. schriftart abstände sogar farbe der einzelnen buchstaben forher beim lexer abfragen und dann setzen. wird zwar aufwändig aber müsste funktionieren da ich im wxdemo schon rotierten text ausgedruckt sah. ausserdem ist das der einzige weg etwas ausgedrucktes ohne curser, einrückhilfen etc zu bekommen.

noch etwas werbung in eigner sache: Config::General Autor thomas linden hat auf meine anfrage eine neue c::G-option eingeführt die ich jetzt benutze und wegen der ich auch wieder aktuelle c::G versionen benutzen kann. weil man in config dateien nicht findet wenn sie unsortiert sind. hab namensgebung auch etwas so gelegt das sie alphabetisch und inhaltlich sortiert sind.
Wiki:Tutorien in der Wiki, mein zeug:
kephra, baumhaus, garten, gezwitscher

Es beginnt immer mit einer Entscheidung.
pktm
 2008-07-31 05:04
#112928 #112928
User since
2003-08-07
2921 Artikel
BenutzerIn
[Homepage]
user image
Ja, dass man um das Setzen aller Dinge nicht drumherum kommt hatte ich auch schon befürchtet :-s

Weiter als bis zu diesem Test bin ich damals nicht gekommen:
Code: (dl )
1
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
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
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
use Wx::Print;

package PrintingDemoWindow;

use strict;
use vars qw(@ISA); @ISA = qw(Wx::Panel);
use Wx qw(:sizer);
use Wx::Event qw(EVT_BUTTON);

sub new {
my $class = shift;
my $this = $class->SUPER::new( @_ );

my $top = Wx::BoxSizer->new( wxVERTICAL );
my $canvas = PrintingDemoCanvas->new( $this, -1 );

my $preview = Wx::Button->new( $this, -1, "Preview" );
my $print = Wx::Button->new( $this, -1, "Print" );

my $buttons = Wx::BoxSizer->new( wxHORIZONTAL );
$buttons->Add( $preview, 0, wxALL, 5 );
$buttons->Add( $print, 0, wxALL, 5 );

$top->Add( $canvas, 1, wxGROW );
$top->Add( $buttons, 0, wxGROW );

$this->SetSizer( $top );
$this->SetAutoLayout( 1 );

$this->{CANVAS} = $canvas;

EVT_BUTTON( $this, $preview, \&OnPreview );
EVT_BUTTON( $this, $print, \&OnPrint );

return $this;
}

sub canvas { $_[0]->{CANVAS} }

use Wx qw(wxTheApp);

sub OnPreview {
my( $this, $event ) = @_;

my $prev = PrintingDemoPrintout->new( $this->canvas, "Preview" );
my $print = PrintingDemoPrintout->new( $this->canvas, "Print" );
my $preview = Wx::PrintPreview->new( $prev, $print );
my $frame = PrintingDemoPreviewFrame->new( $preview, wxTheApp->GetTopWindow,
"Printing Demo Preview", [-1, -1], [600, -1] );
$frame->Initialize();

$frame->Show( 1 );
}

sub OnPrint {
my( $this, $event ) = @_;

my $printer = Wx::Printer->new;
my $printout = PrintingDemoPrintout->new( $this->canvas, "Print" );
$printer->Print( $this, $printout, 1 );

$printout->Destroy;
}

package PrintingDemoPreviewFrame;

use base 'Wx::PlPreviewFrame';

sub Initialize {
Wx::LogMessage( 'PrintingDemoPreviewFrame::Initialize' );

$_[0]->SUPER::Initialize;
}

sub CreateControlBar {
Wx::LogMessage( 'PrintingDemoPreviewFrame::CreateControlBar' );

$_[0]->SetPreviewControlBar
( PrintingDemoControlBar->new( $_[0]->GetPrintPreview, $_[0] ) );
$_[0]->GetPreviewControlBar->CreateButtons;
}

package PrintingDemoControlBar;

use base 'Wx::PlPreviewControlBar';

sub new {
Wx::LogMessage( 'PrintingDemoControlBar::new' );

$_[0]->SUPER::new( $_[1], 0xffffffff, $_[2], [0, 0], [400, 40] );
}

sub CreateButtons {
Wx::LogMessage( 'PrintingDemoControlBar::CreateButtons' );

shift->SUPER::CreateButtons;
}

package PrintingDemoPrintout;

use strict;
use vars qw(@ISA); @ISA = qw(Wx::Printout);

sub new {
my $class = shift;
my $canvas = shift;
my $this = $class->SUPER::new( @_ );

$this->{CANVAS} = $canvas;

return $this;
}

sub GetPageInfo {
my $this = shift;

Wx::LogMessage( "GetPageInfo" );

return ( 1, 2, 1, 2 );
}

sub HasPage {
my $this = shift;

Wx::LogMessage( "HasPage: %d", $_[0] );

return $_[0] == 1 || $_[0] == 2;
}

sub OnBeginDocument {
my $this = shift;

Wx::LogMessage( "OnBeginDocument: %d, %d", @_ );

return $this->SUPER::OnBeginDocument( @_ );
}

sub OnEndDocument {
my $this = shift;

Wx::LogMessage( "OnEndDocument" );

return $this->SUPER::OnEndDocument();
}

sub OnBeginPrinting {
my $this = shift;

Wx::LogMessage( "OnBeginPrinting" );

return $this->SUPER::OnBeginPrinting();
}

sub OnEndPrinting {
my $this = shift;

Wx::LogMessage( "OnEndPrinting" );

return $this->SUPER::OnEndPrinting();
}

sub OnPrintPage {
my( $this, $page ) = @_;
my $dc = $this->GetDC();

# we need to set the appropriate scale
my( $x_size, $y_size ) = ( $PrintingDemoCanvas::x_size,
$PrintingDemoCanvas::y_size );

my( $xmargin, $ymargin ) = ( 50, 50 );
# total size ( borders on top/bottom, left/right )
my( $xsize, $ysize ) = ( $x_size + 2 * $xmargin, $y_size + 2 * $ymargin );

# dc size
my( $xdc, $ydc ) = $dc->GetSizeWH();

# calculate the scale
my( $xscale, $yscale ) = ( $xdc / $xsize, $ydc / $ysize );
my $scale = ( $xscale < $yscale ) ? $xscale : $yscale;
# center the image
my( $xoff, $yoff ) = ( ( $xdc - ( $scale * $x_size ) ) / 2.0,
( $ydc - ( $scale * $y_size ) ) / 2.0 );

# set the DC origin / scale
$dc->SetUserScale( $scale, $scale );
$dc->SetDeviceOrigin( $xoff, $yoff );

if( $page == 1 ) { $this->{CANVAS}->OnDraw( $dc ); }
if( $page == 2 ) { } # empty page
}

package PrintingDemoCanvas;

use strict;
use vars qw(@ISA); @ISA = qw(Wx::ScrolledWindow);
use Wx qw(wxCURSOR_PENCIL wxWHITE);
use Wx::Event qw(EVT_MOTION EVT_LEFT_DOWN EVT_LEFT_UP);

use vars qw($x_size $y_size);

( $x_size, $y_size ) = ( 800, 800 );

sub new {
my $class = shift;
my $this = $class->SUPER::new( @_ );

$this->SetScrollbars( 1, 1, $x_size, $y_size );
$this->SetBackgroundColour( wxWHITE );
$this->SetCursor( Wx::Cursor->new( wxCURSOR_PENCIL ) );

EVT_MOTION( $this, \&OnMouseMove );
EVT_LEFT_DOWN( $this, \&OnButton );
EVT_LEFT_UP( $this, \&OnButton );

return $this;
}

use Wx qw(:font);
use Wx qw(:colour :pen);

sub OnDraw {
my $this = shift;
my $dc = shift;
# my $font = Wx::Font->new( 20, wxSCRIPT, wxSLANT, wxBOLD );

# $dc->SetFont( $font );
$dc->DrawRotatedText( "Draw Here", 200, 200, 35 );

$dc->DrawEllipse( 20, 20, 50, 50 );
$dc->DrawEllipse( 20, $y_size - 50 - 20, 50, 50 );
$dc->DrawEllipse( $x_size - 50 - 20, 20, 50, 50 );
$dc->DrawEllipse( $x_size - 50 - 20, $y_size - 50 - 20, 50, 50 );

$dc->SetPen( Wx::Pen->new( wxRED, 5, 0 ) );
# wxGTK does not like DrawLines in this context
foreach my $i ( @{$this->{LINES}} ) {
my $prev;

foreach my $j ( @$i ) {
if( $j != ${$i}[0] ) {
$dc->DrawLine( @$prev, @$j );
# $dc->DrawLines( $i );
}
$prev = $j;
}
}
}

sub OnMouseMove {
my( $this, $event ) = @_;

return unless $event->Dragging;

my $dc = Wx::ClientDC->new( $this );
$this->PrepareDC( $dc );
my $pos = $event->GetLogicalPosition( $dc );
my( $x, $y ) = ( $pos->x, $pos->y );

push @{$this->{CURRENT_LINE}}, [ $x, $y ];
my $elems = @{$this->{CURRENT_LINE}};

$dc->SetPen( Wx::Pen->new( wxRED, 5, 0 ) );
$dc->DrawLine( @{$this->{CURRENT_LINE}[$elems-2]},
@{$this->{CURRENT_LINE}[$elems-1]} );

}

sub OnButton {
my( $this, $event ) = @_;

my $dc = Wx::ClientDC->new( $this );
$this->PrepareDC( $dc );
my $pos = $event->GetLogicalPosition( $dc );
my( $x, $y ) = ( $pos->x, $pos->y );

if( $event->LeftUp ) {
push @{$this->{CURRENT_LINE}}, [ $x, $y ];
push @{$this->{LINES}}, $this->{CURRENT_LINE};
$this->ReleaseMouse();
} else {
$this->{CURRENT_LINE} = [ [ $x, $y ] ];
$this->CaptureMouse();
}

$dc->SetPen( Wx::Pen->new( wxRED, 5, 0 ) );
$dc->DrawLine( $x, $y, $x, $y );
}

1;



package main;

use strict;
use warnings;
use Wx::Print;
use ServusWelt;

ServusWelt->new->MainLoop; # Programminstanz erzeugen und starten


Wenn ich mich recht entsinne passiert da nichts anderes, als dass ich versucht habe ein Textfeld ausdrucken zu lassen. Im Moment wird aber noch die Canvas für den Druck-Job heran gezogen. Eigentlich sollte da aber das Zeug aus dem Textfeld rein.
http://www.intergastro-service.de (mein erstes CMS :) )
#Kein Kommentar
 2008-08-04 00:35
#113045 #113045
User since
2007-06-09
575 Artikel
HausmeisterIn
[default_avatar]
noch ein nettes kleines feature bei dem goto-line-dialog wäre noch, dass man durch ein '+' oder ein '-' sagen könnte, dass man sich von der aktuellen position aus um z.b. 50 zeilen ('+50') nach unten oder um 50 zeilen ('-50') nach oben bewegen will.
Gerade weil wir alle in einem Boot sitzen, sollten wir froh sein, dass nicht alle auf unserer Seite sind
lichtkind
 2008-08-04 00:49
#113046 #113046
User since
2004-03-22
5709 Artikel
ModeratorIn + EditorIn
[Homepage]
user image
gefällt mir auch aber ich erzähl dir wie wir das machen. der goto line dialog ist ein standartdialog mit eingebautem validator. was der mir gibt wird niemals was anderes als zahlen enthalten. und ich mag grad wegen sowas mir eignen dialog bauen. ich plane aber iene kommandozeile in die man vim-artige befehle eigeben kann. dort würde es auch eher hinpassen weil d'nerds die sowas benutzen eher wissen was sie tun und der dialog nur für einfahce benutzung ist.

findest das nicht auch ideale lösung?
Wiki:Tutorien in der Wiki, mein zeug:
kephra, baumhaus, garten, gezwitscher

Es beginnt immer mit einer Entscheidung.
Gast Gast
 2008-08-04 00:57
#113047 #113047
lichtkind+2008-08-03 22:49:48--
gefällt mir auch aber ich erzähl dir wie wir das machen. der goto line dialog ist ein standartdialog mit eingebautem validator. was der mir gibt wird niemals was anderes als zahlen enthalten. und ich mag grad wegen sowas mir eignen dialog bauen. ich plane aber iene kommandozeile in die man vim-artige befehle eigeben kann. dort würde es auch eher hinpassen weil d'nerds die sowas benutzen eher wissen was sie tun und der dialog nur für einfahce benutzung ist.

findest das nicht auch ideale lösung?


Das finde ich gut. Kann man den auch ausblenden? So für Nicht-Nerds die trtzdem gerne gute Editoren mit bunten Klick-Dialogen benutzen?
lichtkind
 2008-08-04 01:43
#113048 #113048
User since
2004-03-22
5709 Artikel
ModeratorIn + EditorIn
[Homepage]
user image
sicher in kephra kannst sogar haupmenü ausblenden :)
Wiki:Tutorien in der Wiki, mein zeug:
kephra, baumhaus, garten, gezwitscher

Es beginnt immer mit einer Entscheidung.
lichtkind
 2008-08-16 02:29
#113561 #113561
User since
2004-03-22
5709 Artikel
ModeratorIn + EditorIn
[Homepage]
user image
die YAPC::EU in Kopenhagen war auch fuer Kephra fruchtbar. Adam Kennedz nahm den Patch von mir an, und ich kann den kleinen YAML::Tiny hack aus kephre wieder rausnehmen. auch will er in File::UserConfig ein feature einbauen weswegen ich Kephra bald auch direktaus dem svn dir aus testen kann und auch bessere und mehr tests schreiben kann.

Ja Gabor hat mit Padre auch seinen wxperl editor angefangen mal sehen. da gte dran ist das er die miniklasse fand mit der man scripte lokal im editor starten kann ud ergebnis angezeigt bekommt was ich unverzueglich, wenn ich wieder daheim bin und mein hauptmaschiene læuft, auch bei uns einbauen werde. Die magische Formel heisst Wx::Perl::ProcessStream.

soweit aus kopenhagen. morgen gibts noch kleinen hackathon und werd danach rueckreise antreten auf der ich auch unseren Designer besuchen werde und Kephra GUI fuer 0.4 letzten schliff bekommen wird. neue icons koennen ja schon in 0.3.9.13 bestaunt werden.
Wiki:Tutorien in der Wiki, mein zeug:
kephra, baumhaus, garten, gezwitscher

Es beginnt immer mit einer Entscheidung.
anti
 2008-08-21 09:19
#113793 #113793
User since
2003-11-29
155 Artikel
BenutzerIn
[default_avatar]
lichtkind+2008-08-16 00:29:46--
neue icons koennen ja schon in 0.3.9.13 bestaunt werden.


Wo gibts die neue Version? *habenwill*

anti
<< |< 1 ... 13 14 15 16 17 18 19 ... 54 >| >> 539 Einträge, 54 Seiten



View all threads created 2008-03-09 00:08.