Skip to content

Commit

Permalink
Reorganizando código
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoaurelima committed Feb 4, 2023
1 parent 438173a commit 4f00bd7
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 44 deletions.
6 changes: 3 additions & 3 deletions Digitador.depend
Original file line number Diff line number Diff line change
Expand Up @@ -2325,7 +2325,7 @@
<wx/statline.h>
<wx/stattext.h>

1675537152 source:c:\users\marco\projetos\mk-digitador\digitadormain.cpp
1675539209 source:c:\users\marco\projetos\mk-digitador\digitadormain.cpp
"DigitadorMain.h"
<wx/msgdlg.h>
"mrcwin.h"
Expand All @@ -2335,7 +2335,7 @@
<wx/settings.h>
<wx/string.h>

1675537152 c:\users\marco\projetos\mk-digitador\mrcwin.h
1675540914 c:\users\marco\projetos\mk-digitador\mrcwin.h
<windows.h>
<cwchar>
<vector>
Expand All @@ -2347,7 +2347,7 @@
<wx/panel.h>
<wx/stattext.h>

1675537152 source:c:\users\marco\projetos\mk-digitador\framelove.cpp
1675539256 source:c:\users\marco\projetos\mk-digitador\framelove.cpp
"FrameLove.h"
<sstream>
<wx/font.h>
Expand Down
Binary file removed _ICON.ico
Binary file not shown.
Binary file modified bin/Release/Digitador.exe
Binary file not shown.
66 changes: 25 additions & 41 deletions mrcwin.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
/* -------------------------------------------------------------------------------------- * *
* mrcwin.h *
* Autor: Marco Aurélio Lima *
* Ver. 1.4 22-02-2020 * *
* Ver. 1.4 22-02-2020 *
* https://github.com/marcoaurelima * *
* -------------------------------------------------------------------------------------- */

#ifndef MRCWIN_H_INCLUDED
Expand Down Expand Up @@ -137,7 +138,6 @@ namespace mrcwin{
words.push_back(ss.str());
ss.str("");
}

}

/* Percorrendo todas as palavras; as que tem uma barra "/" são botões especiais ex.: F1, Enter, Shift, etc. */
Expand All @@ -163,27 +163,24 @@ namespace mrcwin{
if(!words[i].compare("/left")) {keyPress(0x25);} else
if(!words[i].compare("/right")) {keyPress(0x27);} else
if(!words[i].compare("/windows")) {keyPress(0x5B);} else

if(!words[i].compare("/[")) {keyPress(0xDD);} else
if(!words[i].compare("/]")) {keyPress(0xDC);} else
if(!words[i].compare("")){keyPress(0xDB);} else
if(!words[i].compare("/~")){keyPress(0xDE);} else

if(!words[i].compare("/!")){keyPress2bt(0x10 , 0x31);} else
if(!words[i].compare("/@")){keyPress2bt(0x10 , 0x32);} else
if(!words[i].compare("/#")){keyPress2bt(0x10 , 0x33);} else
if(!words[i].compare("/$")){keyPress2bt(0x10 , 0x34);} else
if(!words[i].compare("/%")){keyPress2bt(0x10 , 0x35);} else
if(!words[i].compare("/&")){keyPress2bt(0x10 , 0x37);} else
if(!words[i].compare("/(")){keyPress2bt(0x10 , 0x39);} else
if(!words[i].compare("/)")){keyPress2bt(0x10 , 0x30);} else
if(!words[i].compare("/_")){keyPress2bt(0x10 , 0xBD);} else
if(!words[i].compare("/:")){keyPress2bt(0x10 , 0xBF);} else
if(!words[i].compare("/{")){keyPress2bt(0xA0, 0xDD);} else
if(!words[i].compare("/}")){keyPress2bt(0xA0, 0xDC);} else

if(!words[i].compare("/\\")){keyPress(0xE2);} else
if(!words[i].compare("/|")){keyPress2bt(0xA0, 0xE2);} else
if(!words[i].compare("/[")) {keyPress(0xDD);} else
if(!words[i].compare("/]")) {keyPress(0xDC);} else
if(!words[i].compare("")) {keyPress(0xDB);} else
if(!words[i].compare("/~")) {keyPress(0xDE);} else
if(!words[i].compare("/\\")) {keyPress(0xE2);} else
if(!words[i].compare("/!")) {keyPress2bt(0x10, 0x31);} else
if(!words[i].compare("/@")) {keyPress2bt(0x10, 0x32);} else
if(!words[i].compare("/#")) {keyPress2bt(0x10, 0x33);} else
if(!words[i].compare("/$")) {keyPress2bt(0x10, 0x34);} else
if(!words[i].compare("/%")) {keyPress2bt(0x10, 0x35);} else
if(!words[i].compare("/&")) {keyPress2bt(0x10, 0x37);} else
if(!words[i].compare("/(")) {keyPress2bt(0x10, 0x39);} else
if(!words[i].compare("/)")) {keyPress2bt(0x10, 0x30);} else
if(!words[i].compare("/_")) {keyPress2bt(0x10, 0xBD);} else
if(!words[i].compare("/:")) {keyPress2bt(0x10, 0xBF);} else
if(!words[i].compare("/{")) {keyPress2bt(0xA0, 0xDD);} else
if(!words[i].compare("/}")) {keyPress2bt(0xA0, 0xDC);} else
if(!words[i].compare("/|")) {keyPress2bt(0xA0, 0xE2);} else

if(!words[i].compare("/`")){keyPress2bt(0xA0, 0xDB);} else
if(!words[i].compare("/^")){keyPress2bt(0xA0, 0xDE);} else
Expand Down Expand Up @@ -240,19 +237,16 @@ namespace mrcwin{
}

wxMilliSleep(delay);
//Sleep(delay);

} else {
/* Teclas digitaveis por strings */
for(size_t j=0;j<words[i].size();j++){
if(words[i][j] == 'Ç'){
keyPress(0xBA);
wxMilliSleep(delay);
//Sleep(delay);
} else {
keyPress(words[i][j]);
wxMilliSleep(delay);
//Sleep(delay);
}
}
}
Expand All @@ -262,9 +256,7 @@ namespace mrcwin{
/// converte um caractere em uma string correspondente na linguagem do mrcwin
/// EX.: se o caractere for 'Á', a seuqnecia é: caps > acento circunflexo > A > caps
std::string convertChar(char c){
if(c == ' '){ return " / "; } else
if(c == '\t'){ return " /tab "; } else
if(c == '\n'){ return " /enter "; } else
if(c == ' '){ return " / "; } else
if(c == '!'){ return " /! "; } else
if(c == '@'){ return " /@ "; } else
if(c == '#'){ return " /# "; } else
Expand All @@ -275,13 +267,14 @@ namespace mrcwin{
if(c == ')'){ return " /) "; } else
if(c == '_'){ return " /_ "; } else
if(c == ':'){ return " /: "; } else

if(c == '\t'){ return " /tab "; } else
if(c == '\n'){ return " /enter "; } else

if(c == '\\'){ return " /\\ "; } else
if(c == '|'){ return " /| "; } else
if(c == '|'){ return " /| "; } else

if(c == '\"'){ return " /aspas "; } else
if(c == '\''){ return " /' "; } else
if(c == '\''){ return " /' "; } else

if(c == '?'){ return " /? "; } else
if(c == ','){ return " /, "; } else
Expand Down Expand Up @@ -348,8 +341,6 @@ namespace mrcwin{

/// SE CHEGOU AQUI, ELE TEM QUE SER ALFANUMERICO, PQ OS SIMBOLOS
/// POSSIVEIS JÁ FORAMCHECADOS. SE NÃO FOR ALFANUMERICO, VAI RETORNAR.
/// fiz essa alteração depois que ele teve um compotamento estranho depois
/// de digitado. acho que pode resolver - 30-10-2020
if(!isalnum(c)){
return "";
}
Expand Down Expand Up @@ -468,7 +459,6 @@ namespace mrcwin{
scrBuffer.dwSize.X = bufferSize;

SetConsoleScreenBufferSize(handler, scrBuffer.dwSize);

}

/// Muda a quantidade de colunas maxima permitido no eixo Y ( coluna ).
Expand All @@ -481,7 +471,6 @@ namespace mrcwin{
scrBuffer.dwSize.Y = bufferSize;

SetConsoleScreenBufferSize(handler, scrBuffer.dwSize);

}

/// Muda a quantidade de caracteres e colunas maxima permitido respectivamente.
Expand All @@ -495,7 +484,6 @@ namespace mrcwin{
scrBuffer.dwSize.Y = bufferSizeY;

SetConsoleScreenBufferSize(handler, scrBuffer.dwSize);

}

/// Muda o estilo do console para FULLSCREEN
Expand All @@ -521,10 +509,8 @@ namespace mrcwin{
/// Muda a cor das letras mostradas na janela de Console. Use as constantes (ex.: mrcwin::prompt::COLOR_RED) definidas ou tipos inteiros.
/// As cores mudarão sempre que essa função for chamada. Isso significa que é possivel colorir separadamente cada letra.
void changeFontColor(int code){

HANDLE handler = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(handler, code);

}

/// Muda o tamanho da fonte da janela de Console.
Expand All @@ -541,9 +527,7 @@ namespace mrcwin{
if(bold){ fontInfo.FontWeight = FW_BOLD; }
else { fontInfo.FontWeight = FW_NORMAL;}


HANDLE handler = GetStdHandle(STD_OUTPUT_HANDLE);

SetCurrentConsoleFontEx(handler, false, &fontInfo);
}

Expand Down
Binary file modified obj/Release/DigitadorMain.o
Binary file not shown.

0 comments on commit 4f00bd7

Please sign in to comment.