App-PLab

 view release on metacpan or  search on metacpan

bin/ManCen  view on Meta::CPAN

package CenWindow;
use vars qw(@ISA);
@ISA = qw(App::PLab::Calibrations);

# WIN

sub win_inidefaults
{
   my $w = $_[0];
   return (
      $w-> SUPER::win_inidefaults,
      forwardLookup   => 0,
      lookupEnabled   => 0,
      StdPointerShape => 0,
   );
}


sub win_newframe
{
   my $w = $_[0];
   $w-> SUPER::win_newframe;
   return unless defined $w-> {file};

   $w-> win_extwarn if defined $w-> {ini}-> {path} &&
      defined $w-> {oldPath} && $w-> {oldPath} ne $w-> {ini}-> {path};
   $w-> {oldPath} = $w-> {ini}-> {path};

   my $cenname = $w-> win_extname( $w-> {file});
   if ( open F, "< $cenname") {
      $w-> {points} = $w-> rpt_read( *F);
      close F;

bin/ManCen  view on Meta::CPAN

      $w-> IV-> repaint;
      Prima::MsgBox::message("Queue processed", mb::OK|mb::Information);
   } elsif ( defined $jump) {
      $w-> {ambiguity} = \@ambiguity if $w-> win_loadfile( $jump) && scalar(@ambiguity);
   }   
}   

sub win_closeframe
{
   my $w = $_[0];
   $w-> SUPER::win_closeframe;
   $w-> rpt_clear();
}

sub win_framechanged
{
   my $w = $_[0];
   $w-> SUPER::win_framechanged;
   $w-> sb_points();
   $w-> win_untemp(0);
}

sub win_newextras
{
   my $w = $_[0];
   $w-> SUPER::win_newextras;

   my $cenname = $w->{ini}-> {forwardLookup} ? $w-> {nextFile} : $w-> {prevFile};
   if ( defined $cenname) {
      $cenname = $w-> win_extname( $cenname);
      if ( open F, "< $cenname") {
         $w-> {extraPoints} = $w-> rpt_read( *F);
         close F;
      }
   }
}

sub win_closeextras
{
   my $w = $_[0];
   $w-> SUPER::win_closeextras;
   $w-> rptex_clear();
}

sub win_extraschanged
{
   my $w = $_[0];
   $w-> win_untemp;
   $w-> SUPER::win_extraschanged;
   $w-> sb_points();
}


sub win_extpathchanged
{
   my $w = $_[0];
   if ( defined $w-> {file}) {
      my $i;
      my @pt = defined $w-> {points} ? @{$w->{points}} : ();

bin/ManCen  view on Meta::CPAN

      $w-> win_newextras;
      $w-> win_extraschanged;
      $w-> IV-> repaint;
   }
}

sub on_create
{
   my $self = $_[0];
   my $w    = $_[0];
   $self-> SUPER::on_create;
   $self-> {dataExt} = 'cen';

   $self-> win_pointerchanged();
   my $scale = $::application-> uiScaling;
   $scale = 1 if $scale < 1;

   my $tb  = $self-> ToolBar;
   my $cck = $tb-> insert( Label =>
      origin      => [ 120 * $scale, 1],
      size        => [ $tb-> width - 138 * $scale, 36 * $scale],

bin/ManCen  view on Meta::CPAN

       'Points'      => [ cl::LightGreen, 'Points'],
       'ExtraPoints' => [ cl::LightRed,   'Crosses'],
       'Pointer'     => [ cl::Black,      'Cursor and selection'],
       'Label'       => [ cl::Black,      'Label'],
    }
}

sub opt_keys
{
   return {
      %{$_[0]-> SUPER::opt_keys()},
      EditClearPoints  => [ kb::NoKey,      'Remove all points'],
      EditToggleLookup => [ kb::Space,      'Turn on or off neighbour points lookup'],
      HelpAbout        => [ kb::NoKey,      'Standard about box'],
      HelpPlabApps     => [ kb::NoKey,      'Online PlabApps overview'],
      HelpContents     => [ kb::NoKey,      'Online ManCen overview'],
   }   
}

sub opt_propcreate
{
   my ( $w, $dlg, $nb, $nbpages) = @_;
   $w-> SUPER::opt_propcreate( $dlg, $nb, $nbpages);
   my $mh = 0;
   for ( $nbpages-> widgets_from_page(1)) {
      my $y = $_-> top;
      $mh = $y if $mh < $y;
   }
   $nb-> insert_to_page( 1, CheckBox =>
       origin => [ 10,  $mh + 10],
       size   => [ 300, 36],
       text   => 'Default ~cursor shape',
       name   => 'CursorShape',

bin/ManCen  view on Meta::CPAN

       size   => [ 300, 36],
       text   => '~Display neighbour .cen',
       name   => 'LookupEnabled',
       hint   => 'Draws next or previous data points with crosses',
   ]);
}

sub opt_proppush
{
   my ( $w, $dlg, $nb, $nbpages) = @_;
   $w-> SUPER::opt_proppush( $dlg, $nb, $nbpages);
   $nbpages-> CursorShape-> checked( $w->{ini}->{StdPointerShape});
   $nbpages-> ForwardLookup-> checked( $w->{ini}->{forwardLookup});
   $nbpages-> LookupEnabled-> checked( $w->{ini}->{lookupEnabled});
}

sub opt_proppop
{
   my ( $w, $dlg, $nb, $nbpages, $mr) = @_;
   $w-> SUPER::opt_proppop( $dlg, $nb, $nbpages, $mr);
   if ( $mr) {
      $w->{ini}->{StdPointerShape} = $nbpages-> CursorShape-> checked;
      $w-> win_pointerchanged;
      my $newlookup = $nbpages-> ForwardLookup-> checked;
      if ( $newlookup != $w->{ini}->{forwardLookup}) {
         $w->{ini}->{forwardLookup} = $newlookup;
         $w-> ToolBar-> Lookup-> repaint;
         if ( $w->{file}) {
            $w-> win_closeextras;
            $w-> win_newextras;

bin/ManCen  view on Meta::CPAN


   if ( $btn == mb::Right && !$self->{transaction} && defined $w-> rpt_is( $self-> screen2point( $x, $y))) {
      $w-> {lastPopupPoint} = [$self-> screen2point( $x, $y)];
      $w-> iv_cancelmode( $self);
      $self-> PointPopup-> popup( $self-> pointerPos);
      $self-> clear_event;
      return;
   }   
               

   $w-> SUPER::IV_MouseDown( $self, $btn, $mod, $x, $y);
   return unless $self-> eventFlag;


   if ( $btn == mb::Left && !$self->{transaction}) {
      my ( $ax, $ay) = $self-> screen2point( $x, $y);
      if ( $ax >= 0 && $ay >= 0 && $ax < $w->{IVx} && $ay < $w->{IVy}) {
         if ( $w-> rpt_toggle( $ax, $ay)) {
            $self-> begin_paint;
            $self-> color( $w->{ini}->{Color_Points});
            my $p = ( 6 * $self-> zoom < 1) ? 1 : ( 6 * $self-> zoom);

bin/ManCen  view on Meta::CPAN

      $r[2] = $x;
      $r[3] = $y;
      @r[0,2] = @r[2,0] if $r[0] > $r[2];
      @r[1,3] = @r[3,1] if $r[1] > $r[3];
      @r = $self-> screen2point( @r);
      $w-> rpt_exclude( @r);
      $self-> repaint;
      return;
   }

   $w-> SUPER::IV_MouseUp( $self, $btn, $mod, $x, $y);
}

sub IV_MouseMove
{
   my ( $w, $self, $mod, $x, $y) = @_;

   if ( $self->{transaction} && $self->{transaction} == 4) {
      $w-> IV_xorrect( $self);
      $self-> {xorData}-> [2] = $x;
      $self-> {xorData}-> [3] = $y;
      $w-> IV_xorrect( $self);
      $self-> clear_event;
   }

   $w-> SUPER::IV_MouseMove( $self, $mod, $x, $y);
}

sub IV_Paint
{
   my ( $w, $self, $canvas) = @_;
   $self-> on_paint( $canvas);
   my $wl = $w-> {points};
   my $z = $self-> zoom;
   my $p = ( 6 * $z < 1) ? 1 : ( 6 * $z);
   $canvas-> translate( $self-> point2screen( 0, 0));

bin/MorphometryI  view on Meta::CPAN

   $self-> {ini}-> {'LW'.$self-> {currentSet}} = $width;
   $self-> sb_text("Line width set:$width");
}

sub win_inidefaults
{
   my $w = $_[0];
   my $calcopt = '';
   vec( $calcopt, 0, 32) = ocq::Files | ocq::Basics;
   return (
      $w-> SUPER::win_inidefaults,
      RecWindowPos     => '100 100',
      RecWindowVisible => 0,
      UFThreshold      => 40,
      BinThreshold     => 128,
      EdgeSize         => 3,
      MinArea          => 0,
      MaxArea          => 0,
      LW0              => 1,
      LW1              => 1,
      LW2              => 3,

bin/MorphometryI  view on Meta::CPAN

      FrameColor       => 0,
      InvertImage      => 0,
   );
}


sub on_create
{
   my $self = $_[0];

   $self-> SUPER::on_create;

   my $w = $self;
   $w-> {dataExt} = 'xml';
   my $i = $w-> {ini};
   my $xref = [
      ['*0' => "~Features"   => \&win_objectsetsmenuaction],
      ['1'  => "~Background" => \&win_objectsetsmenuaction],
      ['2'  => "~Remove"     => \&win_objectsetsmenuaction],
      [],
      [ LineWidthIncrement =>  '~Increase line width' => sub {

bin/MorphometryI  view on Meta::CPAN

       borderWidth => 1,
   );
   $iv-> {drawmode} = $cck-> checked ? 1 : undef;
   init_convex( $w->{ini}->{NumberOfRotations});
}

sub on_destroy
{
   my ($w,$i) = ($_[0],$_[0]->{ini});
   $i-> {RecWindowVisible} = defined $w-> {recWindow} ? 1 : 0;
   $w-> SUPER::on_destroy;
}

sub win_closeframe
{
   my $w = $_[0];
   $w-> SUPER::win_closeframe;
   $w-> pt_clear_all();
   $w-> rpt_clear();
}

sub win_framechanged
{
   my $w = $_[0];
   $w-> SUPER::win_framechanged;
   $w-> {mirrorImage} = undef;
   my $i = $w-> IV-> image;
   my $canApply = defined $i && $i-> type == im::Byte;
   $w-> menu-> EditToggleMode-> enabled( defined $i);
   $w-> menu-> EditApplyContours-> enabled( $canApply);
   $w-> menu-> EditValidate-> enabled( defined $i);
   $w-> menu-> EditImport-> enabled( defined $i);
   $w-> ToolBar-> Contours-> enabled( defined $i);
   if ( $w-> {recWindow}) {
      my $r = $w-> {recWindow};

bin/MorphometryI  view on Meta::CPAN

   if ($@) {
      $w-> win_xmlerror( $xmlname);
      return 0;
   }
   return \%state;
}   

sub win_newframe
{
   my $w = $_[0];
   $w-> SUPER::win_newframe;

   return unless defined $w-> {file};

   $w-> win_extwarn if defined $w-> {ini}-> {path} &&
      defined $w-> {oldPath} && $w-> {oldPath} ne $w-> {ini}-> {path};
   $w-> {oldPath} = $w-> {ini}-> {path};

   
   my $img = $w-> IV-> image;
   

bin/MorphometryI  view on Meta::CPAN

      }
      return 0 if Prima::MsgBox::message(
         "Error saving file $xmlname. Ignore changes?", mb::YesNo|mb::Warning) == mb::No;
   }
   return 1;
}

sub win_newextras
{
   my $w = $_[0];
   $w-> SUPER::win_newextras;

   return unless defined $w-> {prevFile};
   my $num = $w->{cypherMask};
   my $xmlname;
   my ( $min, $max) = $w-> win_getseriesrange;
   $xmlname = $w-> win_formfilename( $min);
   $xmlname = $w-> win_extname( $xmlname);

   return unless -f $xmlname;

bin/MorphometryI  view on Meta::CPAN

   }
   return unless $x; # no contours to import
   $w-> pt_updatemenu;
   $w-> IV-> repaint;
   $w-> modified(1);
}   

sub win_closeextras
{
   my $w = $_[0];
   $w-> SUPER::win_closeextras;
   $w-> rptex_clear();
}

sub win_extraschanged
{
   my $w = $_[0];
   $w-> SUPER::win_extraschanged;
   $w-> menu-> EditOptCalib-> enabled( defined $w-> {nextFile} || defined $w-> {prevFile});
}


# WIN_END
# OPT

sub opt_colors
{
   return {

bin/MorphometryI  view on Meta::CPAN


sub opt_colormount
{
   my $w = $_[0];
   $w-> IV-> {bone}-> backColor( $w-> {ini}-> {$w-> {setColors}->[$w-> {currentSet}]});
}

sub opt_keys
{
   return {
      %{$_[0]-> SUPER::opt_keys()},
      EditImport    => [ kb::NoKey , "Import another contours into document"],
      EditOptCalib  => [ kb::NoKey , "Recalculate series"],
      EditCalcStats => [ '@C'      , "Calculate and display statistics"],
      Undo1         => [ kb::Backspace , "Undo drawing"],
      Undo2         => [ km::Alt|kb::Backspace , "Undo group of lines"],
      Undo3         => [ '@U'          , "Show undo dialog"],
      EditInvertImage => [ kb::NoKey   , "Invert image"],
      EditClearAll  => [ kb::NoKey     , "Clear all drawings"],
      EditRemovePoints   => [ kb::NoKey     , "Remove all points"],
      EditToggleMode     => [ 'F11'     , "Toggle drawings/points mode"],

bin/MorphometryI  view on Meta::CPAN

          '(([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?\*)', cl::Red],
   );

   $dlg-> select;
}


sub opt_propcreate
{
   my ( $w, $dlg, $nb, $nbpages) = @_;
   $w-> SUPER::opt_propcreate( $dlg, $nb, $nbpages);
   $nb-> tabs( @{$nb-> tabs}, 'Calculations', 'Frame');
   $nb-> insert_to_page( $nb-> pageCount - 2,
      [ Label =>
        text     => 'By default, only the area, the perimeter, the formfactor and centroid locations are calculated,though the program is perfectly capable of calculating all other parameters.  The reason for disabling the rest is that it normally ta...
        wordWrap => 1,
        designScale => [ $nbpages-> font-> width, $nbpages-> font-> height],
        valignment => ta::Top,
        name       => 'TopText',
    ],[ CheckBox =>
        origin => [ 5, 185],

bin/MorphometryI  view on Meta::CPAN

      $nbpages-> LineWidth-> value( $dlg-> {page2}-> {widths}-> [ $_[0]-> focusedItem]);
      $nbpages-> {deprecate} = undef;
   });
}

my %widcolors = ( Features => 1, Background => 1, Remove => 1);

sub opt_proppush
{
   my ( $w, $dlg, $nb, $nbpages) = @_;
   $w-> SUPER::opt_proppush( $dlg, $nb, $nbpages);
   my $nbc = $nbpages-> pageIndex;
   $nbpages-> pageIndex(3);
   for ( qw( CalcBrightness EqualBrightness CalcConvex CalcHoles)) {
      $nbpages->bring($_)->checked( $w->{ini}->{$_});
   }   
   $nbpages-> CalcBrightness-> notify(q(Check)); # force dependent disablements
   $nbpages-> CalcHoles->      notify(q(Check)); 
   for ( qw( HolesPercent NumberOfRotations)) {
      $nbpages->bring($_)->value( $w->{ini}->{$_});
   }   

bin/MorphometryI  view on Meta::CPAN

   $widths[$ids{Remove}]     = $w-> {ini}-> {LW2};
   $dlg-> {page2}-> {widths} = \@widths;
   $nbpages-> LineWidth-> value( $widths[ $nbpages-> NameSel-> focusedItem]);
   $nbpages-> FrameWidth-> value( $w-> {ini}-> {FrameWidth});
   $nbpages-> FrameColor-> index( $w-> {ini}-> {FrameColor} ? 1 : 0);
}

sub opt_proppop
{
   my ( $w, $dlg, $nb, $nbpages, $mr) = @_;
   $w-> SUPER::opt_proppop( $dlg, $nb, $nbpages, $mr);
   if ( $mr) {
      for ( qw( EqualBrightness CalcBrightness CalcConvex CalcHoles)) {
         $w->{ini}->{$_} = $nbpages-> bring($_)-> checked;
      }   
      for ( qw( HolesPercent NumberOfRotations)) {
         $w->{ini}->{$_} = $nbpages-> bring($_)-> value;
      }   
      my $i = 0;
      my %colors = %{$w-> opt_colors}; 
      my %ids    = map { ( $_ , $i++ ) } keys %colors;

bin/MorphometryI  view on Meta::CPAN

   $_[0]-> {extraPoints} = undef;
}

# RPT_END
# IV

sub IV_MouseDown
{
   my ( $w, $self, $btn, $mod, $x, $y) = @_;

   $w-> SUPER::IV_MouseDown( $self, $btn, $mod, $x, $y);
   return unless $self-> eventFlag;

   $self-> clear_event, return if $btn != mb::Left;

   if ($self->{transaction}) {
      if ( $self->{transaction} == 2) {
         my ( $ax, $ay) = $self-> screen2point( $x, $y);
         $self-> {transaction} = 1;
         $w-> pt_add( $ax, $ay);
         $w-> sb_text( "Freehand: $ax $ay");

bin/MorphometryI  view on Meta::CPAN

      $w-> iv_cancelmode( $self) if $self-> {transaction} == 2;
      $self-> clear_event;
      return;
   }
}

sub IV_MouseUp
{
   my ( $w, $self, $btn, $mod, $x, $y) = @_;
   return unless $self->{transaction};
   $w-> SUPER::IV_MouseUp( $self, $btn, $mod, $x, $y);
   return unless $self-> eventFlag;
   if ( $btn == mb::Left and $self-> {transaction} == 1) {
      $self-> {transaction} = 2;
      $self-> {xors} = undef;
      $w-> sb_text("Lineplot:");
      $self-> clear_event;
   }
}

sub IV_MouseMove

bin/MorphometryI  view on Meta::CPAN

   unless ( $self->{transaction}) {
      if (( $mod & km::Shift) && defined $self-> image) {
         my $i = $self-> image;
         my $pix = $i-> pixel( $self-> screen2point( $x, $y));
         $w-> sb_text((( $i-> type & im::BPP) > 8) ?
            sprintf("%02x %02x %02x", ($pix>>16)&0xFF, ($pix>>8)&0xFF, $pix&0xFF) :
            $pix
         ) if $pix != cl::Invalid;
      }
   }
   $w-> SUPER::IV_MouseMove( $self, $mod, $x, $y);
   return unless $self-> eventFlag && $self-> {transaction};
   if ( $self-> {transaction} == 1) {
      my ( $x1, $y1) = $self-> point2screen( @{$w-> pt_lines->[-1]}[-2,-1]);
      $w-> pt_add( $self-> screen2point( $x, $y));
      $self-> begin_paint;
      $self-> color( $w-> {ini}-> {$w->{setColors}->[$w->{currentSet}]});
      $self-> lineWidth( $self-> zoom * $w-> {ini}-> {'LW'.$w->{currentSet}});
      $self-> line( $x, $y, $x1, $y1);
      $self-> end_paint;
      $w-> sb_text("Freehand: $x1 $y1");

bin/MorphometryI  view on Meta::CPAN

         $canvas-> line( $x * $z - $p, $y * $z - $p, $x * $z + $p, $y * $z + $p);
         $canvas-> line( $x * $z + $p, $y * $z - $p, $x * $z - $p, $y * $z + $p);
      }
   }
}

sub iv_cancelmode
{
   my ( $w, $self) = @_;
   my $t = $self->{transaction};
   $w-> SUPER::iv_cancelmode( $self);
   $w-> pt_close() if $t;
}

sub iv_togglemode
{
   my ( $w, $self) = @_;
   return if !$ImageApp::testing and !defined $self-> image;
   $w-> iv_cancelmode( $self);
   $self-> {drawmode} = defined $self-> {drawmode} ? undef : 1;
   $w-> ToolBar-> Contours-> checked( defined $self-> {drawmode});

bin/MorphometryI  view on Meta::CPAN

}

# IV_END

package PropRollup;
use vars qw(@ISA);
@ISA = qw(Prima::Dialog);

sub profile_default
{
   my $def = $_[ 0]-> SUPER::profile_default;
   my %prf = (
       borderIcons => bi::SystemMenu | bi::TitleBar,
       width => 207,
       height => 306,
       sizeDontCare => 0,

       text => 'Parameters',
       visible => 0,
   );
   @$def{keys %prf} = values %prf;
   return $def;
}

sub init
{
   my $self = shift;
   my %profile = $self-> SUPER::init(@_);

   my $image = Prima::Icon->create( width=>16, height=>16, type => im::bpp1,
     palette => [ 0,0,0,0,0,0],
     data =>
     "\x01\x00\x00\x00A\x08\x00\x00\!\x10\x00\x00\x10 \x00\x00\x07\xc0\x00\x00".
     "\x080\x00\x001\x88\x00\x00C\xc0\x00\x00\x03\xc4\x00\x00\!\x88\x00\x00".
     "\x18p\x00\x00\x07\x80\x00\x00\x10\x10\x00\x00\!\x08\x00\x00A\x04\x00\x00".
     "\x01\x00\x00\x00".
   '');

bin/MorphometryI  view on Meta::CPAN

   my $self = $_[0];
   my $w = $self-> owner;
   $w-> {recWindow} = undef;
   my $i = $w-> {ini};
   $i-> {RecWindowPos}  = join( ' ', $self-> origin);
   $i-> {UFThreshold} = $self-> Union-> value;
   $i-> {BinThreshold} = $self-> Binary-> value;
   $i-> {EdgeSize} = $self-> Edge-> value;
   $i-> {MinArea}  = $self-> Min-> value;
   $i-> {MaxArea}  = $self-> Max-> value;
   $self-> SUPER::cleanup();
}

package Run;

my $wfil = App::PLab::ImageAppWindow::winmenu_file();
splice( @{$$wfil[1]}, -2, 0,
   [],
   [ EditImport      => "~Import contours" => q(win_importextras)],
   [ '-EditOptCalib' => "~Recalculate series"  => q(opt_changecalib)],
   [ EditCalcStats   => "~Calculate statistics"  => q(opt_statistics)],

bin/PrAverB  view on Meta::CPAN

}

package AveWindow;
use vars qw(@ISA);
@ISA = qw(App::PLab::ImageAppWindow);

sub win_inidefaults
{
   my $w = $_[0];
   return (
      $w-> SUPER::win_inidefaults,
      PropShowMode    => '1',
   );
}


sub on_create
{
   my $self = $_[0];
   my $w    = $_[0];
   $self-> SUPER::on_create;
   $self-> {dataExt} = 'pab';
   $w-> {selectedRect} = undef;
   $w-> {rects} = [];

   $w-> insert( Popup =>
      autoPopup => 0,
      selected => 0,
      name => 'FigurePopup',
      items => [
         ['~Duplicate' => 'Ctrl+D' => kb::NoKey => q(win_figdup)],

bin/PrAverB  view on Meta::CPAN

         onClick   => sub { $w-> win_printframe(0); },
         %btn_profile,
      ],
   );
}


sub win_closeframe
{
   my $w = $_[0];
   $w-> SUPER::win_closeframe;
   $w-> fig_clear();
}

sub win_newextras
{
   my $w = $_[0];
   $w-> SUPER::win_newextras;

   my $pabname = $w-> win_extname( $w->{file});
   if ( open F, "< $pabname") {
      $_ = <F>;
      return unless /Average\sbrightness\sdata/;
      return unless /extinfo/;
      my $i;
      LOOP: while (<F>) {
         my $comments;
         chomp;

bin/PrAverB  view on Meta::CPAN

   my ( $w) = @_;
   $w-> fig_clear;
   $w-> IV-> repaint;
   $w-> pointer( cr::Default);
   $w-> modified( 1);
}

sub win_framechanged
{
   my $w = $_[0];
   $w-> SUPER::win_framechanged;
   $w-> menu-> FilePrint-> enabled( defined $w-> {file});
   $w-> menu-> FileSave-> enabled( defined $w-> {file});
   $w-> ToolBar-> FilePrint-> enabled( defined $w-> {file});
   $w-> ToolBar-> FileSave-> enabled( defined $w-> {file});
}

# FIG

sub fig_clear
{

bin/PrAverB  view on Meta::CPAN

         $self-> capture( 1);
         $self-> {anchor} = [ $x, $y];
         $self-> {xorData} = [ $x, $y, $x, $y, $x, $y, $x, $y];
         $w-> IV_xorrect( $self);
         $self-> clear_event;
         $w-> sb_text( "Draw a region");
         return;
      }
   }

   $w-> SUPER::IV_MouseDown( $self, $btn, $mod, $x, $y);
   return unless $self-> eventFlag;

   $self-> clear_event;
}


sub IV_MouseClick
{
   my ( $w, $self, $btn, $mod, $x, $y, $dbl) = @_;

bin/PrAverB  view on Meta::CPAN

      }
   }
}


sub IV_MouseUp
{
   my ( $w, $self, $btn, $mod, $x, $y) = @_;

   return unless $self->{transaction};
   $w-> SUPER::IV_MouseUp( $self, $btn, $mod, $x, $y);
   return unless $self-> eventFlag;


   if ( $self->{transaction} == tran::init && $btn == mb::Left) {
      $self-> {transaction} = undef;
      $self-> capture( 0);
      $w-> IV_xorrect( $self);
      $self-> clear_event;
      if ( $self-> {anchor}->[0] != $x && $self-> {anchor}->[1] != $y) {
         my $ix = $w-> fig_add( $self-> screen2point( @{$self-> {xorData}}));

bin/PrAverB  view on Meta::CPAN

         $self-> clear_event;
         return;
      }
   }
}

sub IV_MouseMove
{
   my ( $w, $self, $mod, $x, $y) = @_;

   $w-> SUPER::IV_MouseMove( $self, $mod, $x, $y);
   return unless $self-> eventFlag;

   if ( $self->{transaction} && $self->{transaction} == tran::init) {
      $w-> IV_xorrect( $self);
      $self-> {xorData}-> [3] = $y;
      $self-> {xorData}-> [4] = $x;
      $self-> {xorData}-> [5] = $y;
      $self-> {xorData}-> [6] = $x;
      $w-> IV_xorrect( $self);
      $self-> clear_event;

bin/PrAverB  view on Meta::CPAN

{
   return {
     'Selection'  => [ cl::Gray, 'Selection'],
     'AreaBorder' => [ cl::Cyan, 'Area border'],
   };
}

sub opt_keys
{
   return {
      %{$_[0]-> SUPER::opt_keys()},
      FileSave       => [ kb::F2,              'Save frame layout'],
      FilePrint      => [ '^P',                'Print current frame layout'],
      EditDuplicate  => [ '^D',                'Duplicate selected rectange'], 
      EditDelete     => [ kb::Delete       ,   'Delete selected rectange'], 
      EditDeleteAll  => [ kb::NoKey        ,   'Delete all rectanges'], 
   },
}


# OPT_END

bin/PrLenS  view on Meta::CPAN

package LenWindow;
use vars qw(@ISA);
@ISA = qw(App::PLab::Calibrations);

use constant MAXDATASET => 5;

sub win_inidefaults
{
   my $w = $_[0];
   return (
      $w-> SUPER::win_inidefaults,
      PointSize          => 4,
      nLines             => 6,
      autoCrispen        => 0,
      autoStretch        => 0,
      StatisticsWindowRect => '120 120 400 250',
      StatisticsWindowFont => 0,
      SpectrumMin        => 0,
      SpectrumMax        => 50,
      ShowExtras         => 0,
      ShowPrevExtras     => 0,

bin/PrLenS  view on Meta::CPAN

      ( map { ( "dataset_${_}_name", "dataset" . ($_+1) ) } 2 .. MAXDATASET ),
      visible_datasets   => 0xffff,
   );
}


sub on_create
{
   my $self = $_[0];
   my $w    = $_[0];
   $self-> SUPER::on_create;
   $self-> {dataExt}            = 'pls';
   
   my $tb  = $self-> ToolBar;
   my $scale = $::application-> uiScaling;
   $scale = 1 if $scale < 1;

   my %btn_profile = (
     glyphs      => 1,
     text        => "",
     selectable  => 0,

bin/PrLenS  view on Meta::CPAN

{
   my $w = $_[0];
   $w-> reset_mark_state( 0) if defined $w-> {file};
   $w-> reset_mark_state( undef) unless defined $w-> {file};
}


sub win_newframe
{
   my $w = $_[0];
   $w-> SUPER::win_newframe;
   for ( @{$w->{layers}}) {
      my $c = ucfirst $_;
      $w-> {$_} = [];
      $w-> {"ex$c"} = [];
      $w-> {"prevex$c"} = [];
      $w-> {"n$c"} = $w-> {"total$c"} = 0;
   }
   $w-> {branches} = [];
   $w-> modified(0);
   $w-> reset_mark_state; 

bin/PrLenS  view on Meta::CPAN


   $w-> win_extwarn if defined $w-> {ini}-> {path} &&
      defined $w-> {oldPath} && $w-> {oldPath} ne $w-> {ini}-> {path};
   $w-> {oldPath} = $w-> {ini}-> {path};
   $w-> preprocess;
}

sub win_loadfile
{
   my ($w,$file) = @_;
   return 0 unless $w-> SUPER::win_loadfile( $file);
   $w-> update_state;
   return 1; 
}

sub win_newextras
{
   my $w = $_[0];
   $w-> SUPER::win_newextras;

   return unless defined $w-> {file};
   $w-> load_info();
}

sub win_saveframe
{
   my $w = $_[0];
   return $w-> save_info();
}

sub win_closeframe
{
   my $w = $_[0];
   $w-> SUPER::win_closeframe;
   $w-> reset_mark_state;
}


sub win_framechanged
{
   my $w = $_[0];
   $w-> SUPER::win_framechanged;

   my $tb = $w-> ToolBar;
   my $i = $w-> IV-> image;
   my $canApply = defined $i && $i-> type == im::Byte;

   $w-> menu-> FileStats-> enabled( $i);
   $w-> menu-> FileBackup-> enabled( $i);
   $w-> menu-> EditProcess-> enabled( $canApply);   
   $w-> menu-> EditProcessSeries-> enabled( $canApply);   
   $tb-> MarkCells-> enabled( $i);

bin/PrLenS  view on Meta::CPAN

         }
         $w-> show_stats( undef, 1);
      }
      $self-> clear_event;
      return;
   }
   
   if ( $btn == mb::Right && ($mod & km::Ctrl)) {
      $mod &= !km::Ctrl;
   }
   $w-> SUPER::IV_MouseDown( $self, $btn, $mod, $x, $y); 
}

sub IV_MouseMove
{
   my ( $w, $self, $mod, $x, $y) = @_;

   unless ( $self->{transaction}) {
      if (( $mod & km::Shift) && defined $self-> image) {
         my $i = $self-> image;
         my $pix = $i-> pixel( $self-> screen2point( $x, $y));
         $w-> sb_text((( $i-> type & im::BPP) > 8) ?
            sprintf("%02x %02x %02x", ($pix>>16)&0xFF, ($pix>>8)&0xFF, $pix&0xFF) :
            $pix
         ) if $pix != cl::Invalid;
      }
   }
   
   $w-> SUPER::IV_MouseMove( $self, $mod, $x, $y);

   return if !defined $w-> {binfo} || !defined $w-> {markState} || $w-> {markState} != 16;

   if ( $w->{ binfo}->{ drawMode} == 1) {
      my ( $bn) = $w->{ binfo}->{ branchNumber};
      my ( $ox, $oy) = @{ $w->{ branches}->[ $bn]->[ -1]};
      my ( $ax, $ay) = $self-> screen2point( $x, $y);
      my ( $ms) = $self->get_mouse_state;
      if ( ( scalar( @{ $w->{ branches}->[ $bn]}) == 1) || ( ( $ms & mb::Left) == mb::Left)) {
         push @{ $w->{ branches}->[ $bn]}, [ int($ax), int($ay)];

bin/PrLenS  view on Meta::CPAN

      'Branches'      => [ cl::LightGreen, 'Branches'],
      'ActiveProcess' => [ 0x80FF80,       'Active process'],
      'Cells'         => [ cl::LightRed,   'Cells'],
      ( map { ( "Dataset$_", => [ cl::White / $_,   $i->{"dataset_${_}_name"}] ) } 2 .. MAXDATASET )
   };
}

sub opt_keys
{
   return {
      %{$_[0]-> SUPER::opt_keys()},
      EditAutoCrispening => [ kb::Space,           'Automatically crispen the image'],
      EditAutoStretching => [ km::Ctrl|kb::Space,  'Automatically stretch the image color spectrum'],
      EditProcess        => [ '^A',                'Markup processes automatically'],
      EditProcessSeries  => [ kb::NoKey,           'Markup series of processeses automatically'],
      EditRecSetup       => [ '@R',                'Display recognition setup dialog'],
      FileStats          => [ '@S',                'Invoke statistic data dialog'],
      FileBackup         => [ kb::NoKey,           'Backup current series data'],
      HelpAbout          => [ kb::NoKey,           'Standard about box'],
      HelpPlabApps       => [ kb::NoKey,           'Online PlabApps overview'],
      HelpContents       => [ kb::NoKey,           'Online PrLenS overview'],
   },
}

sub opt_propcreate
{
   my ( $w, $dlg, $nb, $nbpages) = @_;
   $w-> SUPER::opt_propcreate( $dlg, $nb, $nbpages);
   $nb-> tabs( @{$nb-> tabs}, 'Stretching');
   $nb-> insert_to_page( 1, [ SpinEdit =>
       origin => [ 10, 105],
       width  => 120,
       name   => 'nLines',
       min    => 2,
       max    => 20,
       hint   => 'Amount of lines in the grid',
   ] , [ Label =>
       origin => [ 10, 125],

bin/PrLenS  view on Meta::CPAN

          $w-> {ini}-> {SpectrumMax} = $slider-> {max};
          $w-> preprocess;
          $w-> IV-> repaint;
       },
   ]);  
}

sub opt_proppush
{
   my ( $w, $dlg, $nb, $nbpages) = @_;
   $w-> SUPER::opt_proppush( $dlg, $nb, $nbpages);
   $nbpages-> nLines-> value( $w->{ini}->{nLines});
   $nbpages-> PointSize-> value( $w->{ini}->{PointSize});
   $nbpages-> Datasets-> value( $w->{ini}->{active_datasets});
   $nbpages-> ShowExtras-> checked( $w-> {ini}-> {ShowExtras});
   $nbpages-> ShowPrevExtras-> checked( $w-> {ini}-> {ShowPrevExtras});
   my $hs = $nbpages-> Hyperset;
   $hs-> items( [ map { ucfirst } @{$w->{layers}} ]);
   $hs-> vector( pack( 'I*', $w->{ini}-> {visible_datasets}));
   my $ssl = $nbpages-> StretchSlider;
   $ssl-> {saveMin} = $ssl-> {min} = $w->{ini}->{SpectrumMin};

bin/PrLenS  view on Meta::CPAN

   }
   my $pi = $nbpages-> pageIndex;
   $nbpages-> pageIndex( 4);
   $nbpages-> StretchPreview-> enabled( defined($w-> {file})); 
   $nbpages-> pageIndex( $pi);
}

sub opt_proppop
{
   my ( $w, $dlg, $nb, $nbpages, $mr) = @_;
   $w-> SUPER::opt_proppop( $dlg, $nb, $nbpages, $mr);
   my $ssl = $nbpages-> StretchSlider;
   if ( $mr) {
      $w->{ini}->{nLines} = $nbpages-> nLines-> value;
      $w->{ini}->{PointSize} = $nbpages-> PointSize-> value;
      my $ad = $w->{ini}->{active_datasets};
      $w->{ini}->{active_datasets} = $nbpages-> Datasets-> value;
      if ( $ad != $w->{ini}->{active_datasets}) {
         $w-> modified(1) if defined $w-> {file};
         $w-> reset_mark_state( 0) if defined $w-> {markState} && $w-> {markState} >= $w->{ini}->{active_datasets};
         $w-> {layers} = [ map { $w-> {ini}-> {"dataset_${_}_name"}} 0 .. $w->{ini}->{active_datasets} - 1];

lib/App/PLab/Calibrations.pm  view on Meta::CPAN

package App::PLab::Calibrations;
use vars qw(@ISA);
@ISA = qw(App::PLab::ImageAppWindow);


sub win_inidefaults
{
   my $w = $_[0];
   my @rc = $w-> rect;
   return (
      $w-> SUPER::win_inidefaults,
      XCalibration => 1.0,
      YCalibration => 1.0,
   );
}


sub opt_propcreate
{
   my ( $w, $dlg, $nb, $nbpages) = @_;
   my @nbpages = @{$nb-> tabs};
   $nb-> set(
      tabs      => [ @nbpages, 'Calibrations'],
      pageCount => scalar(@nbpages) + 1,
   );
   my $pg = $nb-> pageCount;

   $w-> SUPER::opt_propcreate( $dlg, $nb, $nbpages);
# Calibrations
   my %spinPrf = (
      size     => [ 265, 20],
      min      => 0.0001,
      max      => 10,
      step     => 0.01,
   );
   $nb-> insert_to_page( $pg, [
      SpinEdit =>
      origin => [ 5, 65],

lib/App/PLab/Calibrations.pm  view on Meta::CPAN

      size      => [ 265, 20],
      autoWidth => 0,
      text      => '~Size of 1 vertical pixel, mkm',
      focusLink => $nbpages-> YC,
   ]);
}

sub opt_proppush
{
   my ( $w, $dlg, $nb, $nbpages) = @_;
   $w-> SUPER::opt_proppush( $dlg, $nb, $nbpages);
# Calibrations
   $nbpages-> XC-> value($w->{ini}->{XCalibration});
   $nbpages-> YC-> value($w->{ini}->{YCalibration});
}

sub opt_proppop
{
   my ( $w, $dlg, $nb, $nbpages, $mr) = @_;
   $w-> SUPER::opt_proppop( $dlg, $nb, $nbpages, $mr);
# Calibrations
   if ( $mr) {
      my ( $xc, $yc) = ( $nbpages-> XC->value, $nbpages-> YC->value);
      $w-> modified( 1) if
         $w->{ini}->{XCalibration} != $xc ||
         $w->{ini}->{XCalibration} != $yc;
      $w->{ini}->{XCalibration} = $xc;
      $w->{ini}->{YCalibration} = $yc;
   }
}

lib/App/PLab/ImageApp.pm  view on Meta::CPAN

use App::PLab::ImageAppGlyphs;
no Prima::StartupWindow;

package App::PLab::SerOpenDialog;
use vars qw(@ISA);
@ISA = qw(Prima::ImageOpenDialog);

sub init
{
   my $self = shift;
   my %profile = $self-> SUPER::init(@_);

   my $dl = $self-> Files;

   my %pf = (
      name  => 'Files',
      rect  => [ $dl-> rect],
      items => $dl-> items,
      designScale => undef,
      delegations => [ @{$dl-> delegations}, $self, 'DrawItem', 'MeasureItem'],
   );

lib/App/PLab/ImageApp.pm  view on Meta::CPAN

   $self-> clear_event;
}

package  App::PLab::TrDeviceBitmap;
use vars qw(@ISA);
@ISA = qw(Prima::DeviceBitmap);

sub translate
{
   unless ( $#_) {
      my @a = $_[0]-> SUPER::translate;
      if ( $_[0]-> {override}) {
         $a[$_] -= $_[0]-> {override}->[$_] for 0,1;
      }
      return @a;
   }
   my ( $self, $trx, $try) = @_;
   if ( $self-> {override}) {
      $trx += $self-> {override}-> [0];
      $try += $self-> {override}-> [1];
   }
   $self-> SUPER::translate( $trx, $try);
}

sub clipRect
{
   unless ( $#_) {
      my @a = $_[0]-> SUPER::clipRect;
      if ( $_[0]-> {override}) {
         $a[$_]   -= $_[0]-> {override}->[$_] for 0,1;
         $a[$_+2] -= $_[0]-> {override}->[$_] for 0,1;
      }
      return @a;
   }
   my ( $self, $trx, $try, $tax, $tay) = @_;
   if ( $self-> {override}) {
      $trx += $self-> {override}-> [0];
      $try += $self-> {override}-> [1];
      $tax += $self-> {override}-> [0];
      $tay += $self-> {override}-> [1];
   }
   $self-> SUPER::clipRect( $trx, $try, $tax, $tay);
}

package App::PLab::MagnifyingGlassWidget;
use vars qw(@ISA);
@ISA = qw(Prima::Widget);

sub profile_default
{
   my $def = $_[ 0]-> SUPER::profile_default;
   my %prf = (
      width     => 154,
      height    => 102,
      syncPaint => 0,
   );
   @$def{keys %prf} = values %prf;
   return $def;
}

sub on_create

lib/App/PLab/ImageApp.pm  view on Meta::CPAN


package App::PLab::TrImageViewer;
use vars qw(@ISA);
@ISA = qw(Prima::ImageViewer);

sub invalidate_rect
{
   my ( $self, @r) = @_;
   my $w = $self-> owner;
   $w-> ivm_repaint( $self) if $w-> {magnify};
   $self-> SUPER::invalidate_rect( @r);
}

sub end_paint
{
   my $self = $_[0];
   $self-> SUPER::end_paint;
   my $w = $self-> owner;
   $w-> ivm_repaint( $self) if $w-> {magnify};
}

sub capture
{
   return $_[0]-> SUPER::capture unless $#_;
   my ( $self, $capFlag, @rest) = @_;
   $self-> owner-> iv_cancelmagnify( $self)
      if !$capFlag && $self-> owner-> {magnify};
   $self-> SUPER::capture( $capFlag, @rest);
}

sub screen2point
{
   return map { int } shift-> SUPER::screen2point( @_);
}

sub point2screen
{
   return map { int } shift-> SUPER::point2screen( @_);
}

package App::PLab::ImageAppWindow;
use vars qw(@ISA %dlgProfile $ico $pointClickTolerance);
@ISA = qw(Prima::Window);
$pointClickTolerance = 8;

%dlgProfile = (
   centered    => 1,
   visible     => 0,

lib/App/PLab/ImageApp.pm  view on Meta::CPAN

   ) unless $self-> { timer};
   $self-> { timer}-> stop;
   $self-> { timer}-> timeout(  $w-> {ini}-> {statusDelay} * 1000);
   $self-> { timer}-> start;
}

# SB_END

sub profile_default
{
   my $def = $_[ 0]-> SUPER::profile_default;
   my %prf = (
      name       => 'MainWindow',
      size       => [ 531, 594],
      text       => $::application-> name,
      widgetClass=> wc::Dialog,
   );
   @$def{keys %prf} = values %prf;
   return $def;
}

sub init
{
   my $self = shift;
   my %profile = $self-> SUPER::init(@_);

   my $w = $self;
   my ($x, $y) = $w-> size;

   my $scale = $::application-> uiScaling;
   $scale = 1 if $scale < 1;

   $w-> insert( "Panel",
      text      => "",
      name      => "ToolBar",



( run in 0.306 second using v1.01-cache-2.11-cpan-1dc43b0fbd2 )