Commits

Herbert Breunung committed 547b7c1

inlinexpm works now

Comments (0)

Files changed (2)

 		if ($code == 79 and $event->ControlDown){
 			$file = Wx::FileSelector('Open File ...', '.', '', '', '(*)|*', &Wx::wxFD_OPEN, $frame);
 			return unless $file and -r $file;
-			CORE::open my $FH, '<', $file;
+			open my $FH, '<', $file;
 			binmode($FH);
 			my $content = do { local $/; <$FH> };
 			if ($content) {
 		elsif ($code == 81 and $event->ControlDown){ $frame->Close }
 		elsif ($code == 83 and $event->ControlDown){
 			return unless $file and -w $file;
-			CORE::open my $FH, '> :raw :encoding('.$encoding.')', $file;
+			open my $FH, '> :raw :encoding('.$encoding.')', $file;
 			print $FH $ed->GetText();
 		} 
 		else { $event->Skip }
 	$frame->Show(1);
 	$app->SetTopWindow($frame);
 	1;
-}
+}
+__END__
+/* XPM */
+static char * edit_xpm[] = {
+"16 16 27 1",
+" 	c None",
+".	c #3B455E",
+"+	c #000000",
+"@	c #FFFFFF",
+"#	c #00C93C",
+"$	c #5ECB25",
+"%	c #FFFE9C",
+"&	c #32660D",
+"*	c #2A981B",
+"=	c #FEFECC",
+"-	c #FFC99A",
+";	c #FF9623",
+">	c #9F9FA2",
+",	c #9B6614",
+"'	c #525109",
+")	c #EDF0F4",
+"!	c #FEFEFE",
+"~	c #F0D5C5",
+"{	c #E5EAF0",
+"]	c #DDE3EB",
+"^	c #D4DBE5",
+"/	c #CCD5E1",
+"(	c #FBFBFC",
+"_	c #C4CFDC",
+":	c #BECAD9",
+"<	c #F5F6F9",
+"[	c #BAC6D6",
+"                ",
+" .......... ++  ",
+" .@@@@@@@@@+#$+ ",
+" .@@@@@@@@+%&*&+",
+" .@@@@@@@+=-;&+>",
+" .@@@@@@+%-;,+> ",
+" .@@@@@+=-;,+>  ",
+" .@@@@+%-;,+>>  ",
+" .@@@+=-;,+>+>  ",
+" .@@+=';,+>)+>  ",
+" .@@+!~++>{]+>  ",
+" .@@+++>>]^/+>  ",
+" .@(>>>]^/_:+>  ",
+" .<){]^/_:[[+>  ",
+" .+++++++++++>  ",
+"  >>>>>>>>>>>>  "};
 
 package InlineXPM;
 use Wx;
-use Wx::FS;
-use Wx::STC;
 use base qw(Wx::App);
 
 sub OnInit {
 	my $app   = shift;
 	my $frame = Wx::Frame->new( undef, -1, __PACKAGE__, [-1,-1], [1000,800]);
-	
-	#my $bitmap = Wx::Bitmap->newFromXPM( \@xpmdata ); 
-
-	Wx::MemoryFSHandler::AddTextFile( 'file.xpm', <<'EOB' );
-/* XPM */
-static char * proton_xpm[] = {
-"32 32 5 1",
-" 	c None",
-".	c #808080",
-"+	c #FFFFFF",
-"@	c #000000",
-"#	c #000080",
-"................................",
-"................................",
-"..++++++++++++++++++++++++++++@.",
-"..++++++++++++++++++++++++++++@.",
-"..++++++++++++++++++++++++++++@.",
-"..++++++++++++++++++++++++++++@.",
-"..+++#################++++++++@.",
-"..+++#################++++++++@.",
-"..++++++++++++++++++++++++++++@.",
-"..++++++++++++++++++++++++++++@.",
-"..+++###################++++++@.",
-"..+++###################++++++@.",
-"..++++++++++++++++++++++++++++@.",
-"..++++++++++++++++++++++++++++@.",
-"..+++###############++++++++++@.",
-"..+++###############++++++++++@.",
-"..++++++++++++++++++++++++++++@.",
-"..++++++++++++++++++++++++++++@.",
-"..+++###################++++++@.",
-"..+++###################++++++@.",
-"..++++++++++++++++++++++++++++@.",
-"..++++++++++++++++++++++++++++@.",
-"..+++################+++++++++@.",
-"..+++################+++++++++@.",
-"..++++++++++++++++++++++++++++@.",
-"..++++++++++++++++++++++++++++@.",
-"..+++##################+++++++@.",
-"..+++##################+++++++@.",
-"..++++++++++++++++++++++++++++@.",
-"..++++++++++++++++++++++++++++@.",
-"..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.",
-"................................"};
-EOB
-
-	Wx::InitAllImageHandlers();
-	my $bmp = Wx::Bitmap->new(32,32);
-	$bmp->LoadFile('../data/empty.xpm', &Wx::wxBITMAP_TYPE_XPM);
-	#$bmp->LoadFile('memory:file.xpm', &Wx::wxBITMAP_TYPE_XPM);
-
-	my $pic = Wx::StaticBitmap->new($frame, -1, $bmp); 
-	my $ed = Wx::TextCtrl->new($frame, -1,'');
-	
-
-
-	#$ed->LoadFile('../data/proton.xpm');
-	#$ed->LoadFile('memory:file.xpm');	
-
-	#while(<DATA>){ print;} 	#local $/='';#print <DATA>;
+	Wx::InitAllImageHandlers();
+	my $file = '../data/proton.xpm';
+	open my $FH, '<', $file; 
+	binmode($FH);
+	my @xpmfile = <$FH>;
+	@xpmfile = map { s/\r|\n|"|,//g; $_} @xpmfile;
+	shift @xpmfile;
+	shift @xpmfile;
+	my @xpmdata = <DATA>;
+	@xpmdata = map { s/\r|\n//g; $_} @xpmdata;
+	my $xpmhere = <<'EOB';
+32 32 5 1
+ 	c None
+.	c #808080
++	c #FFFFFF
+@	c #000000
+#	c #000080
+................................
+................................
+..++++++++++++++++++++++++++++@.
+..++++++++++++++++++++++++++++@.
+..++++++++++++++++++++++++++++@.
+..++++++++++++++++++++++++++++@.
+..+++#################++++++++@.
+..+++#################++++++++@.
+..++++++++++++++++++++++++++++@.
+..++++++++++++++++++++++++++++@.
+..+++###################++++++@.
+..+++###################++++++@.
+..++++++++++++++++++++++++++++@.
+..++++++++++++++++++++++++++++@.
+..+++###############++++++++++@.
+..+++###############++++++++++@.
+..++++++++++++++++++++++++++++@.
+..++++++++++++++++++++++++++++@.
+..+++###################++++++@.
+..+++###################++++++@.
+..++++++++++++++++++++++++++++@.
+..++++++++++++++++++++++++++++@.
+..+++################+++++++++@.
+..+++################+++++++++@.
+..++++++++++++++++++++++++++++@.
+..++++++++++++++++++++++++++++@.
+..+++##################+++++++@.
+..+++##################+++++++@.
+..++++++++++++++++++++++++++++@.
+..++++++++++++++++++++++++++++@.
+..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.
+................................
+EOB
+
+	my $bitmap = Wx::Bitmap->newFromXPM( \@xpmdata );
+	#my $bitmap = Wx::Bitmap->newFromXPM( [split("\r|\n", $xpmhere)] );
+	#my $bitmap = Wx::Bitmap->new($file, &Wx::wxBITMAP_TYPE_XPM);
+	my $bmp = Wx::StaticBitmap->new($frame, -1, $bitmap); 
+	my $ed = Wx::TextCtrl->new($frame, -1,'');
+	#$ed->AppendText($_) for @xpmdata;
+	$ed->AppendText($xpmhere) ;
 
 	my $sizer = Wx::BoxSizer->new(&Wx::wxVERTICAL);
-	$sizer->Add($pic, 0);
+	$sizer->Add($bmp, 0);
 	$sizer->Add($ed, 1, &Wx::wxGROW);
 	$frame->SetSizer($sizer);
 	$frame->Show(1);
 }
 
 __DATA__
-/* XPM */
-static char * edit_xpm[] = {
-"16 16 27 1",
-" 	c None",
-".	c #3B455E",
-"+	c #000000",
-"@	c #FFFFFF",
-"#	c #00C93C",
-"$	c #5ECB25",
-"%	c #FFFE9C",
-"&	c #32660D",
-"*	c #2A981B",
-"=	c #FEFECC",
-"-	c #FFC99A",
-";	c #FF9623",
-">	c #9F9FA2",
-",	c #9B6614",
-"'	c #525109",
-")	c #EDF0F4",
-"!	c #FEFEFE",
-"~	c #F0D5C5",
-"{	c #E5EAF0",
-"]	c #DDE3EB",
-"^	c #D4DBE5",
-"/	c #CCD5E1",
-"(	c #FBFBFC",
-"_	c #C4CFDC",
-":	c #BECAD9",
-"<	c #F5F6F9",
-"[	c #BAC6D6",
-"                ",
-" .......... ++  ",
-" .@@@@@@@@@+#$+ ",
-" .@@@@@@@@+%&*&+",
-" .@@@@@@@+=-;&+>",
-" .@@@@@@+%-;,+> ",
-" .@@@@@+=-;,+>  ",
-" .@@@@+%-;,+>>  ",
-" .@@@+=-;,+>+>  ",
-" .@@+=';,+>)+>  ",
-" .@@+!~++>{]+>  ",
-" .@@+++>>]^/+>  ",
-" .@(>>>]^/_:+>  ",
-" .<){]^/_:[[+>  ",
-" .+++++++++++>  ",
-"  >>>>>>>>>>>>  "};
+32 32 5 1
+ 	c None
+.	c #808080
++	c #FFFFFF
+@	c #000000
+#	c #000080
+................................
+................................
+..++++++++++++++++++++++++++++@.
+..++++++++++++++++++++++++++++@.
+..++++++++++++++++++++++++++++@.
+..++++++++++++++++++++++++++++@.
+..+++#################++++++++@.
+..+++#################++++++++@.
+..++++++++++++++++++++++++++++@.
+..++++++++++++++++++++++++++++@.
+..+++###################++++++@.
+..+++###################++++++@.
+..++++++++++++++++++++++++++++@.
+..++++++++++++++++++++++++++++@.
+..+++###############++++++++++@.
+..+++###############++++++++++@.
+..++++++++++++++++++++++++++++@.
+..++++++++++++++++++++++++++++@.
+..+++###################++++++@.
+..+++###################++++++@.
+..++++++++++++++++++++++++++++@.
+..++++++++++++++++++++++++++++@.
+..+++################+++++++++@.
+..+++################+++++++++@.
+..++++++++++++++++++++++++++++@.
+..++++++++++++++++++++++++++++@.
+..+++##################+++++++@.
+..+++##################+++++++@.
+..++++++++++++++++++++++++++++@.
+..++++++++++++++++++++++++++++@.
+..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.
+................................
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.