changed: lists on the convertion tab can be resized now
added: conversion's list: lenght, area, time git-svn-id: svn://ttmath.org/publicrep/ttcalc/trunk@55 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
d33a6925b1
commit
ae0a8dc911
|
@ -250,10 +250,10 @@ void Languages::InitGuiMessagesTab()
|
||||||
InsertGuiPair(display_always_scientific,"Always");
|
InsertGuiPair(display_always_scientific,"Always");
|
||||||
InsertGuiPair(display_not_always_scientific,"When the exponent is greater than:");
|
InsertGuiPair(display_not_always_scientific,"When the exponent is greater than:");
|
||||||
InsertGuiPair(display_group_scientific, "Print the result as the scientific value");
|
InsertGuiPair(display_group_scientific, "Print the result as the scientific value");
|
||||||
InsertGuiPair(convert_type, "Conversion type");
|
InsertGuiPair(convert_type, "Type");
|
||||||
InsertGuiPair(convert_input, "Input");
|
InsertGuiPair(convert_input, "Input");
|
||||||
InsertGuiPair(convert_output, "Output");
|
InsertGuiPair(convert_output, "Output");
|
||||||
InsertGuiPair(convert_dynamic_output, "auto output");
|
InsertGuiPair(convert_dynamic_output, "Auto prefix");
|
||||||
|
|
||||||
InsertGuiPair(menu_view, "&View");
|
InsertGuiPair(menu_view, "&View");
|
||||||
InsertGuiPair(menu_edit, "&Edit");
|
InsertGuiPair(menu_edit, "&Edit");
|
||||||
|
@ -372,10 +372,10 @@ void Languages::InitGuiMessagesTab()
|
||||||
InsertGuiPair(display_always_scientific,"Zawsze");
|
InsertGuiPair(display_always_scientific,"Zawsze");
|
||||||
InsertGuiPair(display_not_always_scientific,"Jeœli eksponent jest wiêkszy ni¿:");
|
InsertGuiPair(display_not_always_scientific,"Jeœli eksponent jest wiêkszy ni¿:");
|
||||||
InsertGuiPair(display_group_scientific, "Wyœwietl wynik w postaci naukowej");
|
InsertGuiPair(display_group_scientific, "Wyœwietl wynik w postaci naukowej");
|
||||||
InsertGuiPair(convert_type, "Rodzaj konwersji");
|
InsertGuiPair(convert_type, "Typ");
|
||||||
InsertGuiPair(convert_input, "Wejœcie");
|
InsertGuiPair(convert_input, "Wejœcie");
|
||||||
InsertGuiPair(convert_output, "Wyjœcie");
|
InsertGuiPair(convert_output, "Wyjœcie");
|
||||||
InsertGuiPair(convert_dynamic_output, "Automatycznie");
|
InsertGuiPair(convert_dynamic_output, "Automatyczny prefiks");
|
||||||
|
|
||||||
InsertGuiPair(menu_view, "&Widok");
|
InsertGuiPair(menu_view, "&Widok");
|
||||||
InsertGuiPair(menu_edit, "&Edycja");
|
InsertGuiPair(menu_edit, "&Edycja");
|
||||||
|
@ -454,7 +454,20 @@ void Languages::ConvertingAddUnit(const char * name, double v)
|
||||||
ConvUnit temp;
|
ConvUnit temp;
|
||||||
temp.name = name;
|
temp.name = name;
|
||||||
temp.type = static_cast<int>(converting_type.back().size()-1);
|
temp.type = static_cast<int>(converting_type.back().size()-1);
|
||||||
temp.value = v;
|
temp.value.FromDouble(v);
|
||||||
|
|
||||||
|
converting_unit.back().push_back(temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Languages::ConvertingAddUnit(const char * name, const char * v)
|
||||||
|
{
|
||||||
|
if( converting_type.empty() || converting_type.back().empty() || converting_unit.empty() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
ConvUnit temp;
|
||||||
|
temp.name = name;
|
||||||
|
temp.type = static_cast<int>(converting_type.back().size()-1);
|
||||||
|
temp.value.FromString(v, 16);
|
||||||
|
|
||||||
converting_unit.back().push_back(temp);
|
converting_unit.back().push_back(temp);
|
||||||
}
|
}
|
||||||
|
@ -468,14 +481,70 @@ void Languages::InitConverting()
|
||||||
|
|
||||||
ConvertingAddType("none");
|
ConvertingAddType("none");
|
||||||
|
|
||||||
ConvertingAddType("length");
|
/*
|
||||||
ConvertingAddUnit("metre", 1);
|
yard = 0.9144 metre
|
||||||
ConvertingAddUnit("mile", 1600);
|
foot = 1/3 yard = 0.3048 metre
|
||||||
|
inch = 1/36 yard = 1/12 foot = 0.0254 metre
|
||||||
|
|
||||||
ConvertingAddType("area");
|
In 1958 the United States and countries of the Commonwealth of Nations
|
||||||
ConvertingAddUnit("are", 10);
|
defined the length of the international yard to be precisely 0.9144 metres.
|
||||||
ConvertingAddUnit("square metre", 1);
|
*/
|
||||||
|
ConvertingAddType("length"); // base: 10000 metre
|
||||||
|
ConvertingAddUnit("inch", 254.0 );
|
||||||
|
ConvertingAddUnit("foot", 3048.0);
|
||||||
|
ConvertingAddUnit("yard", 9144.0);
|
||||||
|
ConvertingAddUnit("metre", 10000.0 );
|
||||||
|
ConvertingAddUnit("mile (land)", 16093440.0); // 1 land mile = 1609.344 metres
|
||||||
|
ConvertingAddUnit("mile (nautical)", 18520000.0); // 1 nautical mile = 1852 metres
|
||||||
|
ConvertingAddUnit("light year", "520F0AA65AAEBAC00"); // 1 ly = 9 460 730 472 580 800 metres
|
||||||
|
// 520F0AA65AAEBAC00 (hex) = 94607304725808000000 (dec)
|
||||||
|
|
||||||
|
/*
|
||||||
|
yard^2 = 0.83612736 metre^2
|
||||||
|
foot^2 = 1/9 yard^2 = 0.09290304 metre^2
|
||||||
|
inch^2 = 1/1296 yard^2 = 1/144 foot^ = 0.00064516 metre^2
|
||||||
|
|
||||||
|
ar = 100 metre^2
|
||||||
|
hectere = 10000 metre^2
|
||||||
|
*/
|
||||||
|
ConvertingAddType("area"); // base: 100 000 000 metre^2
|
||||||
|
ConvertingAddUnit("inch^2", 64516.0);
|
||||||
|
ConvertingAddUnit("foot^2", 9290304.0);
|
||||||
|
ConvertingAddUnit("yard^2", 83612736.0);
|
||||||
|
ConvertingAddUnit("metre^2", 100000000.0);
|
||||||
|
ConvertingAddUnit("are", 10000000000.0);
|
||||||
|
ConvertingAddUnit("hectare", 1000000000000.0);
|
||||||
|
ConvertingAddUnit("mile (land)^2", 258998811033600.0 ); // 1 land mile^2 = 2589988.110336 metres^2
|
||||||
|
ConvertingAddUnit("mile (nautical)^2", 342990400000000.0); // 1 nautical mile^2 = 3429904 metres^2
|
||||||
|
ConvertingAddUnit("light year^2", "1A4DA3B4D207FB4C43D08391653B900000"); // 1 ly = 89505421074818927300612528640000 metres^2
|
||||||
|
// 1A4DA3B4D207FB4C43D08391653B900000 (hex) = 8950542107481892730061252864000000000000 (dec)
|
||||||
|
|
||||||
|
ConvertingAddType("time"); // base: second
|
||||||
|
ConvertingAddUnit("second", 1.0);
|
||||||
|
ConvertingAddUnit("minute", 60.0);
|
||||||
|
ConvertingAddUnit("hour", 3600.0);
|
||||||
|
ConvertingAddUnit("day", 86400.0);
|
||||||
|
ConvertingAddUnit("week", 604800.0);
|
||||||
|
ConvertingAddUnit("fortnight", 1209600.0);
|
||||||
|
ConvertingAddUnit("month", 2592000.0);
|
||||||
|
ConvertingAddUnit("year", 31536000.0);
|
||||||
|
ConvertingAddUnit("year (mean)", 31557600.0);
|
||||||
|
ConvertingAddUnit("year (leap)", 31622400.0);
|
||||||
|
ConvertingAddUnit("decade", 315360000.0);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
ConvertingAddUnit("", );
|
||||||
|
ConvertingAddUnit("", );
|
||||||
|
ConvertingAddUnit("", );
|
||||||
|
ConvertingAddUnit("", );
|
||||||
|
ConvertingAddUnit("", );
|
||||||
|
ConvertingAddUnit("", );
|
||||||
|
ConvertingAddUnit("", );
|
||||||
|
ConvertingAddUnit("", );
|
||||||
|
ConvertingAddUnit("", );
|
||||||
|
ConvertingAddUnit("", );
|
||||||
|
*/
|
||||||
|
|
||||||
// pl
|
// pl
|
||||||
// the 'value' param we're using only from the english
|
// the 'value' param we're using only from the english
|
||||||
|
@ -485,12 +554,38 @@ void Languages::InitConverting()
|
||||||
ConvertingAddType("brak");
|
ConvertingAddType("brak");
|
||||||
|
|
||||||
ConvertingAddType("d³ugoœæ");
|
ConvertingAddType("d³ugoœæ");
|
||||||
ConvertingAddUnit("metr");
|
ConvertingAddUnit("cal", 0.0 );
|
||||||
ConvertingAddUnit("mila");
|
ConvertingAddUnit("stopa", 0.0);
|
||||||
|
ConvertingAddUnit("jard", 0.0);
|
||||||
|
ConvertingAddUnit("metr", 0.0);
|
||||||
|
ConvertingAddUnit("mila (angielska)", 0.0);
|
||||||
|
ConvertingAddUnit("mila (morska)", 0.0);
|
||||||
|
ConvertingAddUnit("rok œwietlny", 0.0);
|
||||||
|
|
||||||
|
ConvertingAddType("powierzchnia");
|
||||||
|
ConvertingAddUnit("cal^2", 0.0);
|
||||||
|
ConvertingAddUnit("stopa^2", 0.0);
|
||||||
|
ConvertingAddUnit("jard^2", 0.0);
|
||||||
|
ConvertingAddUnit("metr^2", 0.0);
|
||||||
|
ConvertingAddUnit("ar", 0.0);
|
||||||
|
ConvertingAddUnit("hektar", 0.0);
|
||||||
|
ConvertingAddUnit("mila (angielska)^2", 0.0);
|
||||||
|
ConvertingAddUnit("mila (morska)^2", 0.0);
|
||||||
|
ConvertingAddUnit("rok œwietlny^2", 0.0);
|
||||||
|
|
||||||
|
ConvertingAddType("czas");
|
||||||
|
ConvertingAddUnit("sekunda", 0.0);
|
||||||
|
ConvertingAddUnit("minuta", 0.0);
|
||||||
|
ConvertingAddUnit("godzina", 0.0);
|
||||||
|
ConvertingAddUnit("dzieñ", 0.0);
|
||||||
|
ConvertingAddUnit("tydzieñ", 0.0);
|
||||||
|
ConvertingAddUnit("dwa tygodnie", 0.0);
|
||||||
|
ConvertingAddUnit("miesi¹c", 0.0);
|
||||||
|
ConvertingAddUnit("rok", 0.0);
|
||||||
|
ConvertingAddUnit("rok (œredni)", 0.0);
|
||||||
|
ConvertingAddUnit("rok (przestêpny)", 0.0);
|
||||||
|
ConvertingAddUnit("dekada", 0.0);
|
||||||
|
|
||||||
ConvertingAddType("obszar");
|
|
||||||
ConvertingAddUnit("ar");
|
|
||||||
ConvertingAddUnit("metr kwadratowy");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -600,13 +695,13 @@ int Languages::ConvertingUnitType(int id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// value is taken only from english
|
// value is taken only from english
|
||||||
double Languages::ConvertingUnitValue(int id)
|
const Languages::ConvUnit::ValueType & Languages::ConvertingUnitValue(int id)
|
||||||
{
|
{
|
||||||
if( converting_unit.empty() )
|
if( converting_unit.empty() )
|
||||||
InitConverting();
|
InitConverting();
|
||||||
|
|
||||||
if( id >= static_cast<int>(converting_unit[0].size()) )
|
if( id >= static_cast<int>(converting_unit[0].size()) )
|
||||||
return -1.0;
|
return foo_return;
|
||||||
|
|
||||||
return converting_unit[0][id].value;
|
return converting_unit[0][id].value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,8 +42,7 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <ttmath/ttmathtypes.h>
|
#include <ttmath/ttmath.h>
|
||||||
|
|
||||||
|
|
||||||
class Languages
|
class Languages
|
||||||
{
|
{
|
||||||
|
@ -152,14 +151,19 @@ public:
|
||||||
// int id;
|
// int id;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct ConvUnit
|
struct ConvUnit
|
||||||
{
|
{
|
||||||
std::string name;
|
std::string name;
|
||||||
// int id;
|
// int id;
|
||||||
int type;
|
int type;
|
||||||
double value;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
typedef ttmath::Big<3,27> ValueType;
|
||||||
|
ValueType value;
|
||||||
|
};
|
||||||
|
|
||||||
|
ConvUnit::ValueType foo_return;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -174,11 +178,15 @@ private:
|
||||||
void InsertGuiPair(GuiMsg code, const char * message);
|
void InsertGuiPair(GuiMsg code, const char * message);
|
||||||
void InitGuiMessagesTab();
|
void InitGuiMessagesTab();
|
||||||
|
|
||||||
|
|
||||||
std::vector<std::vector<ConvType> > converting_type;
|
std::vector<std::vector<ConvType> > converting_type;
|
||||||
std::vector<std::vector<ConvUnit> > converting_unit;
|
std::vector<std::vector<ConvUnit> > converting_unit;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ConvertingAddType(const char * name);
|
void ConvertingAddType(const char * name);
|
||||||
void ConvertingAddUnit(const char * name, double v = 1);
|
void ConvertingAddUnit(const char * name, double v);
|
||||||
|
void ConvertingAddUnit(const char * name, const char * v);
|
||||||
|
|
||||||
void InitConverting();
|
void InitConverting();
|
||||||
|
|
||||||
|
@ -187,6 +195,7 @@ public:
|
||||||
Languages()
|
Languages()
|
||||||
{
|
{
|
||||||
current_country = en;
|
current_country = en;
|
||||||
|
foo_return = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetCurrentLanguage(Country c)
|
void SetCurrentLanguage(Country c)
|
||||||
|
@ -216,7 +225,7 @@ public:
|
||||||
int ConvertingTypeSize();
|
int ConvertingTypeSize();
|
||||||
int ConvertingUnitSize();
|
int ConvertingUnitSize();
|
||||||
|
|
||||||
double ConvertingUnitValue(int id);
|
const ConvUnit::ValueType & ConvertingUnitValue(int id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -682,29 +682,32 @@ POINT p;
|
||||||
if( fwSizeType == SIZE_RESTORED )
|
if( fwSizeType == SIZE_RESTORED )
|
||||||
GetPrgRes()->SetMaximized(false);
|
GetPrgRes()->SetMaximized(false);
|
||||||
|
|
||||||
|
// client area
|
||||||
int cx = LOWORD(lParam);
|
int cx = LOWORD(lParam);
|
||||||
int cy = HIWORD(lParam);
|
int cy = HIWORD(lParam);
|
||||||
|
int resize_flags = SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOOWNERZORDER;
|
||||||
|
|
||||||
GetWindowRect(GetDlgItem(hWnd,IDC_INPUT_EDIT),&r);
|
HWND input_edit = GetDlgItem(hWnd, IDC_INPUT_EDIT);
|
||||||
|
GetWindowRect(input_edit, &r);
|
||||||
|
SetWindowPos(input_edit, 0, 0, 0, cx, r.bottom-r.top, resize_flags);
|
||||||
|
|
||||||
|
HWND output_edit = GetDlgItem(hWnd, IDC_OUTPUT_EDIT);
|
||||||
|
GetWindowRect(output_edit, &r);
|
||||||
|
SetWindowPos(output_edit, 0, 0, 0, cx, r.bottom-r.top, resize_flags);
|
||||||
|
|
||||||
|
HWND tab = GetDlgItem(hWnd, IDC_TAB);
|
||||||
|
GetWindowRect(tab, &r);
|
||||||
p.x = r.left;
|
p.x = r.left;
|
||||||
p.y = r.top;
|
p.y = r.top;
|
||||||
ScreenToClient(hWnd,&p);
|
ScreenToClient(hWnd,&p);
|
||||||
MoveWindow(GetDlgItem(hWnd,IDC_INPUT_EDIT),p.x, p.y, cx, r.bottom-r.top, true);
|
SetWindowPos(tab, 0, 0, 0, cx, cy-p.y, resize_flags);
|
||||||
|
|
||||||
GetWindowRect(GetDlgItem(hWnd,IDC_OUTPUT_EDIT),&r);
|
int borderx = GetSystemMetrics(SM_CXDLGFRAME) * 2;
|
||||||
p.x = r.left;
|
int bordery = GetSystemMetrics(SM_CYDLGFRAME) * 2;
|
||||||
p.y = r.top;
|
|
||||||
ScreenToClient(hWnd,&p);
|
|
||||||
MoveWindow(GetDlgItem(hWnd,IDC_OUTPUT_EDIT),p.x, p.y, cx, r.bottom-r.top, true);
|
|
||||||
|
|
||||||
GetWindowRect(GetDlgItem(hWnd,IDC_TAB),&r);
|
TabWindowFunctions::SetSizeOfVariablesList(tab, cx, cy-p.y, borderx, bordery);
|
||||||
p.x = r.left;
|
TabWindowFunctions::SetSizeOfFunctionsList(tab, cx, cy-p.y, borderx, bordery);
|
||||||
p.y = r.top;
|
TabWindowFunctions::SetSizeOfConvertingLists(tab, cx, cy-p.y, borderx, bordery);
|
||||||
ScreenToClient(hWnd,&p);
|
|
||||||
MoveWindow(GetDlgItem(hWnd,IDC_TAB),p.x, p.y, cx, cy-p.y, true);
|
|
||||||
|
|
||||||
TabWindowFunctions::SetSizeOfVariablesList();
|
|
||||||
TabWindowFunctions::SetSizeOfFunctionsList();
|
|
||||||
|
|
||||||
if( fwSizeType != SIZE_MINIMIZED )
|
if( fwSizeType != SIZE_MINIMIZED )
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include <ttmath/ttmathparser.h>
|
#include <ttmath/ttmath.h>
|
||||||
#include "programresources.h"
|
#include "programresources.h"
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
@ -106,9 +106,16 @@ public:
|
||||||
private:
|
private:
|
||||||
|
|
||||||
#ifndef TTCALC_PORTABLE
|
#ifndef TTCALC_PORTABLE
|
||||||
|
|
||||||
|
/*
|
||||||
|
// old ones
|
||||||
ttmath::Parser<ttmath::Big<1,3> > parser1;
|
ttmath::Parser<ttmath::Big<1,3> > parser1;
|
||||||
ttmath::Parser<ttmath::Big<2,6> > parser2;
|
ttmath::Parser<ttmath::Big<2,6> > parser2;
|
||||||
ttmath::Parser<ttmath::Big<3,9> > parser3;
|
ttmath::Parser<ttmath::Big<3,9> > parser3;
|
||||||
|
*/
|
||||||
|
ttmath::Parser<ttmath::Big<1,3> > parser1;
|
||||||
|
ttmath::Parser<ttmath::Big<2,9> > parser2;
|
||||||
|
ttmath::Parser<ttmath::Big<3,27> > parser3;
|
||||||
#else
|
#else
|
||||||
ttmath::Parser<ttmath::Big<1,3> > parser1;
|
ttmath::Parser<ttmath::Big<1,3> > parser1;
|
||||||
#endif
|
#endif
|
||||||
|
@ -145,15 +152,13 @@ private:
|
||||||
|
|
||||||
if( input!=-1 && output!=-1 && input!=output )
|
if( input!=-1 && output!=-1 && input!=output )
|
||||||
{
|
{
|
||||||
double vinput = GetPrgRes()->GetLanguages()->ConvertingUnitValue(input);
|
ValueType vinput, voutput;
|
||||||
double voutput = GetPrgRes()->GetLanguages()->ConvertingUnitValue(output);
|
|
||||||
|
|
||||||
ValueType vinputbig, voutputbig;
|
vinput.FromBig( GetPrgRes()->GetLanguages()->ConvertingUnitValue(input) );
|
||||||
vinputbig.FromDouble(vinput);
|
voutput.FromBig( GetPrgRes()->GetLanguages()->ConvertingUnitValue(output) );
|
||||||
voutputbig.FromDouble(voutput);
|
|
||||||
|
|
||||||
c += result.Mul(voutputbig);
|
c += result.Mul(vinput);
|
||||||
c += result.Div(vinputbig);
|
c += result.Div(voutput);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -197,23 +197,28 @@ STYLE DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_CAPTION | WS_GROUP |
|
||||||
CAPTION "tab6"
|
CAPTION "tab6"
|
||||||
FONT 8, "Ms Shell Dlg"
|
FONT 8, "Ms Shell Dlg"
|
||||||
BEGIN
|
BEGIN
|
||||||
LTEXT "Conversion type",IDC_STATIC_UNIT_CONVERSION,3,2,63,8
|
LTEXT "Conversion type",IDC_STATIC_UNIT_CONVERSION,3,2,55,8
|
||||||
LTEXT "Input",IDC_STATIC_UNIT_INPUT,80,2,73,8
|
LTEXT "Input",IDC_STATIC_UNIT_INPUT,60,2,73,8
|
||||||
LTEXT "Output",IDC_STATIC_UNIT_OUTPUT,167,2,80,8
|
LTEXT "Output",IDC_STATIC_UNIT_OUTPUT,162,2,80,8
|
||||||
CONTROL "List1",IDC_LIST_UNIT_TYPE,"SysListView32",LVS_SHOWSELALWAYS | LVS_SINGLESEL | LVS_REPORT |
|
CONTROL "List1",IDC_LIST_UNIT_TYPE,"SysListView32",LVS_REPORT |
|
||||||
LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,3,12,67,56
|
LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER |
|
||||||
CONTROL "List2a",IDC_LIST_UNIT_INPUT1,"SysListView32",LVS_SHOWSELALWAYS | LVS_SINGLESEL | LVS_REPORT |
|
WS_BORDER | WS_TABSTOP,3,12,50,56
|
||||||
LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,80,12,26,56
|
CONTROL "List2a",IDC_LIST_UNIT_INPUT1,"SysListView32",LVS_REPORT |
|
||||||
CONTROL "List2b",IDC_LIST_UNIT_INPUT2,"SysListView32",LVS_SHOWSELALWAYS | LVS_SINGLESEL | LVS_REPORT |
|
LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER |
|
||||||
LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,109,12,55,56
|
WS_BORDER | WS_TABSTOP,60,12,26,56
|
||||||
CONTROL "List3a",IDC_LIST_UNIT_OUTPUT1,"SysListView32",LVS_SHOWSELALWAYS | LVS_SINGLESEL | LVS_REPORT |
|
CONTROL "List2b",IDC_LIST_UNIT_INPUT2,"SysListView32",LVS_REPORT |
|
||||||
LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,171,12,26,56
|
LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER |
|
||||||
CONTROL "List3b",IDC_LIST_UNIT_OUTPUT2,"SysListView32",LVS_SHOWSELALWAYS | LVS_SINGLESEL | LVS_REPORT |
|
WS_BORDER | WS_TABSTOP,90,12,65,56
|
||||||
LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,200,12,55,56
|
CONTROL "List3a",IDC_LIST_UNIT_OUTPUT1,"SysListView32",
|
||||||
EDITTEXT IDC_EDIT_OUTPUT_INFO,3,72,161,14,ES_AUTOHSCROLL |
|
LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS |
|
||||||
|
LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,161,12,26,56
|
||||||
|
CONTROL "List3b",IDC_LIST_UNIT_OUTPUT2,"SysListView32",
|
||||||
|
LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS |
|
||||||
|
LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,190,12,65,56
|
||||||
|
EDITTEXT IDC_EDIT_OUTPUT_INFO,3,72,152,14,ES_AUTOHSCROLL |
|
||||||
ES_READONLY
|
ES_READONLY
|
||||||
CONTROL "dynamically output",IDC_COMBO_DYNAMIC_OUTPUT,"Button",
|
CONTROL "dynamically output",IDC_COMBO_DYNAMIC_OUTPUT,"Button",
|
||||||
BS_AUTOCHECKBOX | WS_TABSTOP,172,74,88,10
|
BS_AUTOCHECKBOX | WS_TABSTOP,162,74,88,10
|
||||||
END
|
END
|
||||||
|
|
||||||
#ifndef TTCALC_PORTABLE
|
#ifndef TTCALC_PORTABLE
|
||||||
|
|
133
src/tabs.cpp
133
src/tabs.cpp
|
@ -1221,13 +1221,13 @@ HWND list3b = GetDlgItem(hWnd, IDC_LIST_UNIT_OUTPUT2);
|
||||||
col.mask = LVCF_FMT | LVCF_WIDTH;
|
col.mask = LVCF_FMT | LVCF_WIDTH;
|
||||||
col.fmt = LVCFMT_LEFT;
|
col.fmt = LVCFMT_LEFT;
|
||||||
|
|
||||||
col.cx = 90;
|
col.cx = 70;
|
||||||
ListView_InsertColumn(list1, 0, &col);
|
ListView_InsertColumn(list1, 0, &col);
|
||||||
|
|
||||||
col.cx = 70;
|
col.cx = 90;
|
||||||
ListView_InsertColumn(list2b, 0, &col);
|
ListView_InsertColumn(list2b, 0, &col);
|
||||||
|
|
||||||
col.cx = 70;
|
col.cx = 90;
|
||||||
ListView_InsertColumn(list3b, 0, &col);
|
ListView_InsertColumn(list3b, 0, &col);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1350,60 +1350,123 @@ return messages.Call(message, hWnd, message, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
POINT ResizeTabDialog(HWND tab, HWND dialog, int tabx, int taby, int borderx, int bordery)
|
||||||
void SetSizeOfFunctionVariableList(int tab_id, int list_id, int last_column)
|
|
||||||
{
|
{
|
||||||
HWND main = GetPrgRes()->GetMainWindow();
|
RECT r_dialog;
|
||||||
HWND tab = GetDlgItem(main, IDC_TAB);
|
POINT p, new_dialog_size;
|
||||||
|
|
||||||
POINT p,p2;
|
GetWindowRect(dialog, &r_dialog);
|
||||||
RECT r_main, r;
|
p.x = r_dialog.left;
|
||||||
|
p.y = r_dialog.top;
|
||||||
|
ScreenToClient(tab,&p);
|
||||||
|
new_dialog_size.x = tabx-borderx-p.x;
|
||||||
|
new_dialog_size.y = taby-bordery-p.y;
|
||||||
|
int resize_flags = SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOOWNERZORDER;
|
||||||
|
SetWindowPos(dialog, 0, 0, 0, new_dialog_size.x, new_dialog_size.y, resize_flags);
|
||||||
|
|
||||||
|
return new_dialog_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetSizeOfFunctionVariableList(HWND tab, int tabx, int taby, int borderx, int bordery, int tab_id, int list_id, int last_column)
|
||||||
|
{
|
||||||
|
RECT r;
|
||||||
|
POINT p;
|
||||||
|
|
||||||
HWND dialog = GetPrgRes()->GetTabWindow(tab_id);
|
HWND dialog = GetPrgRes()->GetTabWindow(tab_id);
|
||||||
HWND list = GetDlgItem(dialog, list_id);
|
HWND list = GetDlgItem(dialog, list_id);
|
||||||
|
int resize_flags = SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOOWNERZORDER;
|
||||||
|
|
||||||
GetWindowRect(main, &r_main);
|
ResizeTabDialog(tab, dialog, tabx, taby, borderx, bordery);
|
||||||
int cx = r_main.right - r_main.left;
|
|
||||||
int cy = r_main.bottom - r_main.top;
|
|
||||||
int border_x = GetSystemMetrics(SM_CXDLGFRAME)*2;
|
|
||||||
int border_y = GetSystemMetrics(SM_CYDLGFRAME)*2;
|
|
||||||
|
|
||||||
GetWindowRect(dialog, &r);
|
|
||||||
p.x = r.left;
|
|
||||||
p.y = r.top;
|
|
||||||
p2 = p;
|
|
||||||
p2.x -= r_main.left;
|
|
||||||
p2.y -= r_main.top;
|
|
||||||
ScreenToClient(tab, &p);
|
|
||||||
MoveWindow(dialog, p.x, p.y, cx-p2.x-border_x-2, cy-p2.y-border_y-2, true);
|
|
||||||
|
|
||||||
GetWindowRect(list, &r);
|
GetWindowRect(list, &r);
|
||||||
p.x = r.left;
|
p.x = r.left;
|
||||||
p.y = r.top;
|
p.y = r.top;
|
||||||
p2 = p;
|
ScreenToClient(tab,&p);
|
||||||
p2.x -= r_main.left;
|
int newx = tabx - borderx - p.x;
|
||||||
p2.y -= r_main.top;
|
int newy = taby - bordery - p.y;
|
||||||
ScreenToClient(dialog, &p);
|
SetWindowPos(list, 0, 0, 0, newx, newy, resize_flags);
|
||||||
int list_cx = cx-p2.x-border_x-2;
|
|
||||||
MoveWindow(list, p.x, p.y, list_cx, cy-p2.y-border_y-2, true);
|
|
||||||
|
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
for(int i=0 ; i<last_column ; ++i)
|
for(int i=0 ; i<last_column ; ++i)
|
||||||
sum += ListView_GetColumnWidth(list, i);
|
sum += ListView_GetColumnWidth(list, i);
|
||||||
|
|
||||||
if( sum < list_cx - 30 )
|
if( sum < newx - 30 )
|
||||||
ListView_SetColumnWidth(list, last_column, list_cx-sum-25);
|
ListView_SetColumnWidth(list, last_column, newx-sum-25);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SetSizeOfVariablesList()
|
void SetSizeOfVariablesList(HWND tab, int tabx, int taby, int borderx, int bordery)
|
||||||
{
|
{
|
||||||
SetSizeOfFunctionVariableList(TabWindowFunctions::tab_variables, IDC_VARIABLES_LIST, 1);
|
SetSizeOfFunctionVariableList(tab, tabx, taby, borderx, bordery, TabWindowFunctions::tab_variables, IDC_VARIABLES_LIST, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetSizeOfFunctionsList()
|
void SetSizeOfFunctionsList(HWND tab, int tabx, int taby, int borderx, int bordery)
|
||||||
{
|
{
|
||||||
SetSizeOfFunctionVariableList(TabWindowFunctions::tab_functions, IDC_FUNCTIONS_LIST, 2);
|
SetSizeOfFunctionVariableList(tab, tabx, taby, borderx, bordery, TabWindowFunctions::tab_functions, IDC_FUNCTIONS_LIST, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
void SetSizeOfConvertingLists()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
void SetSizeOfConvertingLists(HWND tab, int tabx, int taby, int borderx, int bordery)
|
||||||
|
{
|
||||||
|
RECT r_edit, r;
|
||||||
|
POINT p;
|
||||||
|
|
||||||
|
HWND dialog = GetPrgRes()->GetTabWindow(tab_convert);
|
||||||
|
HWND list1 = GetDlgItem(dialog, IDC_LIST_UNIT_TYPE);
|
||||||
|
HWND info_edit = GetDlgItem(dialog, IDC_EDIT_OUTPUT_INFO);
|
||||||
|
HWND check_dynamic_output = GetDlgItem(dialog, IDC_COMBO_DYNAMIC_OUTPUT);
|
||||||
|
int move_flags = SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOOWNERZORDER;
|
||||||
|
int resize_flags = SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOOWNERZORDER;
|
||||||
|
|
||||||
|
POINT dialog_new_size = ResizeTabDialog(tab, dialog, tabx, taby, borderx, bordery);
|
||||||
|
|
||||||
|
GetWindowRect(info_edit, &r_edit);
|
||||||
|
|
||||||
|
GetWindowRect(list1, &r);
|
||||||
|
p.x = r.left;
|
||||||
|
p.y = r.top;
|
||||||
|
ScreenToClient(tab,&p);
|
||||||
|
int newy = taby - bordery - (r_edit.bottom-r_edit.top)-p.y-6;
|
||||||
|
SetWindowPos(list1, 0, 0, 0, r.right-r.left, newy, resize_flags);
|
||||||
|
|
||||||
|
HWND list2a = GetDlgItem(dialog, IDC_LIST_UNIT_INPUT1);
|
||||||
|
HWND list2b = GetDlgItem(dialog, IDC_LIST_UNIT_INPUT2);
|
||||||
|
HWND list3a = GetDlgItem(dialog, IDC_LIST_UNIT_OUTPUT1);
|
||||||
|
HWND list3b = GetDlgItem(dialog, IDC_LIST_UNIT_OUTPUT2);
|
||||||
|
|
||||||
|
GetWindowRect(list2a, &r);
|
||||||
|
SetWindowPos(list2a, 0, 0, 0, r.right-r.left, newy, resize_flags);
|
||||||
|
|
||||||
|
GetWindowRect(list2b, &r);
|
||||||
|
SetWindowPos(list2b, 0, 0, 0, r.right-r.left, newy, resize_flags);
|
||||||
|
|
||||||
|
GetWindowRect(list3a, &r);
|
||||||
|
SetWindowPos(list3a, 0, 0, 0, r.right-r.left, newy, resize_flags);
|
||||||
|
|
||||||
|
GetWindowRect(list3b, &r);
|
||||||
|
SetWindowPos(list3b, 0, 0, 0, r.right-r.left, newy, resize_flags);
|
||||||
|
|
||||||
|
|
||||||
|
p.x = r_edit.left;
|
||||||
|
p.y = r_edit.top;
|
||||||
|
ScreenToClient(dialog,&p);
|
||||||
|
newy = dialog_new_size.y -(r_edit.bottom-r_edit.top);
|
||||||
|
SetWindowPos(info_edit, 0, p.x, newy, 0, 0, move_flags);
|
||||||
|
|
||||||
|
|
||||||
|
GetWindowRect(check_dynamic_output, &r);
|
||||||
|
p.x = r.left;
|
||||||
|
p.y = r.top;
|
||||||
|
ScreenToClient(dialog,&p);
|
||||||
|
SetWindowPos(check_dynamic_output, 0, p.x, newy, 0, 0, move_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -69,8 +69,9 @@ extern ttmath::ErrorCode last_code;
|
||||||
void PrintErrorCode();
|
void PrintErrorCode();
|
||||||
BOOL CALLBACK TabWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
BOOL CALLBACK TabWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
void SetLanguage(HWND hTab);
|
void SetLanguage(HWND hTab);
|
||||||
void SetSizeOfVariablesList();
|
void SetSizeOfVariablesList(HWND tab, int tabx, int taby, int borderx, int bordery);
|
||||||
void SetSizeOfFunctionsList();
|
void SetSizeOfFunctionsList(HWND tab, int tabx, int taby, int borderx, int bordery);
|
||||||
|
void SetSizeOfConvertingLists(HWND tab, int tabx, int taby, int borderx, int bordery);
|
||||||
BOOL WmTabCommand(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
BOOL WmTabCommand(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
void SetSizeOfDialogs();
|
void SetSizeOfDialogs();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue