Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 4f45e7bdfd4a5ff17f5f8eaab90d017f > files > 1593

albumshaper-2.1-6mdv2010.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>AlbumShaper: splitViewInterface.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.9 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<h1>splitViewInterface.cpp</h1><a href="splitViewInterface_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">//==============================================</span>
<a name="l00002"></a>00002 <span class="comment">//  copyright            : (C) 2003-2005 by Will Stokes</span>
<a name="l00003"></a>00003 <span class="comment">//==============================================</span>
<a name="l00004"></a>00004 <span class="comment">//  This program is free software; you can redistribute it </span>
<a name="l00005"></a>00005 <span class="comment">//  and/or modify it under the terms of the GNU General </span>
<a name="l00006"></a>00006 <span class="comment">//  Public License as published by the Free Software </span>
<a name="l00007"></a>00007 <span class="comment">//  Foundation; either version 2 of the License, or  </span>
<a name="l00008"></a>00008 <span class="comment">//  (at your option) any later version.         </span>
<a name="l00009"></a>00009 <span class="comment">//==============================================</span>
<a name="l00010"></a>00010 
<a name="l00011"></a>00011 <span class="comment">//Systemwide includes</span>
<a name="l00012"></a>00012 <span class="preprocessor">#include &lt;qpainter.h&gt;</span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &lt;qcursor.h&gt;</span>
<a name="l00014"></a>00014 
<a name="l00015"></a>00015 <span class="comment">//Projectwide includes</span>
<a name="l00016"></a>00016 <span class="preprocessor">#include "<a class="code" href="splitViewInterface_8h.html">splitViewInterface.h</a>"</span>
<a name="l00017"></a>00017 <span class="preprocessor">#include "../cursors.h"</span>
<a name="l00018"></a>00018 <span class="preprocessor">#include "../../backend/tools/imageTools.h"</span>
<a name="l00019"></a>00019 
<a name="l00020"></a><a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">00020</a> <span class="preprocessor">#define TEXT_BACKGROUND_MARGIN 2</span>
<a name="l00021"></a><a class="code" href="splitViewInterface_8cpp.html#00eea598271066d754629bdffff8cc2f">00021</a> <span class="preprocessor"></span><span class="preprocessor">#define TEXT_INSET 4</span>
<a name="l00022"></a>00022 <span class="preprocessor"></span>
<a name="l00023"></a>00023 <span class="comment">//a mouse press within DRAG_THRESHOLD will move split point</span>
<a name="l00024"></a><a class="code" href="splitViewInterface_8cpp.html#dbab52be17168e6914dd8ab79ce5fcd2">00024</a> <span class="preprocessor">#define DRAG_THRESHOLD 8</span>
<a name="l00025"></a>00025 <span class="preprocessor"></span>
<a name="l00026"></a>00026 <span class="comment">//==============================================</span>
<a name="l00027"></a><a class="code" href="classSplitViewInterface.html#a592a0955919f185e1a0396b7fbc7918">00027</a> <a class="code" href="classSplitViewInterface.html#a592a0955919f185e1a0396b7fbc7918" title="Creates layout.">SplitViewInterface::SplitViewInterface</a>( <a class="code" href="classQWidget.html">QWidget</a> *parent, <span class="keyword">const</span> <span class="keywordtype">char</span>* name ) : 
<a name="l00028"></a>00028                                         <a class="code" href="classQWidget.html">QWidget</a> (parent, name )
<a name="l00029"></a>00029 {                  
<a name="l00030"></a>00030   <span class="comment">//setup split point                                          </span>
<a name="l00031"></a>00031   <a class="code" href="classSplitViewInterface.html#70410de4aa824dce6106c2de4966d94a" title="x (or y) coordinate of split between drawn adjusted and original images">dragOffset</a> = 0.5;                                          
<a name="l00032"></a>00032   <a class="code" href="classSplitViewInterface.html#052c501434ed651fbe63ca9862fc189c" title="current mouse move mode">mouseMode</a> = <a class="code" href="splitViewInterface_8h.html#6d39871d0b1a800195536f8eeb3fee219dbeea1d13c0acfaf9a9a3d218e64e95">NO_EFFECT_ON_SPLIT</a>;  
<a name="l00033"></a>00033   <a class="code" href="classSplitViewInterface.html#df794481e9121eae6816647b7fc44c9e" title="current mouse shape.">currentMouseShape</a> = <a class="code" href="splitViewInterface_8h.html#6d39871d0b1a800195536f8eeb3fee219dbeea1d13c0acfaf9a9a3d218e64e95">NO_EFFECT_ON_SPLIT</a>;
<a name="l00034"></a>00034   
<a name="l00035"></a>00035   <span class="comment">//set default mode to adjusted image</span>
<a name="l00036"></a>00036   <a class="code" href="classSplitViewInterface.html#a3f29eeb34a677eaa9534c38a7de2a22" title="Current display setting (adjusted or split screen).">previewMode</a> = <a class="code" href="splitViewInterface_8h.html#a4478246983e5a13f84754204fb5ab803a0b7989f3e36d5b221aac9fc316b79a">SPLIT_VIEW</a>;
<a name="l00037"></a>00037   
<a name="l00038"></a>00038   <span class="comment">//don't force draw labels by default. this is useful when</span>
<a name="l00039"></a>00039   <span class="comment">//the user pressed the Ctrl button or other key to toggle between opposite views</span>
<a name="l00040"></a>00040   <span class="comment">//and drop down menu for choosing display type disagrees with actuall image being shown.</span>
<a name="l00041"></a>00041   <a class="code" href="classSplitViewInterface.html#3bf276ffd5904343612eceecfad4ce47" title="Draw original/adjusted lables outside of split view mode?">forceDrawLabel</a> = <span class="keyword">false</span>;
<a name="l00042"></a>00042   
<a name="l00043"></a>00043   <span class="comment">//setup strings and fonts</span>
<a name="l00044"></a>00044   <a class="code" href="classSplitViewInterface.html#164799457f2137a52bcab510e186748e" title="Original and adjusted strings.">originalString</a> = QString( tr(<span class="stringliteral">"Original"</span>) );
<a name="l00045"></a>00045   <a class="code" href="classSplitViewInterface.html#3abd50680e497aa05aa264c53b2d5724">adjustedString</a> = QString( tr(<span class="stringliteral">"Adjusted"</span>) );          
<a name="l00046"></a>00046   
<a name="l00047"></a>00047   <a class="code" href="classSplitViewInterface.html#7102e06da666ecf8704c68b85d3d6fd6" title="Larger font used for drawing text.">textFont</a> = this-&gt;font();
<a name="l00048"></a>00048   <a class="code" href="classSplitViewInterface.html#7102e06da666ecf8704c68b85d3d6fd6" title="Larger font used for drawing text.">textFont</a>.setPointSize( <a class="code" href="classSplitViewInterface.html#7102e06da666ecf8704c68b85d3d6fd6" title="Larger font used for drawing text.">textFont</a>.pointSize() + 7 );  
<a name="l00049"></a>00049   
<a name="l00050"></a>00050   <span class="comment">//watch mouse movements in order to drag selection</span>
<a name="l00051"></a>00051   <span class="comment">//watch mouse movements in order to move split point between adjusted and original image</span>
<a name="l00052"></a>00052   setMouseTracking(<span class="keyword">true</span>);
<a name="l00053"></a>00053   
<a name="l00054"></a>00054   <span class="comment">//accept focus when clicked on</span>
<a name="l00055"></a>00055   setFocusPolicy( QWidget::ClickFocus );
<a name="l00056"></a>00056 }
<a name="l00057"></a>00057 <span class="comment">//==============================================</span>
<a name="l00058"></a><a class="code" href="classSplitViewInterface.html#5c72cd93433f838d6495d84d1435d8cd">00058</a> <span class="keywordtype">void</span> <a class="code" href="classSplitViewInterface.html#5c72cd93433f838d6495d84d1435d8cd">SplitViewInterface::paintEvent</a>(QPaintEvent *e)
<a name="l00059"></a>00059 { 
<a name="l00060"></a>00060   <span class="comment">//if orig image not setup yet then return immediately</span>
<a name="l00061"></a>00061   <span class="keywordflow">if</span>(<a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.isNull()) { <span class="keywordflow">return</span>; }
<a name="l00062"></a>00062 
<a name="l00063"></a>00063   <span class="comment">//if viewing adjusted or split view and adjusted image is null bail  </span>
<a name="l00064"></a>00064   <span class="keywordflow">if</span>( 
<a name="l00065"></a>00065       (<a class="code" href="classSplitViewInterface.html#a3f29eeb34a677eaa9534c38a7de2a22" title="Current display setting (adjusted or split screen).">previewMode</a> == <a class="code" href="splitViewInterface_8h.html#a4478246983e5a13f84754204fb5ab80e5a5e7966f92d18ce66136439e1303bd">ADJUSTED_IMAGE</a> || <a class="code" href="classSplitViewInterface.html#a3f29eeb34a677eaa9534c38a7de2a22" title="Current display setting (adjusted or split screen).">previewMode</a> == <a class="code" href="splitViewInterface_8h.html#a4478246983e5a13f84754204fb5ab803a0b7989f3e36d5b221aac9fc316b79a">SPLIT_VIEW</a> ) &amp;&amp;
<a name="l00066"></a>00066       <a class="code" href="classSplitViewInterface.html#51923395c2a22da6ab1808d3db09cc5c" title="Scaled adjusted image.">adjustedImage</a>.isNull() 
<a name="l00067"></a>00067     )
<a name="l00068"></a>00068   { <span class="keywordflow">return</span>; }
<a name="l00069"></a>00069   
<a name="l00070"></a>00070   <span class="comment">//create buffer to draw in</span>
<a name="l00071"></a>00071   QPixmap <a class="code" href="blur_8cpp.html#fa761c0753ecc94346e155a39bd9ed9c">buffer</a>( size() );
<a name="l00072"></a>00072   
<a name="l00073"></a>00073   <span class="comment">//create a painter pointing to the buffer</span>
<a name="l00074"></a>00074   QPainter bufferPainter( &amp;buffer );
<a name="l00075"></a>00075   
<a name="l00076"></a>00076   <span class="comment">//turn off clipping to make painting operations faster</span>
<a name="l00077"></a>00077   bufferPainter.setClipping(<span class="keyword">false</span>);
<a name="l00078"></a>00078 
<a name="l00079"></a>00079   <span class="comment">//initialize buffer with background brush</span>
<a name="l00080"></a>00080   bufferPainter.fillRect( buffer.rect(), backgroundBrush() );
<a name="l00081"></a>00081 
<a name="l00082"></a>00082   <span class="comment">//setup pen color</span>
<a name="l00083"></a>00083   QPen pen;
<a name="l00084"></a>00084   pen.setStyle( Qt::SolidLine );
<a name="l00085"></a>00085   pen.setColor( white );
<a name="l00086"></a>00086   pen.setWidth( 2 );
<a name="l00087"></a>00087   bufferPainter.setPen( pen);  
<a name="l00088"></a>00088 
<a name="l00089"></a>00089   <span class="keywordtype">int</span> xOffset = (<a class="code" href="blur_8cpp.html#2474a5474cbff19523a51eb1de01cda4">width</a>() - <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.width()) / 2;
<a name="l00090"></a>00090   <span class="keywordtype">int</span> yOffset = (<a class="code" href="blur_8cpp.html#d12fc34ce789bce6c8a05d8a17138534">height</a>() - <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.height()) / 2;
<a name="l00091"></a>00091 
<a name="l00092"></a>00092   <span class="comment">//setup font metrics</span>
<a name="l00093"></a>00093   bufferPainter.setFont( <a class="code" href="classSplitViewInterface.html#7102e06da666ecf8704c68b85d3d6fd6" title="Larger font used for drawing text.">textFont</a> );
<a name="l00094"></a>00094   QFontMetrics fm( <a class="code" href="classSplitViewInterface.html#7102e06da666ecf8704c68b85d3d6fd6" title="Larger font used for drawing text.">textFont</a> );
<a name="l00095"></a>00095 
<a name="l00096"></a>00096   <span class="comment">//paint the adjusted image</span>
<a name="l00097"></a>00097   <span class="keywordflow">if</span>(<a class="code" href="classSplitViewInterface.html#a3f29eeb34a677eaa9534c38a7de2a22" title="Current display setting (adjusted or split screen).">previewMode</a> == <a class="code" href="splitViewInterface_8h.html#a4478246983e5a13f84754204fb5ab80e5a5e7966f92d18ce66136439e1303bd">ADJUSTED_IMAGE</a>)
<a name="l00098"></a>00098   {
<a name="l00099"></a>00099     bufferPainter.drawImage( QPoint(xOffset, yOffset), <a class="code" href="classSplitViewInterface.html#51923395c2a22da6ab1808d3db09cc5c" title="Scaled adjusted image.">adjustedImage</a> );
<a name="l00100"></a>00100 
<a name="l00101"></a>00101     <span class="comment">//"Adjusted" label</span>
<a name="l00102"></a>00102     <span class="keywordflow">if</span>(<a class="code" href="classSplitViewInterface.html#3bf276ffd5904343612eceecfad4ce47" title="Draw original/adjusted lables outside of split view mode?">forceDrawLabel</a>)
<a name="l00103"></a>00103     {
<a name="l00104"></a>00104       <span class="keywordtype">int</span> x = xOffset + (<a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.width()-fm.width(<a class="code" href="classSplitViewInterface.html#3abd50680e497aa05aa264c53b2d5724">adjustedString</a>))/2;
<a name="l00105"></a>00105       <span class="keywordtype">int</span> y = yOffset + fm.ascent() + <a class="code" href="splitViewInterface_8cpp.html#00eea598271066d754629bdffff8cc2f">TEXT_INSET</a>;
<a name="l00106"></a>00106     
<a name="l00107"></a>00107       bufferPainter.fillRect( QRect(x - <a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a>, 
<a name="l00108"></a>00108                                     y - <a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a> - fm.ascent(), 
<a name="l00109"></a>00109                                     fm.width(<a class="code" href="classSplitViewInterface.html#3abd50680e497aa05aa264c53b2d5724">adjustedString</a>) + 2*<a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a>, 
<a name="l00110"></a>00110                                     fm.height() + 2*<a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a>),
<a name="l00111"></a>00111                               QBrush(darkGray) );    
<a name="l00112"></a>00112       bufferPainter.drawText( x, y,
<a name="l00113"></a>00113                               <a class="code" href="classSplitViewInterface.html#3abd50680e497aa05aa264c53b2d5724">adjustedString</a> );    
<a name="l00114"></a>00114     }
<a name="l00115"></a>00115   }
<a name="l00116"></a>00116   <span class="comment">//paint the original image</span>
<a name="l00117"></a>00117   <span class="keywordflow">else</span> <span class="keywordflow">if</span>(<a class="code" href="classSplitViewInterface.html#a3f29eeb34a677eaa9534c38a7de2a22" title="Current display setting (adjusted or split screen).">previewMode</a> == <a class="code" href="splitViewInterface_8h.html#a4478246983e5a13f84754204fb5ab804b0845a3961eed793f478ae334aad65d">ORIGINAL_IMAGE</a>)
<a name="l00118"></a>00118   {
<a name="l00119"></a>00119     bufferPainter.drawImage( QPoint(xOffset, yOffset), <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a> );
<a name="l00120"></a>00120 
<a name="l00121"></a>00121     <span class="comment">//"Original" label</span>
<a name="l00122"></a>00122     <span class="keywordflow">if</span>(<a class="code" href="classSplitViewInterface.html#3bf276ffd5904343612eceecfad4ce47" title="Draw original/adjusted lables outside of split view mode?">forceDrawLabel</a>)
<a name="l00123"></a>00123     {
<a name="l00124"></a>00124       <span class="keywordtype">int</span> x = xOffset + (<a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.width()-fm.width(<a class="code" href="classSplitViewInterface.html#164799457f2137a52bcab510e186748e" title="Original and adjusted strings.">originalString</a>))/2;
<a name="l00125"></a>00125       <span class="keywordtype">int</span> y = yOffset + fm.ascent() + <a class="code" href="splitViewInterface_8cpp.html#00eea598271066d754629bdffff8cc2f">TEXT_INSET</a>;
<a name="l00126"></a>00126     
<a name="l00127"></a>00127       bufferPainter.fillRect( QRect(x - <a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a>, 
<a name="l00128"></a>00128                                     y - <a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a> - fm.ascent(), 
<a name="l00129"></a>00129                                     fm.width(<a class="code" href="classSplitViewInterface.html#164799457f2137a52bcab510e186748e" title="Original and adjusted strings.">originalString</a>) + 2*<a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a>, 
<a name="l00130"></a>00130                                     fm.height() + 2*<a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a>),
<a name="l00131"></a>00131                               QBrush(darkGray) );    
<a name="l00132"></a>00132       bufferPainter.drawText( x, y,
<a name="l00133"></a>00133                               <a class="code" href="classSplitViewInterface.html#164799457f2137a52bcab510e186748e" title="Original and adjusted strings.">originalString</a> );    
<a name="l00134"></a>00134     }
<a name="l00135"></a>00135   }
<a name="l00136"></a>00136   <span class="comment">//if using split view also draw line down center and original image on left</span>
<a name="l00137"></a>00137   <span class="keywordflow">else</span> <span class="keywordflow">if</span>(<a class="code" href="classSplitViewInterface.html#a3f29eeb34a677eaa9534c38a7de2a22" title="Current display setting (adjusted or split screen).">previewMode</a> == <a class="code" href="splitViewInterface_8h.html#a4478246983e5a13f84754204fb5ab803a0b7989f3e36d5b221aac9fc316b79a">SPLIT_VIEW</a> ||
<a name="l00138"></a>00138           <a class="code" href="classSplitViewInterface.html#a3f29eeb34a677eaa9534c38a7de2a22" title="Current display setting (adjusted or split screen).">previewMode</a> == <a class="code" href="splitViewInterface_8h.html#a4478246983e5a13f84754204fb5ab80f94a0ed6eca377f0937a43f5b9f29c9d">INV_SPLIT_VIEW</a> )
<a name="l00139"></a>00139   {
<a name="l00140"></a>00140     <span class="comment">//determine what left/right or top/bottom strings are</span>
<a name="l00141"></a>00141     QString label1, label2;
<a name="l00142"></a>00142     <span class="keywordflow">if</span>(<a class="code" href="classSplitViewInterface.html#a3f29eeb34a677eaa9534c38a7de2a22" title="Current display setting (adjusted or split screen).">previewMode</a> == <a class="code" href="splitViewInterface_8h.html#a4478246983e5a13f84754204fb5ab803a0b7989f3e36d5b221aac9fc316b79a">SPLIT_VIEW</a>)
<a name="l00143"></a>00143     {
<a name="l00144"></a>00144       label1 = <a class="code" href="classSplitViewInterface.html#164799457f2137a52bcab510e186748e" title="Original and adjusted strings.">originalString</a>;
<a name="l00145"></a>00145       label2 = <a class="code" href="classSplitViewInterface.html#3abd50680e497aa05aa264c53b2d5724">adjustedString</a>;
<a name="l00146"></a>00146     }
<a name="l00147"></a>00147     <span class="keywordflow">else</span>
<a name="l00148"></a>00148     {
<a name="l00149"></a>00149       label2 = <a class="code" href="classSplitViewInterface.html#164799457f2137a52bcab510e186748e" title="Original and adjusted strings.">originalString</a>;
<a name="l00150"></a>00150       label1 = <a class="code" href="classSplitViewInterface.html#3abd50680e497aa05aa264c53b2d5724">adjustedString</a>;
<a name="l00151"></a>00151     }
<a name="l00152"></a>00152     
<a name="l00153"></a>00153     <span class="comment">//find split point in screen coordinates</span>
<a name="l00154"></a>00154     <span class="keywordtype">int</span> halfWay = <a class="code" href="classSplitViewInterface.html#0baba2eccd78c5117bfd4ba60ec3f280" title="convert world coordinates to display coordinates (int from 0 to origImage width-1)...">worldToDisplay</a>( <a class="code" href="classSplitViewInterface.html#70410de4aa824dce6106c2de4966d94a" title="x (or y) coordinate of split between drawn adjusted and original images">dragOffset</a> );
<a name="l00155"></a>00155     
<a name="l00156"></a>00156     <span class="comment">//paint the original image</span>
<a name="l00157"></a>00157     bufferPainter.drawImage( QPoint(xOffset, yOffset), <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a> );
<a name="l00158"></a>00158 
<a name="l00159"></a>00159     <span class="comment">//-------</span>
<a name="l00160"></a>00160     <span class="keywordflow">if</span>(<a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.width() &gt; <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.height() )
<a name="l00161"></a>00161     {    
<a name="l00162"></a>00162       <span class="comment">//paint the adjusted image</span>
<a name="l00163"></a>00163       <span class="keywordflow">if</span>(<a class="code" href="classSplitViewInterface.html#a3f29eeb34a677eaa9534c38a7de2a22" title="Current display setting (adjusted or split screen).">previewMode</a> == <a class="code" href="splitViewInterface_8h.html#a4478246983e5a13f84754204fb5ab803a0b7989f3e36d5b221aac9fc316b79a">SPLIT_VIEW</a>)
<a name="l00164"></a>00164       {
<a name="l00165"></a>00165         bufferPainter.drawImage( xOffset + halfWay, 
<a name="l00166"></a>00166                                  yOffset,
<a name="l00167"></a>00167                                  <a class="code" href="classSplitViewInterface.html#51923395c2a22da6ab1808d3db09cc5c" title="Scaled adjusted image.">adjustedImage</a>,
<a name="l00168"></a>00168                                  halfWay,0,
<a name="l00169"></a>00169                                  <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.width() - halfWay,
<a name="l00170"></a>00170                                  <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.height() );  
<a name="l00171"></a>00171       }
<a name="l00172"></a>00172       <span class="keywordflow">else</span>
<a name="l00173"></a>00173       {
<a name="l00174"></a>00174         bufferPainter.drawImage( xOffset, 
<a name="l00175"></a>00175                                  yOffset,
<a name="l00176"></a>00176                                  <a class="code" href="classSplitViewInterface.html#51923395c2a22da6ab1808d3db09cc5c" title="Scaled adjusted image.">adjustedImage</a>,
<a name="l00177"></a>00177                                  0,0,
<a name="l00178"></a>00178                                  halfWay,
<a name="l00179"></a>00179                                  <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.height() );  
<a name="l00180"></a>00180       }
<a name="l00181"></a>00181 
<a name="l00182"></a>00182       
<a name="l00183"></a>00183       <span class="comment">//paint white line</span>
<a name="l00184"></a>00184       bufferPainter.drawLine( xOffset + halfWay,
<a name="l00185"></a>00185                               yOffset,
<a name="l00186"></a>00186                               xOffset + halfWay,
<a name="l00187"></a>00187                               yOffset + <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.height() );
<a name="l00188"></a>00188 
<a name="l00189"></a>00189       <span class="comment">//Left label</span>
<a name="l00190"></a>00190       <span class="keywordtype">int</span> x = xOffset + (halfWay-fm.width(label1))/2;
<a name="l00191"></a>00191       <span class="keywordtype">int</span> y = yOffset + fm.ascent() + <a class="code" href="splitViewInterface_8cpp.html#00eea598271066d754629bdffff8cc2f">TEXT_INSET</a>;
<a name="l00192"></a>00192       
<a name="l00193"></a>00193       bufferPainter.fillRect( QRect(x - <a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a>, 
<a name="l00194"></a>00194                                     y - <a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a> - fm.ascent(), 
<a name="l00195"></a>00195                                     fm.width(label1) + 2*<a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a>, 
<a name="l00196"></a>00196                                     fm.height() + 2*<a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a>),
<a name="l00197"></a>00197                               QBrush(darkGray) );    
<a name="l00198"></a>00198       bufferPainter.drawText( x, y,
<a name="l00199"></a>00199                               label1 );    
<a name="l00200"></a>00200 
<a name="l00201"></a>00201       <span class="comment">//Right label</span>
<a name="l00202"></a>00202       x = xOffset + halfWay + (<a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.width() - halfWay - fm.width(label2))/2;
<a name="l00203"></a>00203       
<a name="l00204"></a>00204       bufferPainter.fillRect( QRect(x - <a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a>, 
<a name="l00205"></a>00205                                     y - <a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a> - fm.ascent(), 
<a name="l00206"></a>00206                                     fm.width(label2) + 2*<a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a>, 
<a name="l00207"></a>00207                                     fm.height() + 2*<a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a>),
<a name="l00208"></a>00208                               QBrush(darkGray) );    
<a name="l00209"></a>00209       bufferPainter.drawText( x, y,
<a name="l00210"></a>00210                               label2 );
<a name="l00211"></a>00211     }
<a name="l00212"></a>00212     <span class="comment">//-------</span>
<a name="l00213"></a>00213     <span class="keywordflow">else</span>
<a name="l00214"></a>00214     {
<a name="l00215"></a>00215       <span class="comment">//paint the adjusted image</span>
<a name="l00216"></a>00216       <span class="keywordflow">if</span>(<a class="code" href="classSplitViewInterface.html#a3f29eeb34a677eaa9534c38a7de2a22" title="Current display setting (adjusted or split screen).">previewMode</a> == <a class="code" href="splitViewInterface_8h.html#a4478246983e5a13f84754204fb5ab803a0b7989f3e36d5b221aac9fc316b79a">SPLIT_VIEW</a>)
<a name="l00217"></a>00217       {
<a name="l00218"></a>00218         bufferPainter.drawImage( xOffset, 
<a name="l00219"></a>00219                                  yOffset + halfWay,
<a name="l00220"></a>00220                                  <a class="code" href="classSplitViewInterface.html#51923395c2a22da6ab1808d3db09cc5c" title="Scaled adjusted image.">adjustedImage</a>,
<a name="l00221"></a>00221                                  0,halfWay,
<a name="l00222"></a>00222                                  <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.width(),
<a name="l00223"></a>00223                                  <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.height()-halfWay );  
<a name="l00224"></a>00224       }
<a name="l00225"></a>00225       <span class="keywordflow">else</span>
<a name="l00226"></a>00226       {
<a name="l00227"></a>00227         bufferPainter.drawImage( xOffset, 
<a name="l00228"></a>00228                                  yOffset,
<a name="l00229"></a>00229                                  <a class="code" href="classSplitViewInterface.html#51923395c2a22da6ab1808d3db09cc5c" title="Scaled adjusted image.">adjustedImage</a>,
<a name="l00230"></a>00230                                  0,0,
<a name="l00231"></a>00231                                  <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.width(),
<a name="l00232"></a>00232                                  halfWay );  
<a name="l00233"></a>00233       }
<a name="l00234"></a>00234       
<a name="l00235"></a>00235       <span class="comment">//paint white line</span>
<a name="l00236"></a>00236       bufferPainter.drawLine( xOffset,
<a name="l00237"></a>00237                               yOffset + halfWay,
<a name="l00238"></a>00238                               xOffset + <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.width(),
<a name="l00239"></a>00239                               yOffset + halfWay );
<a name="l00240"></a>00240 
<a name="l00241"></a>00241       <span class="comment">//Top label</span>
<a name="l00242"></a>00242       <span class="keywordtype">int</span> x = xOffset + (<a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.width()-fm.width(label1))/2;
<a name="l00243"></a>00243       <span class="keywordtype">int</span> y = yOffset + fm.ascent() + <a class="code" href="splitViewInterface_8cpp.html#00eea598271066d754629bdffff8cc2f">TEXT_INSET</a>;
<a name="l00244"></a>00244       
<a name="l00245"></a>00245       bufferPainter.fillRect( QRect(x - <a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a>, 
<a name="l00246"></a>00246                                     y - <a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a> - fm.ascent(), 
<a name="l00247"></a>00247                                     fm.width(label1) + 2*<a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a>, 
<a name="l00248"></a>00248                                     fm.height() + 2*<a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a>),
<a name="l00249"></a>00249                               QBrush(darkGray) );    
<a name="l00250"></a>00250       bufferPainter.drawText( x, y,
<a name="l00251"></a>00251                               label1 );    
<a name="l00252"></a>00252       
<a name="l00253"></a>00253       <span class="comment">//Bottom label</span>
<a name="l00254"></a>00254       x = xOffset + (<a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.width()-fm.width(label2))/2;
<a name="l00255"></a>00255       y = yOffset + halfWay + fm.height();
<a name="l00256"></a>00256       
<a name="l00257"></a>00257       bufferPainter.fillRect( QRect(x - <a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a>, 
<a name="l00258"></a>00258                                     y - <a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a> - fm.ascent(), 
<a name="l00259"></a>00259                                     fm.width(label2) + 2*<a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a>, 
<a name="l00260"></a>00260                                     fm.height() + 2*<a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a>),
<a name="l00261"></a>00261                               QBrush(darkGray) );    
<a name="l00262"></a>00262       bufferPainter.drawText( x, y,
<a name="l00263"></a>00263                               label2 );
<a name="l00264"></a>00264     }
<a name="l00265"></a>00265     <span class="comment">//-------    </span>
<a name="l00266"></a>00266   }
<a name="l00267"></a>00267 
<a name="l00268"></a>00268   <span class="comment">//end painter  </span>
<a name="l00269"></a>00269   bufferPainter.end();
<a name="l00270"></a>00270   
<a name="l00271"></a>00271   <span class="comment">//blit buffer to screen</span>
<a name="l00272"></a>00272   bitBlt( <span class="keyword">this</span>,
<a name="l00273"></a>00273           e-&gt;rect().x(), e-&gt;rect().y(),
<a name="l00274"></a>00274           &amp;buffer, 
<a name="l00275"></a>00275           e-&gt;rect().x(), e-&gt;rect().y(),
<a name="l00276"></a>00276           e-&gt;rect().width(), e-&gt;rect().height() );
<a name="l00277"></a>00277 }
<a name="l00278"></a>00278 <span class="comment">//==============================================</span>
<a name="l00279"></a><a class="code" href="classSplitViewInterface.html#e6cd0c9f1fb64b0313063f59aa748943">00279</a> <span class="keywordtype">void</span> <a class="code" href="classSplitViewInterface.html#e6cd0c9f1fb64b0313063f59aa748943" title="Sets preview mode.">SplitViewInterface::setPreviewMode</a>( <a class="code" href="splitViewInterface_8h.html#a4478246983e5a13f84754204fb5ab80" title="current preview mode">PREVIEW_MODE</a> mode, <span class="keywordtype">bool</span> forceDrawLabel )
<a name="l00280"></a>00280 {
<a name="l00281"></a>00281   <span class="comment">//set mode and repaint</span>
<a name="l00282"></a>00282   <a class="code" href="classSplitViewInterface.html#a3f29eeb34a677eaa9534c38a7de2a22" title="Current display setting (adjusted or split screen).">previewMode</a> = mode;
<a name="l00283"></a>00283   this-&gt;forceDrawLabel = forceDrawLabel;
<a name="l00284"></a>00284   repaint(<span class="keyword">false</span>);
<a name="l00285"></a>00285 }
<a name="l00286"></a>00286 <span class="comment">//==============================================</span>
<a name="l00287"></a><a class="code" href="classSplitViewInterface.html#13523565edbd383096953700712c9f87">00287</a> <span class="keywordtype">bool</span> <a class="code" href="classSplitViewInterface.html#13523565edbd383096953700712c9f87" title="determines if mouse is near split point">SplitViewInterface::nearSplitPoint</a>( QPoint p )
<a name="l00288"></a>00288 {
<a name="l00289"></a>00289   <span class="comment">//always false if not in split view mode</span>
<a name="l00290"></a>00290   <span class="keywordflow">if</span>( <a class="code" href="classSplitViewInterface.html#a3f29eeb34a677eaa9534c38a7de2a22" title="Current display setting (adjusted or split screen).">previewMode</a> != <a class="code" href="splitViewInterface_8h.html#a4478246983e5a13f84754204fb5ab803a0b7989f3e36d5b221aac9fc316b79a">SPLIT_VIEW</a> )
<a name="l00291"></a>00291     <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00292"></a>00292   
<a name="l00293"></a>00293   <span class="comment">//compute painting offset and get important mouse coordinate</span>
<a name="l00294"></a>00294   <span class="keywordtype">int</span> paintingOffset;
<a name="l00295"></a>00295   <span class="keywordtype">int</span> mousePos;
<a name="l00296"></a>00296   <span class="keywordflow">if</span>(<a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.width() &gt; <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.height())
<a name="l00297"></a>00297   {
<a name="l00298"></a>00298     paintingOffset = (<a class="code" href="blur_8cpp.html#2474a5474cbff19523a51eb1de01cda4">width</a>() - <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.width()) / 2;
<a name="l00299"></a>00299     mousePos = p.x();
<a name="l00300"></a>00300   }
<a name="l00301"></a>00301   <span class="keywordflow">else</span>
<a name="l00302"></a>00302   {
<a name="l00303"></a>00303     paintingOffset = (<a class="code" href="blur_8cpp.html#d12fc34ce789bce6c8a05d8a17138534">height</a>() - <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.height()) / 2;
<a name="l00304"></a>00304     mousePos = p.y();
<a name="l00305"></a>00305   }
<a name="l00306"></a>00306   
<a name="l00307"></a>00307   <span class="comment">//convert drag offset to display coordinates</span>
<a name="l00308"></a>00308   <span class="keywordtype">int</span> displayCoor = <a class="code" href="classSplitViewInterface.html#0baba2eccd78c5117bfd4ba60ec3f280" title="convert world coordinates to display coordinates (int from 0 to origImage width-1)...">worldToDisplay</a>( <a class="code" href="classSplitViewInterface.html#70410de4aa824dce6106c2de4966d94a" title="x (or y) coordinate of split between drawn adjusted and original images">dragOffset</a>) + paintingOffset;
<a name="l00309"></a>00309   
<a name="l00310"></a>00310   <span class="comment">//check if within threshold of split point</span>
<a name="l00311"></a>00311   <span class="keywordflow">return</span> ( mousePos &gt; displayCoor - <a class="code" href="histogramInterface_8cpp.html#dbab52be17168e6914dd8ab79ce5fcd2">DRAG_THRESHOLD</a> &amp;&amp;
<a name="l00312"></a>00312            mousePos &lt; displayCoor + <a class="code" href="histogramInterface_8cpp.html#dbab52be17168e6914dd8ab79ce5fcd2">DRAG_THRESHOLD</a>);
<a name="l00313"></a>00313 }
<a name="l00314"></a>00314 <span class="comment">//==============================================</span>
<a name="l00315"></a><a class="code" href="classSplitViewInterface.html#391917837f5b0ef44c6e0c189373b0e2">00315</a> <span class="keywordtype">void</span> <a class="code" href="classSplitViewInterface.html#391917837f5b0ef44c6e0c189373b0e2">SplitViewInterface::mousePressEvent</a>( QMouseEvent *e)
<a name="l00316"></a>00316 { 
<a name="l00317"></a>00317   <span class="comment">//if within threshold of split point enter drag split mode</span>
<a name="l00318"></a>00318   <span class="keywordflow">if</span>( <a class="code" href="classSplitViewInterface.html#13523565edbd383096953700712c9f87" title="determines if mouse is near split point">nearSplitPoint</a>(e-&gt;pos()) )  
<a name="l00319"></a>00319     <a class="code" href="classSplitViewInterface.html#052c501434ed651fbe63ca9862fc189c" title="current mouse move mode">mouseMode</a> = <a class="code" href="splitViewInterface_8h.html#6d39871d0b1a800195536f8eeb3fee211c03d26e0b3da969cfe8d05f6dc64374">DRAG_SPLIT</a>;
<a name="l00320"></a>00320 }
<a name="l00321"></a>00321 <span class="comment">//==============================================</span>
<a name="l00322"></a><a class="code" href="classSplitViewInterface.html#d3fba3ec66cfe1470d5d73df53caf806">00322</a> <span class="keywordtype">void</span> <a class="code" href="classSplitViewInterface.html#d3fba3ec66cfe1470d5d73df53caf806">SplitViewInterface::mouseMoveEvent</a>( QMouseEvent *e)
<a name="l00323"></a>00323 {
<a name="l00324"></a>00324   <span class="comment">//if not dragging split point update mosue cursor</span>
<a name="l00325"></a>00325   <span class="keywordflow">if</span>(<a class="code" href="classSplitViewInterface.html#052c501434ed651fbe63ca9862fc189c" title="current mouse move mode">mouseMode</a> == <a class="code" href="splitViewInterface_8h.html#6d39871d0b1a800195536f8eeb3fee219dbeea1d13c0acfaf9a9a3d218e64e95">NO_EFFECT_ON_SPLIT</a>)
<a name="l00326"></a>00326   {
<a name="l00327"></a>00327     <span class="keywordflow">if</span>( !<a class="code" href="classSplitViewInterface.html#13523565edbd383096953700712c9f87" title="determines if mouse is near split point">nearSplitPoint</a>(e-&gt;pos()) &amp;&amp; <a class="code" href="classSplitViewInterface.html#df794481e9121eae6816647b7fc44c9e" title="current mouse shape.">currentMouseShape</a> == <a class="code" href="splitViewInterface_8h.html#6d39871d0b1a800195536f8eeb3fee211c03d26e0b3da969cfe8d05f6dc64374">DRAG_SPLIT</a> )
<a name="l00328"></a>00328     { 
<a name="l00329"></a>00329       <a class="code" href="classSplitViewInterface.html#df794481e9121eae6816647b7fc44c9e" title="current mouse shape.">currentMouseShape</a> = <a class="code" href="splitViewInterface_8h.html#6d39871d0b1a800195536f8eeb3fee219dbeea1d13c0acfaf9a9a3d218e64e95">NO_EFFECT_ON_SPLIT</a>;
<a name="l00330"></a>00330       setCursor( Qt::ArrowCursor ); 
<a name="l00331"></a>00331     }
<a name="l00332"></a>00332     <span class="keywordflow">else</span> <span class="keywordflow">if</span>( <a class="code" href="classSplitViewInterface.html#13523565edbd383096953700712c9f87" title="determines if mouse is near split point">nearSplitPoint</a>(e-&gt;pos()) &amp;&amp; <a class="code" href="classSplitViewInterface.html#df794481e9121eae6816647b7fc44c9e" title="current mouse shape.">currentMouseShape</a> == <a class="code" href="splitViewInterface_8h.html#6d39871d0b1a800195536f8eeb3fee219dbeea1d13c0acfaf9a9a3d218e64e95">NO_EFFECT_ON_SPLIT</a> )
<a name="l00333"></a>00333     {
<a name="l00334"></a>00334       <a class="code" href="classSplitViewInterface.html#df794481e9121eae6816647b7fc44c9e" title="current mouse shape.">currentMouseShape</a> = <a class="code" href="splitViewInterface_8h.html#6d39871d0b1a800195536f8eeb3fee211c03d26e0b3da969cfe8d05f6dc64374">DRAG_SPLIT</a>;
<a name="l00335"></a>00335       <span class="keywordflow">if</span>( <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.width() &gt; <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.height() )
<a name="l00336"></a>00336       {
<a name="l00337"></a>00337         setCursor( <a class="code" href="cursors_8cpp.html#8d89fd03db7e35090175ec42e8af8f3f">getCursor</a>(<a class="code" href="cursors_8h.html#384a874a43b4618a4c20506728f1c6478b659aefdfad1b15a9e9dcbd7c524f25">MOVE_HOR_CURSOR</a>) );
<a name="l00338"></a>00338       }
<a name="l00339"></a>00339       <span class="keywordflow">else</span>
<a name="l00340"></a>00340       {
<a name="l00341"></a>00341         setCursor( <a class="code" href="cursors_8cpp.html#8d89fd03db7e35090175ec42e8af8f3f">getCursor</a>(<a class="code" href="cursors_8h.html#384a874a43b4618a4c20506728f1c64775a322d3eb727e1c69e4a945946ad927">MOVE_VERT_CURSOR</a>) );
<a name="l00342"></a>00342       }
<a name="l00343"></a>00343     }
<a name="l00344"></a>00344 
<a name="l00345"></a>00345     <span class="keywordflow">return</span>;
<a name="l00346"></a>00346   }
<a name="l00347"></a>00347   
<a name="l00348"></a>00348   <span class="comment">//compute painting offset, get important mouse</span>
<a name="l00349"></a>00349   <span class="comment">//coordinate and clamp to valid range</span>
<a name="l00350"></a>00350   QFontMetrics fm( <a class="code" href="classSplitViewInterface.html#7102e06da666ecf8704c68b85d3d6fd6" title="Larger font used for drawing text.">textFont</a> );
<a name="l00351"></a>00351   <span class="keywordtype">int</span> paintingOffset;
<a name="l00352"></a>00352   <span class="keywordtype">int</span> mousePos;
<a name="l00353"></a>00353   <span class="keywordflow">if</span>(<a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.width() &gt; <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.height())
<a name="l00354"></a>00354   {
<a name="l00355"></a>00355     paintingOffset = (<a class="code" href="blur_8cpp.html#2474a5474cbff19523a51eb1de01cda4">width</a>() - <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.width()) / 2;
<a name="l00356"></a>00356     mousePos = e-&gt;pos().x();
<a name="l00357"></a>00357     mousePos = QMAX( mousePos, paintingOffset + 4*<a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a> + fm.width(<a class="code" href="classSplitViewInterface.html#164799457f2137a52bcab510e186748e" title="Original and adjusted strings.">originalString</a>) );
<a name="l00358"></a>00358     mousePos = QMIN( mousePos, paintingOffset + <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.width() - 
<a name="l00359"></a>00359                      fm.width(<a class="code" href="classSplitViewInterface.html#3abd50680e497aa05aa264c53b2d5724">adjustedString</a>) - 2*<a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a> - 2*<a class="code" href="splitViewInterface_8cpp.html#00eea598271066d754629bdffff8cc2f">TEXT_INSET</a>);
<a name="l00360"></a>00360   }
<a name="l00361"></a>00361   <span class="keywordflow">else</span>
<a name="l00362"></a>00362   {
<a name="l00363"></a>00363     paintingOffset = (<a class="code" href="blur_8cpp.html#d12fc34ce789bce6c8a05d8a17138534">height</a>() - <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.height()) / 2;
<a name="l00364"></a>00364     mousePos = e-&gt;pos().y();
<a name="l00365"></a>00365     mousePos = QMAX( mousePos, paintingOffset + 4*<a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a> + fm.height() );
<a name="l00366"></a>00366     mousePos = QMIN( mousePos, paintingOffset + <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.height() - 
<a name="l00367"></a>00367                      fm.height() - 2*<a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a> - 2*<a class="code" href="splitViewInterface_8cpp.html#00eea598271066d754629bdffff8cc2f">TEXT_INSET</a>);
<a name="l00368"></a>00368   }
<a name="l00369"></a>00369   
<a name="l00370"></a>00370   <span class="comment">//update location of split point and repaint</span>
<a name="l00371"></a>00371   <a class="code" href="classSplitViewInterface.html#70410de4aa824dce6106c2de4966d94a" title="x (or y) coordinate of split between drawn adjusted and original images">dragOffset</a> = <a class="code" href="classSplitViewInterface.html#1c0403caddd886861b62e1bb32383153" title="convert display coordinates to world coordinates (double from 0.0 - 1.0)">displayToWorld</a>(mousePos - paintingOffset);   
<a name="l00372"></a>00372   repaint(<span class="keyword">false</span>);  
<a name="l00373"></a>00373 }
<a name="l00374"></a>00374 <span class="comment">//==============================================</span>
<a name="l00375"></a><a class="code" href="classSplitViewInterface.html#bed0a828f68a935dc257f8ebf1f1dbfb">00375</a> <span class="keywordtype">void</span> <a class="code" href="classSplitViewInterface.html#bed0a828f68a935dc257f8ebf1f1dbfb">SplitViewInterface::mouseReleaseEvent</a>( QMouseEvent *e)
<a name="l00376"></a>00376 {
<a name="l00377"></a>00377   <span class="comment">//disable dragging</span>
<a name="l00378"></a>00378   <a class="code" href="classSplitViewInterface.html#052c501434ed651fbe63ca9862fc189c" title="current mouse move mode">mouseMode</a> = <a class="code" href="splitViewInterface_8h.html#6d39871d0b1a800195536f8eeb3fee219dbeea1d13c0acfaf9a9a3d218e64e95">NO_EFFECT_ON_SPLIT</a>;  
<a name="l00379"></a>00379 
<a name="l00380"></a>00380   <span class="comment">//update mouse cursor if necessary</span>
<a name="l00381"></a>00381   <span class="keywordflow">if</span>( !<a class="code" href="classSplitViewInterface.html#13523565edbd383096953700712c9f87" title="determines if mouse is near split point">nearSplitPoint</a>(e-&gt;pos()) &amp;&amp; <a class="code" href="classSplitViewInterface.html#df794481e9121eae6816647b7fc44c9e" title="current mouse shape.">currentMouseShape</a> == <a class="code" href="splitViewInterface_8h.html#6d39871d0b1a800195536f8eeb3fee211c03d26e0b3da969cfe8d05f6dc64374">DRAG_SPLIT</a> )
<a name="l00382"></a>00382   { 
<a name="l00383"></a>00383     <a class="code" href="classSplitViewInterface.html#df794481e9121eae6816647b7fc44c9e" title="current mouse shape.">currentMouseShape</a> = <a class="code" href="splitViewInterface_8h.html#6d39871d0b1a800195536f8eeb3fee219dbeea1d13c0acfaf9a9a3d218e64e95">NO_EFFECT_ON_SPLIT</a>;
<a name="l00384"></a>00384     setCursor( Qt::ArrowCursor ); 
<a name="l00385"></a>00385   }  
<a name="l00386"></a>00386 }
<a name="l00387"></a>00387 <span class="comment">//==============================================</span>
<a name="l00388"></a><a class="code" href="classSplitViewInterface.html#1c0403caddd886861b62e1bb32383153">00388</a> <span class="keywordtype">double</span> <a class="code" href="classSplitViewInterface.html#1c0403caddd886861b62e1bb32383153" title="convert display coordinates to world coordinates (double from 0.0 - 1.0)">SplitViewInterface::displayToWorld</a>( <span class="keywordtype">int</span> coordinate )
<a name="l00389"></a>00389 {
<a name="l00390"></a>00390   <span class="keywordflow">if</span>( <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.width() &gt; <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.height() )
<a name="l00391"></a>00391   { <span class="keywordflow">return</span> ((<span class="keywordtype">double</span>) (coordinate+1))/<a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.width(); }
<a name="l00392"></a>00392   <span class="keywordflow">else</span>
<a name="l00393"></a>00393   { <span class="keywordflow">return</span> ((<span class="keywordtype">double</span>) (coordinate+1))/<a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.height(); }
<a name="l00394"></a>00394 }
<a name="l00395"></a>00395 <span class="comment">//==============================================</span>
<a name="l00396"></a><a class="code" href="classSplitViewInterface.html#0baba2eccd78c5117bfd4ba60ec3f280">00396</a> <span class="keywordtype">int</span> <a class="code" href="classSplitViewInterface.html#0baba2eccd78c5117bfd4ba60ec3f280" title="convert world coordinates to display coordinates (int from 0 to origImage width-1)...">SplitViewInterface::worldToDisplay</a>( <span class="keywordtype">double</span> coordinate )
<a name="l00397"></a>00397 {
<a name="l00398"></a>00398   <span class="keywordflow">if</span>( <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.width() &gt; <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.height() )
<a name="l00399"></a>00399   { <span class="keywordflow">return</span> (<span class="keywordtype">int</span>) (coordinate*(<a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.width() -1) ); }
<a name="l00400"></a>00400   <span class="keywordflow">else</span>
<a name="l00401"></a>00401   { <span class="keywordflow">return</span> (<span class="keywordtype">int</span>) (coordinate*(<a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>.height()-1) ); }
<a name="l00402"></a>00402 }
<a name="l00403"></a>00403 <span class="comment">//==============================================</span>
<a name="l00404"></a><a class="code" href="classSplitViewInterface.html#496e2cbbe902e843b6e6637a74198b4b">00404</a> QSize <a class="code" href="classSplitViewInterface.html#496e2cbbe902e843b6e6637a74198b4b">SplitViewInterface::minimumSizeHint</a>()<span class="keyword"> const</span>
<a name="l00405"></a>00405 <span class="keyword"></span>{
<a name="l00406"></a>00406   QFontMetrics fm( <a class="code" href="classSplitViewInterface.html#7102e06da666ecf8704c68b85d3d6fd6" title="Larger font used for drawing text.">textFont</a> );
<a name="l00407"></a>00407   <span class="keywordtype">int</span> w = 5*<a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a> + fm.width(<a class="code" href="classSplitViewInterface.html#164799457f2137a52bcab510e186748e" title="Original and adjusted strings.">originalString</a>) + fm.width(<a class="code" href="classSplitViewInterface.html#3abd50680e497aa05aa264c53b2d5724">adjustedString</a>);
<a name="l00408"></a>00408   <span class="keywordtype">int</span> h = 2*<a class="code" href="splitViewInterface_8cpp.html#e5ef7be47cc2a614cdc0bd8c648a9beb">TEXT_BACKGROUND_MARGIN</a> + fm.height(); 
<a name="l00409"></a>00409   <span class="keywordflow">return</span> QSize( w, h );
<a name="l00410"></a>00410 }
<a name="l00411"></a>00411 <span class="comment">//==============================================</span>
<a name="l00412"></a><a class="code" href="classSplitViewInterface.html#7139f30dcf4faa4afa1fa837334a088d">00412</a> QImage&amp; <a class="code" href="classSplitViewInterface.html#7139f30dcf4faa4afa1fa837334a088d" title="returns orig image object">SplitViewInterface::getOrigImage</a>()
<a name="l00413"></a>00413 { <span class="keywordflow">return</span> <a class="code" href="classSplitViewInterface.html#998bb3d2486b3965315e561d6b505304" title="Scaled original image.">origImage</a>; }
<a name="l00414"></a>00414 <span class="comment">//==============================================</span>
<a name="l00415"></a><a class="code" href="classSplitViewInterface.html#7c60276f4afa1fa1fc3dfc201b6311aa">00415</a> <span class="keywordtype">void</span> <a class="code" href="classSplitViewInterface.html#7c60276f4afa1fa1fc3dfc201b6311aa">SplitViewInterface::setImages</a>( QImage origImage, 
<a name="l00416"></a>00416                                     QImage adjustedImage )
<a name="l00417"></a>00417 {
<a name="l00418"></a>00418   this-&gt;origImage = origImage;
<a name="l00419"></a>00419   this-&gt;adjustedImage = adjustedImage;
<a name="l00420"></a>00420   repaint(<span class="keyword">false</span>);
<a name="l00421"></a>00421 }
<a name="l00422"></a>00422 <span class="comment">//==============================================</span>
<a name="l00423"></a><a class="code" href="classSplitViewInterface.html#d7328bc93d69a28310a23d9294ec29d7">00423</a> <span class="keywordtype">void</span> <a class="code" href="classSplitViewInterface.html#d7328bc93d69a28310a23d9294ec29d7" title="sets adjusted image and repaints">SplitViewInterface::setAdjustedImage</a>( QImage adjustedImage )
<a name="l00424"></a>00424 {
<a name="l00425"></a>00425   this-&gt;adjustedImage = adjustedImage;
<a name="l00426"></a>00426   repaint(<span class="keyword">false</span>);
<a name="l00427"></a>00427 }
<a name="l00428"></a>00428 <span class="comment">//==============================================</span>
<a name="l00429"></a>00429 
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Aug 23 02:34:27 2009 for AlbumShaper by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address>
</body>
</html>