Package: mtoolsfm Version: 1.9-3-2 Severity: wishlist I think, my floppy formating frontend written with Perl/Gtk some time ago would be a good extension for mtoolsfm.
Gruss/Regards, Eduard. -- System Information Debian Release: 3.0 Architecture: i386 Kernel: Linux zombie 2.4.18 #2 Die Mär 12 18:52:25 CET 2002 i686 Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] Versions of packages mtoolsfm depends on: ii libc6 2.2.5-3 GNU C Library: Shared libraries an ii libglib1.2 1.2.10-4 The GLib library of C routines ii libgtk1.2 1.2.10-9 The GIMP Toolkit set of widgets fo ii mtools 3.9.8-7 Tools for manipulating MSDOS files ii xlibs 4.1.0-14pre15v3 X Window System client libraries -- Du musst einen Plan haben. Denn wenn Du keinen Plan hast, wirst Du zum Teil des Planes eines anderen ...
#!/usr/bin/perl # # Swiss knife, an allround tool for formating, copying, exploring the # content of floppy disks or making backups using them. # Copyright (C) 1999 Eduard Bloch ([EMAIL PROTECTED]) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # #language support will come later #2m-formats are not listen since i was too lazy to search for them. you #may add them if needed. #use Devel::ptkdb; eval 'use Gtk'; print"Please install Gtk-Library and the the Gtk-Perl-Module before using this tool" if $@; use POSIX; $mydir="$ENV{'HOME'}/.gsk"; mkdir ($mydir,0755); $dirtowork="$mydir"."/tmp"; mkdir ($dirtowork,0700); init Gtk; $hoehe = 340; $VERSION = "0.0.5"; if(-f "${mydir}/config") { #print "config auslesen" open config,"<${mydir}/config"; while(<config>) {$_ =~ s/\n|\r//g; $_ =~ s/ / /g; @temp = split(/ /,$_); @temp = split(/ /,$_); # hier noch was einbauen, um arrays zu speichern, # syntax:<arrayname>wert\nwert2\nwert3</arrayname> $var=$temp[0]; shift(@temp); ${$var}=(join(" ",@temp)); } close config; } else { $deflang = $ENV{'LC_ALL'}; $fsuffix=""; #anhang, hxxxx $fnum=0; $bb=0; $preffs="minix"; $verbose=1; $ll = 0; $disklabel = "Disk 1"; #$files = "~/shareware/vga/vgaread.exe"; } sub saveexit{ open config,">${mydir}/config"; print config " fsuffix $fsuffix fnum $fnum bb $bb preffs $preffs verbose $verbose ll $ll disklabel $disklabel fmenunum $fmenunum adsfopts $adsfopts "; close config; } @disk_xpm = ( '48 48 33 1', ' c #020305', '. c #020b03', 'X c #0e0d13', 'o c #16151f', 'O c #1f202f', '+ c #201a2e', '@ c #232137', '# c #25223a', '$ c #25273a', '% c #2c273f', '& c #312f48', '* c #383150', '= c #3e3a56', '- c #464558', '; c #4f4a67', ': c #535064', '> c #575b60', ', c #646179', '< c #6c6b7a', '1 c #787886', '2 c #7d8089', '3 c #898995', '4 c #9295a3', '5 c #9f9eab', '6 c #aaaaaa', '7 c #a4a5b8', '8 c #ada8c0', '9 c #b4b1c1', '0 c #c5c1d2', 'q c #ceced9', 'w c #eaeaed', 'e c Gray100', 'r c None', 'rrrrrrrrrrr4>,,,,,,<,,,243233323323323333233rrrr', 'rrrrrrrrrrr3=3r5r5234rr2oO%=<12112112><<<1<<>rrr', 'rrrrrrrrrrr3-5<<,,*<<9w<%$OXrqqqqqqqq>52322&o-rr', 'rrrrrrrrrrr2:4=;;=o;[EMAIL PROTECTED]&%%$Oo<r', 'rrrrrrrrrrr3>3;=;=+;5*&[EMAIL PROTECTED]>>w9-2&%%%$$.>r', 'rrrrrrrrrrr2;4=;=;9:[EMAIL PROTECTED]>>wq-2%%%$$%.>r', 'rrrrrrrrrrr3:3=*=w03=2&%#%#@@+orX>[EMAIL PROTECTED]>r', 'rrrrrrrrrrr1;1#1w7<93-,&[EMAIL PROTECTED]>>w0-1&%##$$.>r', 'rrrrrrrrrrr,&&0q3o<w0,<;[EMAIL PROTECTED]@@+oX>>wq-2###@@@X>r', 'rrrrrrrrrr4&1w05 ->[EMAIL PROTECTED]@[EMAIL PROTECTED]>r', 'rrrrrrrrr2&rw888:%>>qq0&2%#@@++++X4qq-1##@@OOX>r', 'rrrrrrrr>-qq47890O&><[EMAIL PROTECTED]@+++o +++2@@+++O.>r', 'rrrrrr5-,w04477900X>-2w02::[EMAIL PROTECTED]@[EMAIL PROTECTED]>r', 'rrrrr3%2w074478000rX>>wq7#>@+O+Oo++XX#O@@+++O.>r', 'rrrr,&req9744489000<-qw1&3-@@++++oooXo++O+++o.>r', 'rr5->84wq9744780qq0q39>-3&@@+O =<:ooo +O+Oo+O.>r', '51$103;<w074478800q0r-<<$$@@+ =;;3&ooX Xo%+o+.>r', '2&40&;;;3q444780qq04&2>[EMAIL PROTECTED];;,,;[EMAIL PROTECTED];<$+o.>r', ':09:*o;;;804488000<[EMAIL PROTECTED];,qw0,,1oXoX#1&oo.>r', '>0;;;#@,;;0848800-:2&&%#OX*;1weeeq;,,oXX >&oo.>r', '-<7=;=+&;;,q8787%2,&%#%+X=;4eeeeee9;1=oXXXOoo.>r', '4%51;=*o=,;1q81*2;&&#%oo;;0eeeeeeee4;3OXXX Xo.>r', 'r3%9,=;*o;;;74=3=*&%%X$;,weeeeeeeeee1;3oXX XX.>r', 'rr<=0;=*&@;;;31**&&# =;3weeeeeeeeeeeq,,1 XX X.>r', 'rrr-,8=;*@&;4,**&&+X-;8eeeeeeeeeeeeee0;,;X .>r', 'rrr5*34==*+#;**&&X+;,qeeeeeeeeeeeeeeee7;2&X .<r', 'rrrr4&9,;*****&#o&;1weeeeeeeeeeeeeeeeee2;3oX Or', 'rrrr51;8,*=***#o=;4weeeeeeeeeeeeeeeeeeew,,1X . 2', 'rrrrrr;=8;****#=;8eeeeeeeeeeeeeeeeeeeeeew;,, 2r', 'rrrrrr7=,7****+;,qeeeeeeeeeeeeeeeeeeeeeee0;,o.>r', 'rrrrrrr4%71***o=,qeeeeeeeeeeeeeeeeeeeeeeew<@ .>r', 'rrrrrrrr2*0;**&o;1eeeeeeeeeeeeeeeeeeeeeew2o .>r', 'rrrrrrrr7,;0=*&@o;7eeeeeeeeeeeeeeeeeeeeq<.X .>r', 'rrrrrrrrr7=18**&o%;9eeeeeeeeeeeeeeeeeer- %X .>r', 'rrrrrrrrrr5$44&&&X=,weeeeeeeeeeeeeeee3$X%$X .>r', 'rrrrrrrrrrr4$8,%&%X-1weeeeeeeeeeeeew<o...... .>r', 'rrrrrrrrrrr5<=0;&&#X;3eeeeeeeeeeee0>.X........>r', 'rrrrrrrrrrrrr-,8*%%+@;9eeeeeeeeeer-o<2222222225r', 'rrrrrrrrrrrrr5&<7&%#o&:qeeeeeeew3X-rrrrrrrrrrrrr', 'rrrrrrrrrrrrrr4%21&$%X-,weeeeeq<X>rrrrrrrrrrrrrr', 'rrrrrrrrrrrrrrr1%7;[EMAIL PROTECTED];1eeee9-.3rrrrrrrrrrrrrrr', 'rrrrrrrrrrrrrrrr>-9*%#oo;4ee4%Orrrrrrrrrrrrrrrrr', 'rrrrrrrrrrrrrrrrr=:5###o%;8<X>rrrrrrrrrrrrrrrrrr', 'rrrrrrrrrrrrrrrrr4%<[EMAIL PROTECTED]>rrrrrrrrrrrrrrrrrrr', 'rrrrrrrrrrrrrrrrrr2$5,@@X o3rrrrrrrrrrrrrrrrrrrr', 'rrrrrrrrrrrrrrrrrrr,%7-X.$rrrrrrrrrrrrrrrrrrrrrr', 'rrrrrrrrrrrrrrrrrrrr-Oo.>rrrrrrrrrrrrrrrrrrrrrrr', 'rrrrrrrrrrrrrrrrrrrrr123rrrrrrrrrrrrrrrrrrrrrrrr' ); sub len{ $_about = "About"; $_format = "Format"; $_copy = "Copy"; $_devf = "Device"; $_fsf = "Filesystem"; $_cfs = "Creat"; $_formatnow = "format now!"; #print "blabla"; $_options = "Options"; $_blocks = "Check for badblocks"; $_summe = "Be verbose"; $_special = "Advanced options"; #define a better message @mis_fd = ( "Error!", "Couldn't find any floppy devices or couldn't acces them! Check read/write permissions to the /dev/fd*-files", "Exit"); @mis_fdutil = ( "Error!", "Some tools from the fdutils couldn't be found in your path. Please make sure fdutils are installed and check your paths. Check also if you have read/write acces to the /dev/fd* files.", "Exit"); $_pformat = "format physicaly?"; #return "Language: English(default)"; } $lang = "len"; &{$lang}; #end of the language part #define floppy formats and compabilities @formats = ( #syntax: floppy-device, name-entry, format-comptability, device-compability # 1->standard, 2->quasi-standard, 3->non-standard, 0->not available #devices: 1:5.25-dd, 2:5.25-hd, 3:3.5-dd, 4:3.5-hd, 5:3.5-ed #0 "", "default",1,12345, "d360","360KB",1,1, "h360","360KB",1,2, "h410","410KB (mc+ms/c?)",3,2, #x "h420","420KB (mc+ms/c?)",3,2, #x "h720","720KB (qd)",3,2,#x "h880","880KB (qd+mss?)",3,2,#x "h1200","1200KB",1,2, "h1440","1440KB (ui)",2,2, "h1476","1476KB (mc)",2,2, "h1494","1494KB (mc)",2,2, #10 "h1600","1600KB (mss)",3,2, "u360","360KB (?)",3,345, "u720","720KB",1,345, "u800","800KB (ms/c)",2,345, "u820","820KB (mc+ms/c?)",3,345, "u830","830KB (mc+ms/c?)",2,345, "u1040","1040KB (2m?)",3,5, "u1120","1120KB (qd)",3,5, "u1440","1440KB",1,45, "u1600","1600KB (ms/c?)",2,45, #20 "u1680","1680KB (ui)",2,45, "u1722","1722KB (ms/c?)",2,45, "u1743","1743KB (mc)",2,45, "u1760","1760KB (ls)",3,45, "u1840","1840KB (mss)",3,45, "u1840 hd tracksize=23b mss 2m","1840KB (2m)",3,45, "u1920","1920KB (mss)",3,45, "u2880","2880KB",1,5, "u3200","3200KB (ms/c?)",2,5, #3360 "u3520","3520KB (ls)",3,5, #3680 "u3840","3840KB (mss)",3,5, ); #Since mformat is not able to recognice the correct disk size without an #existing msdos-bootsector, this may be a problem after using an other #fs. A possible fix could be to provide mformat with args for the #default formats, but I am too lazy to implement it yet. Just reformat #the disk physicaly or fix it if you want to. @dse=("msdos","minix","ext2"); sub dse_menu { my $menu = new Gtk::Menu(); foreach(@dse){my $temp=$_; my $menuitem = new Gtk::MenuItem $temp; $menuitem->signal_connect("activate", => sub {$preffs = $temp}); $menuitem->show; $menu->append($menuitem); } return $menu; } sub not_imp { my $hbox = new Gtk::HBox(0,0); my $label = new Gtk::Label "NOT IMPLEMENTED YET"; $label->show; $hbox->pack_start($label, 0,0,0); $hbox->show; #$_->pack_start($hbox,0,0,0); return $hbox; } sub create_dmenu { my $menu = new Gtk::Menu(); foreach(0..$#floppies) {my $menuitem = new Gtk::MenuItem "/dev/fd". $_ ." (" . $floppies[$_] .")"; my $fdtyp = $fdt[$_]; my $temp=$_; $menuitem->signal_connect("activate", =>sub {$format->set_menu(create_fmenu($fdtyp)); $fnum=$temp}); $menuitem->show; $menu->append($menuitem); } $menu->show; #$fdtyp = $fdt[0]; return $menu; } sub create_fmenu { ($parm1) = @_; $fdtyp = $parm1 if($parm1); my $temp=0; undef $menu; my $menu = new Gtk::Menu(); undef @menge; for(0..30) #vergleich des floppy-types, liste der kompatiblen bilden { my $i=$_; my $j= ($i*4)+3; if($formats[$j]=~ /$fdtyp/){push(@menge, $i)} } for(1,2,3) {#formate sortieren, standards, quasi-standards, non-standards $stufe=$_; if($_ != 1) {my $menuitem = new Gtk::MenuItem ($stufe==2 ? "-- often compatible formats --" : "-- less compatible formats --");my $temp_=$temp; $menuitem->signal_connect("activate", =>sub {$format->set_menu(create_fmenu(@last_pars));$fmenunum=$temp_}); $menuitem->show;$temp++; $menu->append($menuitem); }; for(@menge) { my $i=($_*4) ,my $j=($_*4)+1;$k=$j+1;my $temp_=$temp;#print $formats[$k], "\n"; if($formats[$k]==$stufe) { my $menuitem = new Gtk::MenuItem $formats[$j]; #print "addmenu", $j, "\n";#, $formats[j]; $menuitem->show; $menuitem->signal_connect("activate", =>sub {#print $j, "\n"; $fsuffix=$formats[$i];$fmenunum=$temp_; #print $i; }); $temp++; $menu->append($menuitem); } } } return $menu; } sub showmes{ # fuettern mit title, text, [pixmap], button1, funktion 1, button2, fuktion2 usw., (mglw. spaeter ein # icon, werde ich wohl dann irgendwie reinbasteln #my (@opts, $window, $label, $button, $box, $hbox, $vbox); @opts = @_; $window = new Gtk::Window('toplevel'); $window->set_name("meldung"); $window->set_title("$opts[0]"); $window->set_uposition(500, 20); $box = new Gtk::VBox(0, 0); $vbox = new Gtk::HBox( 0,0); #hier noch das pixmap "reinflicken", abfragen, dann shiften #"v" in vbox ignorieren, zufaellig reingerutscht, trotzdem vertikal $label = new Gtk::Label "$opts[1]"; $label->show; $vbox->pack_start($label, 1,1,5); $vbox->show; $box->pack_start($vbox, 0,0,0); $hbox = new Gtk::HBox(0,0); for($i=2;$i<$#opts;$i+=2){ $button = new Gtk::Button("$opts[$_]"); my $meswert=$_; my $func=$_+1; signal_connect $button "clicked"=> sub # { # if($err==1) # {Gtk->exit(0);} # else {print $opts[$func] }; # }; $hbox->pack_start($button, 1,1,5); show $button; } $hbox->show; $box->pack_start($hbox, 1,1,5); $box->show; $window->add($box); $window->signal_connect( 'destroy', \&Gtk::Widget::destroyed, \$window ); $window->show; } #showmes(1,"etwas text, asdfasdf ",3,4,5,6,7,8,9,10); sub fswahl #rebuild the command line with changed options { @al=(a..z); if($preffs=~ /dos/i) { $formcmd=($verbose ? "minfo $al[$fnum]:\n" : "\n"); } else { $formcmd="echo ".($bb?"Searching for bad blocks and c":"C")."reating a filesystem, please wait... && /sbin/mkfs.".($preffs=~ /minix/i ? "minix" : "ext2 -L \"$disklabel\"").($bb ? " -c " : " ")." $msdosopts /dev/fd".$fnum.($preffs=~ /minix/i ? "\n":($verbose ? "\n/sbin/dumpe2fs /dev/fd$fnum\n" : " ")); } # print $formcmd,"\n"; } sub formatnow { #open(sfout,"system superformat -f 2>&1|"); #showmes("titel", "test: suffix = $fsuffix") #unless($slave = fork){ #system "xterm -e $comline &"; #sleep 2; #exit; #Gtk->exit(0); #&do_exit; #Gtk::main_quit; #} #print "\n\n$slave\n"; &fswahl; $comline= ($ll ? "superformat ".(($bb && $preffs=~/dos/i)?"-B":"-f")." /dev/fd" . $fnum . $fsuffix : "")." $adsfopts"; #check msdos-options, decide the right flag and drive $temp = time; open(work, ">$dirtowork/starter"); print work $comline,"\n"; print work $formcmd, "\n"; print work "echo Created by Eduard Bloch, http://www.eduard.bloch.com/gsk/\n"; print work ($verbose ? "echo Press RETURN to continue...\nread\n" : "sleep 3"); close(work); chmod 0700, "$dirtowork/starter"; system "xterm -e $dirtowork/starter &"; } sub do_exit {&saveexit;Gtk->exit(0);} sub create_notebook { my($notebook); my($hbox, $label); $notebook = new Gtk::Notebook; $notebook->set_tab_pos(-top); $notebook->border_width(3); $notebook->append_page( create_form_page() ); #$notebook->append_page( create_copy_page() ); $notebook->append_page( create_set_page()); return $notebook; } sub objects_menu { my ($rw)[EMAIL PROTECTED]; #my $gz="| gzip"; #my $guz="| gzip -d"; #my $bz="| bzip2"; #my $buz="| bzip2 -d"; #fill the source/targetmenu with objects my @objects,$driveitem; @abc=(A..Z); foreach(0..$#floppies) { my $driveitem = "/dev/fd$_ (\"$abc[$_]:\", "."$floppies[$_])"; push(@objects,$driveitem,"dd ".($read?"i":"o")."f=/dev/fd$_"); } push(@objects,(($read)[EMAIL PROTECTED]:@wap)); # append kommt aus den gespeicherten daten my $omenu = new Gtk::Menu(); for($j=0;$j<$#objects;$j+=2) { # my $temp=$objects[$j].": ".$objects[$j+1].$objects[$j+2]; print $objects[$j]."\n"; my $menuitem = new Gtk::MenuItem $objects[$j]; # $menuitem->signal_connect("activate", => sub {$preffs = $temp}); $menuitem->show; $omenu->append($menuitem); }; return $omenu; } sub create_copy_page{ #Diskcopy-Page my $dslabel = new Gtk::Label( "Diskcopy" ); my $dcbox= new Gtk::VBox(0,0); #haupt-box $dcbox->border_width(0); #starting source-frame my $sc_frame = new Gtk::Frame "Source"; $sc_frame->border_width(3); $sc_frame->show; $dcbox->pack_start($sc_frame, 1,1,5); #analog zu formbox my $box1 = new Gtk::VBox(0,0); $box1->border_width( 2 ); $sc_frame->add($box1); $box1->show; $boxoben = new Gtk::HBox(1,0); $box1->pack_start($boxoben,1,1,5); $source_menu = new Gtk::OptionMenu; $source_menu->set_menu(objects_menu); $boxoben->pack_start($source_menu,1,1,5); $source_menu->show; $reignore = new Gtk::CheckButton "ignore read errors"; $reignore->signal_connect("clicked", sub {}); $boxoben->pack_start($reignore,1,1,5); $reignore->show; $boxoben->show; my $boxunten = new Gtk::HBox(1,0); $box1->pack_start($boxunten,1,1,5); $boxunten->show; $preformbtn = new Gtk::CheckButton "read while writing"; $preformbtn->signal_connect("clicked", sub {}); $boxunten->pack_start($preformbtn,1,1,5); $preformbtn->show; my $readbutton = new Gtk::Button "READ!"; $boxunten->pack_start($readbutton,1,1,5); $readbutton->show; my $tr_frame = new Gtk::Frame "Target"; $tr_frame->border_width(3); $tr_frame->show; $dcbox->pack_start($tr_frame, 1,1,5); $dcbox->show; my $box2 = new Gtk::VBox(0,0); $tr_frame->add($box2); $box2->show; $boxoben = new Gtk::HBox(1,0); $box2->pack_start($boxoben,1,1,5); $target_menu = new Gtk::OptionMenu; $target_menu->set_menu(objects_menu(src)); $boxoben->pack_start($target_menu,1,1,5); $target_menu->show; $weignore = new Gtk::CheckButton "ignore write errors"; $weignore->signal_connect("clicked", sub {}); $boxoben->pack_start($weignore,1,1,5); $weignore->show; $boxoben->show; $boxunten = new Gtk::HBox(1,0); $box2->pack_start($boxunten,1,1,5); $boxunten->show; $preformbtn = new Gtk::CheckButton "format before writing"; $preformbtn->signal_connect("clicked", sub {}); $boxunten->pack_start($preformbtn,1,1,5); $preformbtn->show; $okbutton = new Gtk::Button "WRITE!"; $okbutton->signal_connect("clicked", sub { $adsfopts=($sfentry->get_text); destroy $adsf_window}); $boxunten->pack_start($okbutton,1,1,5); $okbutton->show; #status-bar $stbar=new Gtk::Statusbar; $stbar->push( 1, "Don't use this, nothing works correctly"); $stbar->show; $dcbox->pack_end($stbar,1,1,3);#??? return ($dcbox, $dslabel); }; sub create_form_page{ #starting format-page my $fbox = new Gtk::VBox(0,0); $fbox->border_width(0); my $box = new Gtk::VBox( 0, 0 ); $box->border_width( 2 ); #starting low-level-format-frame my $dev_frame = new Gtk::Frame ( $_devf . " / " . $_format ); $dev_frame->border_width(1); $formbox = new Gtk::VBox 1,0; $lw = new Gtk::HBox 1,0; $drv = new Gtk::OptionMenu; $drv->set_menu(create_dmenu()); $drv->set_history($fnum); $drv->show; $lw->pack_start($drv, 1,1,5); #checkbutton fur ll-format $pform = new Gtk::CheckButton $_pformat; $pform->set_active(1); $pform->signal_connect("clicked", => sub { $ll =($pform->active); $format->set_sensitive($ll); $format->set_menu(create_fmenu); $sforms->set_sensitive($ll)}); $pform->show; $lw->pack_start($pform, 1,1,5); $lw->show; $formate = new Gtk::HBox 1,0; $format = new Gtk::OptionMenu; $format->set_menu(create_fmenu($fdtyp)); $format->set_history($fmenunum); $format->show; $formate->pack_start($format, 1,1,5); $sforms = new Gtk::Button $_special; $sforms->signal_connect("clicked", => \&adsf_opts); $sforms->show; $formate->pack_start($sforms, 1,1,7); $formate->show; # $format->set_sensitive(0); # $sforms->set_sensitive(0); # $pform->set_active(1); $pform->clicked if !$ll; $formbox->pack_start($lw, 1,1,5); $formbox->pack_start($formate, 1,1,5); $formbox->show; $dev_frame->add($formbox); $box->pack_start($dev_frame,1,1,5); #starting filesystem-frame $fs_frame = new Gtk::Frame ($_fsf); $fs_frame->border_width(1); $fs_box = new Gtk::HBox 1,0; $fsbox1 = new Gtk::VBox 1,0; $optionsf = new Gtk::OptionMenu; $optionsf->set_menu(dse_menu); $optionsf->set_history($preffs=~/dos/ ?"0":($preffs=~/mini/?"1":"2")); $optionsf->show; $fsbox1->pack_start($optionsf, 1,1,5); $fsopts = new Gtk::Button $_options; signal_connect $fsopts "clicked", msdos_opts; $fsopts->show; $fsbox1->pack_start($fsopts, 1,1,5); $fsbox1->show; $fs_box->pack_start($fsbox1, 1,1,5); $fsbox2 = new Gtk::VBox 1,0; $blocks = new Gtk::CheckButton $_blocks; $blocks->set_active($bb); signal_connect $blocks "clicked", sub {$bb = ($blocks->active)}; $blocks->show; $fsbox2->pack_start($blocks, 1,1,5); $summe = new Gtk::CheckButton $_summe; $summe->set_active($verbose); signal_connect $summe "clicked", sub {$verbose = ($summe->active)}; $summe->show; $fsbox2->pack_start($summe, 1,1,5); $fsbox2->show; $fs_box->pack_start($fsbox2, 0,1,0); $fs_frame->add($fs_box); $fs_frame->show; $box->pack_start($fs_frame, 1,1,5); $fbox->pack_start($box, 1,1,0); $button = new Gtk::Button $_formatnow; $button->can_default; # $button->grab_default; $button->border_width(5); # $button->set_usize(200,40); $fbox->pack_start($button, 0,0,0 ); signal_connect $button "clicked", \&formatnow; $fbox->show_all(); my $label = new Gtk::Label( $_format ); return ($fbox, $label); } sub create_set_page{ my $cbox = new Gtk::VBox(0,0); $cbox->border_width(0); $cbox->show; $pixmap = new Gtk::Pixmap $disk_logo, $disk_open_mask; my $hbox = new Gtk::HBox(0,0); $hbox->pack_start($pixmap,1,1,1); $pixmap->show; my $gsklabel = new Gtk::Label "gSwissKnife\n\nhttp://www.eduard.bloch.com/gsk"; $hbox->pack_start($gsklabel,1,1,1); $gsklabel->show; my $alabel = new Gtk::Label "About"; $alabel->show; $hbox->show; return ($hbox, $alabel); }; sub destroy_window { my($widget, $windowref, $w2) = @_; $$windowref = undef; $w2 = undef if defined $w2; 0; } sub adsf_opts { my($box1,$boxoben,$boxunten,$sfentry,$hbutton,$okbutton); if (not defined $adsf_window) { $adsf_window = new Gtk::Window "toplevel"; $adsf_window->set_name("fs-options window"); $adsf_window->signal_connect("destroy", \&destroy_window, \$adsf_window); $adsf_window->signal_connect("delete_event", \&destroy_window, \$adsf_window); $adsf_window->set_title("superformat options"); # $adsf_window->set_uposition(40, 40); # $adsf_window->set_usize(300, 150); $adsf_window->border_width(0); $box1 = new Gtk::VBox(0,0); $adsf_window->add($box1); $box1->show; $boxoben = new Gtk::HBox(0,0); $box1->pack_start($boxoben,1,1,2); $sflabel = new Gtk::Label "superformat ".(($bb && $preffs=~/dos/i)?"-B":"-f")." /dev/fd".$fnum.$fsuffix; $sflabel->set_alignment(0,0); $boxoben->pack_start($sflabel,1,1,0); $sflabel->show; $sfentry= new Gtk::Entry; $boxoben->pack_start($sfentry,1,1,0); $sfentry->set_text("$adsfopts"); $sfentry->show; $boxoben->show; $boxunten = new Gtk::HBox(0,0); $box1->pack_start($boxunten,1,0,2); $boxunten->show; $hbutton = new Gtk::Button "Help"; $hbutton->signal_connect("clicked", sub {system "gnome-help-browser man:superformat&" || system "xterm -e man superformat&"}); $boxunten->pack_start($hbutton,1,0,2); $hbutton->show; $okbutton = new Gtk::Button "Ok"; $okbutton->signal_connect("clicked", sub { $adsfopts=($sfentry->get_text); destroy $adsf_window}); $boxunten->pack_start($okbutton,1,0,2); $okbutton->show; } if (!visible $adsf_window) { show $adsf_window; } else { destroy $adsf_window; } } sub msdos_opts { my ($boxa, $boxb, $box1, $box2, $button, $cancel, $labeltext, $table, $opttext,$labelentry,$optentry); if (not defined $msdos_window) { $msdos_window = new Gtk::Window "toplevel"; $msdos_window->set_name("fs-options window"); $msdos_window->signal_connect("destroy", \&destroy_window, \$msdos_window); $msdos_window->signal_connect("delete_event", \&destroy_window, \$msdos_window); $msdos_window->set_title("filesystem options"); # $msdos_window->set_uposition(40, 40); # $msdos_window->set_usize(300, 150); $msdos_window->border_width(0); $box1 = new Gtk::VBox(0,0); $msdos_window->add($box1); $box1->show; $table = new Gtk::Table(3,2,0); # $table->set_row_spacing(0,3); # $table->set_row_spacing(1,3); # $table->set_col_spacing(1,5); $box1->pack_start($table,1,0,2); $table->show; $labeltext = new Gtk::Label "Disk label:"; Gtk::Misc::set_alignment($labeltext,0,0); $labeltext->set_justify("left"); $table->attach($labeltext, 0,1,0,1,{expand=>1,fill=>0},{expand=>1,fill=>0},0,0); $labeltext->set_alignment(0,0); show $labeltext; $labelentry = new Gtk::Entry; $labelentry->set_text("$disklabel"); # $labelentry->grab_default; $labelentry->select_region(0, length($labelentry->get_text)); $table->attach($labelentry, 1,2,0,1,{expand=>1,fill=>1},{expand=>1,fill=>1},3,2); show $labelentry; $opttext = new Gtk::Label "other options:"; $table->attach($opttext, 0,1,1,2,{expand=>1,fill=>1},{expand=>1,fill=>1},3,2); $opttext->set_alignment(0,0); show $opttext; $optentry = new Gtk::Entry; $optentry->set_text("$msdosopts"); $table->attach($optentry, 1,2,1,2,{expand=>1,fill=>1},{expand=>1,fill=>1},3,2); show $optentry; $boxb = new Gtk::HBox(0,0); $box1->pack_start($boxb,1,1,0); $boxb->show; $cancel = new Gtk::Button "Cancel"; $cancel->signal_connect("clicked", sub {destroy $msdos_window}); $table->attach_defaults($cancel,0,1,2,3); # $boxb->pack_start($cancel, 1, 1, 0); $cancel->can_default(1); $cancel->show; $button = new Gtk::Button "Ok"; $button->signal_connect("clicked", sub { $disklabel=($labelentry->get_text); #print $disklabel; $msdosopts=($optentry->get_text); destroy $msdos_window}); # $boxb->pack_start($button, 1, 1, 0); $table->attach_defaults($button,1,2,2,3); $button->can_default(1); $button->grab_default; $button->show; } if (!visible $msdos_window) { show $msdos_window; } else { destroy $msdos_window; } } sub create_main_window { $window = new Gtk::Window('toplevel'); $window->set_name("main window"); $window->set_title("Swiss knife"); # $window->set_uposition(40, 40); $window->set_usize(350, 340); $window->signal_connect("destroy" => \&Gtk::main_quit); $window->signal_connect("delete_event" => \&Gtk::false); $window->realize; ($disk_logo, $disk_open_mask) = Gtk::Gdk::Pixmap->create_from_xpm_d($window->window, undef, @disk_xpm); $box1 = new Gtk::VBox(0, 0); $window->add($box1); $box1->show; my $buffer = "WARNING: This is alpha-software, use it at your own risk. \n©gsk-" . $VERSION . ", found " . ($#floppies+1) ." floppy device(s)"; $top = new Gtk::Label $buffer; show $top; $box1->pack_start($top, 0, 0, 0); #$notebook->append_page_menu($child, $label_box, $menu_box); my $notebook = create_notebook(); $box1->pack_start($notebook, 1, 1, 0); $notebook->show; $separator = new Gtk::HSeparator; $box1->pack_start($separator, 0, 1, 0); $separator->show; $box3 = new Gtk::HBox(0, 10); $box3->border_width(3); $box1->pack_start($box3, 0, 1, 0); $box3->show(); $helpb = new Gtk::Button "Exit"; signal_connect $helpb "clicked", Gtk::main_quit; #sub #{$exbutton->set_sensitive(0)}; $box3->pack_start($helpb,1,1,0); $helpb->show; $exbutton = new Gtk::Button 'Save & Exit'; signal_connect $exbutton "clicked", \&do_exit; $box3->pack_start($exbutton, 1, 1, 0); # $button->can_default(1); # $button->grab_default(); $exbutton->show; $window->show; } #starting the main script if (system"which superformat >/dev/null" and system"which floppycontrol") {$err = 1; showmes(@mis_fdutil)} else { RAUS: for(0..7){ undef $ask; $num = $_; $ask = "floppycontrol /dev/fd" . "$num" . " -T 2>/dev/null"; if($temp = `$ask`) { next RAUS if($temp=~/.*nul.*/); push(@floppies, $temp); } } #$temp=0; foreach(@floppies){ #$fdnum= "fdt" . $temp; $_ =~ s/\n//g; if($_ =~ /28/) {push @fdt,5} if($_ =~ /14/) {push @fdt,4} if($_ =~ /72/) {push @fdt,3} if($_ =~ /12/) {push @fdt,2} if($_ =~ /36/) {push @fdt,1} } if($#floppies lt 0) {showmes(@mis_fd, '\$do_exit')} $fdtyp = $fdt[$fnum]; # print $fdtyp; create_main_window($#floppies+1); } main Gtk;