~ubuntu-branches/ubuntu/breezy/koffice/breezy

« back to all changes in this revision

Viewing changes to kpresenter/rotationdialogimpl.cc

  • Committer: Bazaar Package Importer
  • Author(s): Ben Burton
  • Date: 2004-05-09 11:33:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040509113300-vfrdadqsvjfuhn3b
Tags: 1:1.3.1-1
* New upstream bugfix release.
* Built against newer imagemagick (closes: #246623).
* Made koffice-libs/kformula recommend/depend on latex-xft-fonts, which
  provides mathematical fonts that the formula editor can use.  Also
  patched the kformula part to make these fonts the default.
* Changed kword menu hint from "WordProcessors" to "Word processors"
  (closes: #246209).
* Spellchecker configuration is now fixed (closes: #221256, #227568).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4; -*-
 
2
#include <qradiobutton.h>
 
3
#include <qgroupbox.h>
 
4
#include <qlayout.h>
 
5
#include <qbuttongroup.h>
 
6
 
 
7
#include <kdebug.h>
 
8
#include <knuminput.h>
 
9
 
 
10
#include "rotationdialogimpl.h"
 
11
#include "textpreview.h"
 
12
 
 
13
RotationDialogImpl::RotationDialogImpl( QWidget *parent, const char* name )
 
14
    :  RotationDialogBase( parent, name )
 
15
{
 
16
    _preview = new TextPreview( previewPanel );
 
17
    QHBoxLayout *lay = new QHBoxLayout( previewPanel, previewPanel->lineWidth(), 0 );
 
18
    lay->addWidget( _preview );
 
19
 
 
20
    customInput->setRange( 0, 360, 0.1, TRUE );
 
21
    connect( customRadio, SIGNAL( toggled( bool ) ),
 
22
             customInput, SLOT( setEnabled( bool ) ) );
 
23
    connect( customInput, SIGNAL( valueChanged( double ) ),
 
24
             this, SLOT( angleChanged( double ) ) );
 
25
}
 
26
 
 
27
void RotationDialogImpl::applyClicked()
 
28
{
 
29
    emit apply();
 
30
}
 
31
 
 
32
void RotationDialogImpl::okClicked()
 
33
{
 
34
    applyClicked();
 
35
    accept();
 
36
}
 
37
 
 
38
void RotationDialogImpl::setAngle( double angle )
 
39
{
 
40
    customInput->setValue( angle );
 
41
 
 
42
    if ( angle == 90
 
43
         || angle == 180
 
44
         || angle == 270 )
 
45
        angleGroup->setButton( (int)angle );
 
46
    else if ( angle == 0 )
 
47
        angleGroup->setButton( 1 );
 
48
    else
 
49
        angleGroup->setButton( 0 );
 
50
}
 
51
 
 
52
double RotationDialogImpl::angle()
 
53
{
 
54
    int id = angleGroup->id( angleGroup->selected() );
 
55
 
 
56
    switch( id ) {
 
57
    case 1:
 
58
        return 0;
 
59
    case 90:
 
60
        return 90;
 
61
    case 180:
 
62
        return 180;
 
63
    case 270:
 
64
        return 270;
 
65
    default:
 
66
        return customInput->value();
 
67
    }
 
68
}
 
69
 
 
70
void RotationDialogImpl::angleChanged( double a )
 
71
{
 
72
    _preview->setAngle( a );
 
73
}
 
74
 
 
75
void RotationDialogImpl::angleMode( int id )
 
76
{
 
77
    double a = 0;
 
78
    if ( id == 1 )
 
79
        a = 0;
 
80
    else if ( id == 90 || id == 180 || id == 270 )
 
81
        a = id;
 
82
    else
 
83
        a = customInput->value();
 
84
    _preview->setAngle( a );
 
85
}
 
86
#include "rotationdialogimpl.moc"