Skip to content

Commit

Permalink
Merge branch 'master' of github.com:qgis/Quantum-GIS
Browse files Browse the repository at this point in the history
  • Loading branch information
timlinux committed May 17, 2011
2 parents cda5461 + c724ce5 commit ffed1d7
Show file tree
Hide file tree
Showing 16 changed files with 172 additions and 31 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -30,3 +30,7 @@ ms-windows/untgz/
scripts/astyle.exe
# vim temporary files
.*.swp
*.aux
*.out
*.tex
*.toc
8 changes: 8 additions & 0 deletions cmake/Txt2Tags.cmake
Expand Up @@ -46,6 +46,14 @@ MACRO(ADD_TXT2TAGS_FILES _sources)
COMMENT "Building ${_out}.html from ${_in}"
)

ADD_CUSTOM_COMMAND(
OUTPUT ${_out}.tex
COMMAND ${TXT2TAGS_EXECUTABLE}
ARGS -o${_out}.tex -t tex ${_in}
DEPENDS ${_in}
COMMENT "Building ${_out}.tex from ${_in}"
)

SET(${_sources} ${${_sources}} ${_out} ${_out}.html)
ENDFOREACH (_current_FILE)
ENDMACRO(ADD_TXT2TAGS_FILES)
35 changes: 31 additions & 4 deletions doc/CODING.t2t
Expand Up @@ -12,11 +12,37 @@ Developers guide for QGIS
%! PostProc(txt): '(?i)(\t)' ' '
%! encoding: iso-8859-1

%
% Tex processing
%
% Make sure this is first
%! PostProc(tex): '\\includegraphics' '\\includegraphics[width=100mm]'
% scartcl is from the koma script document class (apt-get install texlive-latex-recommended ttf-komatuna)
% setlength parindent suppresses first line of paragraph idents
% parskip puts blank space between paragraphs
% title pic stuff used to put a logo on the front page
%! PostProc(tex): '\\documentclass{article}' '\\documentclass{scrartcl}\n\\setlength{\\parindent}{0pt}\n\\setlength{\\parskip}{2ex}'
% use the color table and table packages so we can pimp the tables a little
%! PostProc(tex): '\\usepackage{style.css} % user defined' '\\usepackage{fancyvrb}\n\\usepackage{colortbl} \n\\usepackage [table]{xcolor}\n\\definecolor{tableShade}{HTML}{cecece}\n\\definecolor{qgis-green}{HTML}{0E7300}\n\\usepackage{wallpaper}\n\\LRCornerWallPaper{1}{WALLPAPER-IMAGE}\n\\usepackage{hyperref}\n\\hypersetup{linkcolor=qgis-green,urlcolor=qgis-green}\\renewcommand\\thesection{\\color{qgis-green}\\thechapter\\arabic{section}}'
% Make the header row of tables have a dark background. light text
%! PostProc(tex): '\\hline \\textbf' '\\hline \\rowcolor[rgb]{0,0,0} \\color{white} \\textbf'
%! PostProc(tex): '& \\textbf' '& \\color{white} \\textbf'
% Make verbatim text a little smaller and use fancyvrb package to draw it in a box
% Note Verbatim with capital V for fancyvrb to work
%! PostProc(tex): '\\begin{verbatim}' '{\\scriptsize\\begin{Verbatim}[frame=single,rulecolor=\\color{qgis-green}, framesep=4mm, label=\\fbox{\\small\\emph{Listing}}]'
%! PostProc(tex): '\\end{verbatim}' '\\end{Verbatim}\n}'
%! PostProc(tex): '\\section' '\\newpage\\section'
%! PostProc(tex): 'section{' 'section{\\color{qgis-green}'
%! PostProc(tex): NEWPAGE '\\newpage'
% Give alternating table rows different colours and use a smaller font in tables (\tiny)
%! PostProc(tex): '\\begin{tabular}' '\\rowcolors{2}{tableShade}{white} \n\\tiny\\begin{tabular}'
%! encoding: iso-8859-1

%! PostProc(tex): WALLPAPER-IMAGE 'qgis-footer.png'
% These are comments and will not be generated in any output
% -------------------

%This document is in text2tags format. You can generate html, plain text and
%This document is in txt2tags format. You can generate html, plain text and
%moinmoin formatted documentation by running txt2tags on this document. See the
%txt2tags home page for more details. Please insert manual line breaks in this
%document as it makes diffing for changes much easier. To do this in vim
Expand All @@ -26,12 +52,13 @@ Developers guide for QGIS

% To generate the text version of this document:
% txt2tags -t txt -o CODING CODING.t2t
% To generate the moinmoin version of this document:
% txt2tags -t moin -o CODING.moin CODING.t2t
% To generate the mediawiki version of this document:
% txt2tags -t wiki --no-enum-title -o CODING.wiki CODING.t2t
% To generate the html version of this document:
% txt2tags -t html -o CODING.html CODING.t2t
% To generate the LaTeX version of this document:
% txt2tags -t tex -o CODING.tex CODING.t2t
% txt2tags -t tex -o CODING.tex CODING.t2t; pdflatex CODING.tex

%
% End of comments
% -------------------
Expand Down
36 changes: 31 additions & 5 deletions doc/INSTALL.t2t
@@ -1,7 +1,6 @@
Quantum GIS (QGIS)

Building QGIS from source - step by step

%%date(%A %B %d, %Y)

%! target : html
%! style : style.css
Expand All @@ -12,6 +11,33 @@ Building QGIS from source - step by step
% Next line will replace tabs with 2 spaces in txt generated outputs
%! PostProc(txt): '(?i)(\t)' ' '
%! encoding: iso-8859-1
%
% Tex processing
%
% Make sure this is first
%! PostProc(tex): '\\includegraphics' '\\includegraphics[width=100mm]'
% scartcl is from the koma script document class (apt-get install texlive-latex-recommended ttf-komatuna)
% setlength parindent suppresses first line of paragraph idents
% parskip puts blank space between paragraphs
% title pic stuff used to put a logo on the front page
%! PostProc(tex): '\\documentclass{article}' '\\documentclass{scrartcl}\n\\setlength{\\parindent}{0pt}\n\\setlength{\\parskip}{2ex}'
% use the color table and table packages so we can pimp the tables a little
%! PostProc(tex): '\\usepackage{style.css} % user defined' '\\usepackage{fancyvrb}\n\\usepackage{colortbl} \n\\usepackage [table]{xcolor}\n\\definecolor{tableShade}{HTML}{cecece}\n\\definecolor{qgis-green}{HTML}{0E7300}\n\\usepackage{wallpaper}\n\\LRCornerWallPaper{1}{WALLPAPER-IMAGE}\n\\usepackage{hyperref}\n\\hypersetup{linkcolor=qgis-green,urlcolor=qgis-green}\\renewcommand\\thesection{\\color{qgis-green}\\thechapter\\arabic{section}}'
% Make the header row of tables have a dark background. light text
%! PostProc(tex): '\\hline \\textbf' '\\hline \\rowcolor[rgb]{0,0,0} \\color{white} \\textbf'
%! PostProc(tex): '& \\textbf' '& \\color{white} \\textbf'
% Make verbatim text a little smaller and use fancyvrb package to draw it in a box
% Note Verbatim with capital V for fancyvrb to work
%! PostProc(tex): '\\begin{verbatim}' '{\\scriptsize\\begin{Verbatim}[frame=single,rulecolor=\\color{qgis-green}, framesep=4mm, label=\\fbox{\\small\\emph{Listing}}]'
%! PostProc(tex): '\\end{verbatim}' '\\end{Verbatim}\n}'
%! PostProc(tex): '\\section' '\\newpage\\section'
%! PostProc(tex): 'section{' 'section{\\color{qgis-green}'
%! PostProc(tex): NEWPAGE '\\newpage'
% Give alternating table rows different colours and use a smaller font in tables (\tiny)
%! PostProc(tex): '\\begin{tabular}' '\\rowcolors{2}{tableShade}{white} \n\\tiny\\begin{tabular}'
%! encoding: iso-8859-1

%! PostProc(tex): WALLPAPER-IMAGE 'qgis-footer.png'
% These are comments and will not be generated in any output
% -------------------

Expand All @@ -30,13 +56,13 @@ Building QGIS from source - step by step
% To generate the html version of this document:
% txt2tags -t html -o INSTALL.html INSTALL.t2t
% To generate the LaTeX version of this document:
% txt2tags -t tex -o INSTALL.tex INSTALL.t2t
% txt2tags -t tex -o INSTALL.tex INSTALL.t2t; pdflatex INSTALL.tex

% End of comments
% -------------------

Last update: %%date
Last change: %%mtime
Last Updated: %%date(%A %B %d, %Y)
Last Change : %%mtime(%A %B %d, %Y)

%%toc

Expand Down
3 changes: 3 additions & 0 deletions doc/iauthors.t2t
Expand Up @@ -26,3 +26,6 @@ The following people have contributed to this document:
- GNU/Linux Section
- Tim Sutton 2006
- Debian package section: Juergen Fischer 2008

- Latex Generator
- Tim Sutton 2011
Binary file added doc/qgis-footer.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/qgis-footer.xcf
Binary file not shown.
3 changes: 3 additions & 0 deletions python/core/qgscomposeritem.sip
Expand Up @@ -253,6 +253,9 @@ class QgsComposerItem: QObject, QGraphicsRectItem

double rotation() const;

/**Updates item, with the possibility to do custom update for subclasses*/
virtual void updateItem();

public slots:
virtual void setRotation( double r);

Expand Down
6 changes: 5 additions & 1 deletion python/core/qgscomposermap.sip
Expand Up @@ -94,7 +94,7 @@ class QgsComposerMap : QgsComposerItem
/**Sets new Extent and changes width, height (and implicitely also scale)*/
void setNewExtent( const QgsRectangle& extent );

PreviewMode previewMode();
PreviewMode previewMode() const;
void setPreviewMode( PreviewMode m );

/**Getter for flag that determines if the stored layer set should be used or the current layer set of the qgis mapcanvas
Expand Down Expand Up @@ -222,6 +222,10 @@ class QgsComposerMap : QgsComposerItem
void setCrossLength(double l);
double crossLength();

void setMapRotation( double r );

void updateItem();

public slots:

/**Called if map canvas has changed*/
Expand Down
62 changes: 52 additions & 10 deletions src/app/composer/qgscomposer.cpp
Expand Up @@ -371,16 +371,6 @@ void QgsComposer::changeEvent( QEvent* event )
break;
}
}

void QgsComposer::showEvent( QShowEvent *event )
{
QMainWindow::showEvent( event );
// add to menu if (re)opening window (event not due to unminimize)
if ( !event->spontaneous() )
{
QgisApp::instance()->addWindow( mWindowAction );
}
}
#endif

void QgsComposer::setTitle( const QString& title )
Expand Down Expand Up @@ -1123,6 +1113,30 @@ void QgsComposer::resizeEvent( QResizeEvent *e )
saveWindowState();
}

void QgsComposer::showEvent( QShowEvent* event )
{
if ( event->spontaneous() ) //event from the window system
{
//go through maps and restore original preview modes (show on demand after loading from project file)
QMap< QgsComposerMap*, QgsComposerMap::PreviewMode >::iterator mapIt = mMapsToRestore.begin();
for ( ; mapIt != mMapsToRestore.end(); ++mapIt )
{
mapIt.key()->setPreviewMode( mapIt.value() );
mapIt.key()->cache();
mapIt.key()->update();
}
mMapsToRestore.clear();
}

#ifdef Q_WS_MAC
// add to menu if (re)opening window (event not due to unminimize)
if ( !event->spontaneous() )
{
QgisApp::instance()->addWindow( mWindowAction );
}
#endif
}

void QgsComposer::saveWindowState()
{
QSettings settings;
Expand Down Expand Up @@ -1169,6 +1183,14 @@ void QgsComposer::writeXML( QDomNode& parentNode, QDomDocument& doc )
QDomElement composerElem = doc.createElement( "Composer" );
composerElem.setAttribute( "title", mTitle );

//change preview mode of minimised / hidden maps before saving XML (show contents only on demand)
QMap< QgsComposerMap*, QgsComposerMap::PreviewMode >::iterator mapIt = mMapsToRestore.begin();
for ( ; mapIt != mMapsToRestore.end(); ++mapIt )
{
mapIt.key()->setPreviewMode( mapIt.value() );
}
mMapsToRestore.clear();

//store if composer is open or closed
if ( isVisible() )
{
Expand Down Expand Up @@ -1283,6 +1305,20 @@ void QgsComposer::readXML( const QDomElement& composerElem, const QDomDocument&
QDomElement currentComposerMapElem = composerMapList.at( i ).toElement();
QgsComposerMap* newMap = new QgsComposerMap( mComposition );
newMap->readXML( currentComposerMapElem, doc );

if ( fromTemplate ) //show map directly if loaded from template
{
newMap->updateItem();
}
else //show map only on demand if loaded from project
{
if ( newMap->previewMode() != QgsComposerMap::Rectangle )
{
mMapsToRestore.insert( newMap, newMap->previewMode() );
newMap->setPreviewMode( QgsComposerMap::Rectangle );
}
}

addComposerMap( newMap );
mComposition->addItem( newMap );
mComposition->update();
Expand Down Expand Up @@ -1518,6 +1554,12 @@ void QgsComposer::deleteItem( QgsComposerItem* item )
//the item itself is not deleted here (usually, this is done in the destructor of QgsAddRemoveItemCommand)
delete( it.value() );
mItemWidgetMap.remove( it.key() );

QgsComposerMap* map = dynamic_cast<QgsComposerMap*>( item );
if ( map )
{
mMapsToRestore.remove( map );
}
}

void QgsComposer::setSelectionTool()
Expand Down
11 changes: 6 additions & 5 deletions src/app/composer/qgscomposer.h
Expand Up @@ -18,15 +18,14 @@
#ifndef QGSCOMPOSER_H
#define QGSCOMPOSER_H
#include "ui_qgscomposerbase.h"
#include "qgscomposeritem.h"
#include "qgscomposermap.h"
#include "qgscontexthelp.h"
#include <QPrinter>

class QgisApp;
class QgsComposerArrow;
class QgsComposerLabel;
class QgsComposerLegend;
class QgsComposerMap;
class QgsComposerPicture;
class QgsComposerScaleBar;
class QgsComposerShape;
Expand Down Expand Up @@ -93,12 +92,11 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
//! Resize event
virtual void resizeEvent( QResizeEvent * );

virtual void showEvent( QShowEvent* event );

#ifdef Q_WS_MAC
//! Change event (update window menu on ActivationChange)
virtual void changeEvent( QEvent * );

//! Show event (add window to menu)
virtual void showEvent( QShowEvent * );
#endif

signals:
Expand Down Expand Up @@ -321,6 +319,9 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
QPrinter mPrinter;

QUndoView* mUndoView;

//! We load composer map content from project xml only on demand. Therefore we need to store the real preview mode type
QMap< QgsComposerMap*, QgsComposerMap::PreviewMode > mMapsToRestore;
};

#endif
2 changes: 2 additions & 0 deletions src/app/composer/qgscomposermapwidget.cpp
Expand Up @@ -269,10 +269,12 @@ void QgsComposerMapWidget::updateGuiElements()
if ( previewMode == QgsComposerMap::Cache )
{
index = mPreviewModeComboBox->findText( tr( "Cache" ) );
mUpdatePreviewButton->setEnabled( true );
}
else if ( previewMode == QgsComposerMap::Render )
{
index = mPreviewModeComboBox->findText( tr( "Render" ) );
mUpdatePreviewButton->setEnabled( true );
}
else if ( previewMode == QgsComposerMap::Rectangle )
{
Expand Down
2 changes: 2 additions & 0 deletions src/core/composer/qgscomposeritem.cpp
Expand Up @@ -568,6 +568,7 @@ void QgsComposerItem::changeItemRectangle( const QPointF& currentPosition, const
changeComposerItem->setSceneRect( QRectF( originalItem->transform().dx() + moveRectX,
originalItem->transform().dy() + moveRectY,
originalItem->rect().width(), originalItem->rect().height() ) );
changeComposerItem->updateItem();
}
}
return;
Expand All @@ -587,6 +588,7 @@ void QgsComposerItem::changeItemRectangle( const QPointF& currentPosition, const
{
changeComposerItem->setSceneRect( QRectF( originalItem->transform().dx() + mx, originalItem->transform().dy() + my,
originalItem->rect().width() + rx, originalItem->rect().height() + ry ) );
changeComposerItem->updateItem();
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/core/composer/qgscomposeritem.h
Expand Up @@ -217,6 +217,9 @@ class CORE_EXPORT QgsComposerItem: public QObject, public QGraphicsRectItem

double rotation() const {return mRotation;}

/**Updates item, with the possibility to do custom update for subclasses*/
virtual void updateItem() { QGraphicsRectItem::update(); }

public slots:
virtual void setRotation( double r );
void repaint();
Expand Down

0 comments on commit ffed1d7

Please sign in to comment.