Browse Source

btnchecked

master
boisso 7 years ago
parent
commit
5f33ed8fc4
  1. 7
      k-meleon/macros2/macros.cpp
  2. 4
      k-meleon/macros2/object.h
  3. 11
      k-meleon/macros2/parser.h

7
k-meleon/macros2/macros.cpp

@ -453,7 +453,7 @@ int GetMacroState(int id)
Value* macro = M->FindSymbol(macroname);
if (!macro || !macro->ismacro() ||
(!macro->md->menuChecked && ! macro->md->menuGrayed))
(!macro->md->btnChecked && ! macro->md->menuGrayed))
return -1;
Value *v = M->FindSymbol("$ARG");
@ -462,10 +462,9 @@ int GetMacroState(int id)
int res = 0;
Context c = {NULL};
if (macro->md->menuChecked) {
return -1; // have to set those manually for now
if (macro->md->btnChecked) {
Evaluator e(M, c);
if (e.EvalExpr(macro->md->menuChecked).boolval())
if (e.EvalExpr(macro->md->btnChecked).boolval())
res |= 0x2;
}

4
k-meleon/macros2/object.h

@ -524,11 +524,12 @@ public:
Expression* menuString;
Expression* menuChecked;
Expression* menuGrayed;
Expression* btnChecked;
MacroFile* mf;
MacroDef(MacroFile* amf) : StatList() {
t = NODE_MACRO;
macroInfo = menuString = menuChecked = menuGrayed = NULL;
macroInfo = menuString = menuChecked = menuGrayed = btnChecked = NULL;
mf = amf;
}
@ -537,6 +538,7 @@ public:
if (menuString) delete menuString;
if (menuChecked) delete menuChecked;
if (menuGrayed) delete menuGrayed;
if (btnChecked) delete btnChecked;
}
};

11
k-meleon/macros2/parser.h

@ -91,7 +91,7 @@ typedef struct Program {
}
} Program;
static char* reservedwords[] = { "while", "if", "else", "and", "or", "not", "menu", "menuchecked", "menugrayed", "macroinfo" };
static char* reservedwords[] = { "while", "if", "else", "and", "or", "not", "menu", "menuchecked", "menugrayed", "macroinfo", "buttonchecked" };
#define MAXRESERVED sizeof(reservedwords) / sizeof(char*)
static char* windowvars[] = { "URL", "URLBAR", "SelectedText", "FrameURL", "LinkURL", "ImageURL", "CHARSET", "TextZoom", "TITLE", "WindowNumber", "TabNumber", "CommandLine", "SEARCHURL", "LANG", "VERSION" };
@ -110,6 +110,7 @@ enum TOKEN {
TK_MENUCHECK,
TK_MENUGRAY,
TK_MACROINFO,
TK_BUTTONCHECK,
TK_EQ,
@ -1016,6 +1017,14 @@ public:
else currentMd->menuString = evalexpr();
return NULL;
case TK_BUTTONCHECK:
lex.nexttoken();
skip(TK_ASSIGN);
assert(currentMd);
if (!currentMd) skipstmt();
else currentMd->btnChecked = evalexpr();
return NULL;
default:
error("Invalid statement.");
skipstmt();

Loading…
Cancel
Save