equal
deleted
inserted
replaced
|
1 /* |
|
2 * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef LAYSCALE_H |
|
20 #define LAYSCALE_H |
|
21 |
|
22 #include <string> |
|
23 #include <vector> |
|
24 #include <iosfwd> |
|
25 #include "Layout.h" |
|
26 using namespace std; |
|
27 |
|
28 #include <cdlcompilertoolkit/cdltkinterface.h> |
|
29 using namespace CdlCompilerToolkit; |
|
30 |
|
31 |
|
32 /** |
|
33 * LayoutScale |
|
34 * Compiler mode for rescaling a layout |
|
35 */ |
|
36 class LayoutScale |
|
37 { |
|
38 public: |
|
39 static int Process(const vector<string>& args); |
|
40 static void ShowHelp(ostream& stream); |
|
41 |
|
42 private: |
|
43 LayoutScale(TLayout& aSourceLayout, int aSourceWidth, int aSourceHeight, const string& aDestLayoutName, int aDestWidth, int aDestHeight); |
|
44 void Run(); |
|
45 void RescaleLayout(); |
|
46 void WriteLayout(); |
|
47 |
|
48 private: |
|
49 enum TScale {EHoriz, EVert}; |
|
50 void RescaleValue(string& aVal, TScale aDir); |
|
51 string RescaleNum(string& aNum, TScale aDir); |
|
52 void TagScaledToken(string& aToken); |
|
53 int Scale(int aNumber, int aNumerator, int aDenominator); |
|
54 |
|
55 private: |
|
56 TLayout& iLayout; |
|
57 int iSourceWidth; |
|
58 int iSourceHeight; |
|
59 const string& iDestLayoutName; |
|
60 int iDestWidth; |
|
61 int iDestHeight; |
|
62 }; |
|
63 |
|
64 |
|
65 #endif |