Skip to content

Commit

Permalink
update gui
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalgust committed Aug 3, 2024
1 parent 183b9d6 commit 3d02f46
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ public static String appendUrlParam(String url) {
return url
+ "?lang=" + AppLoader.getLangName()
+ "&ver=" + AppLoader.getBaseInfo("sver")
+ "&jar=" + AppLoader.getBaseInfo("jar")
+ "&jar=" + System.getProperty("os.name").toLowerCase()
+ "&from=" + AppLoader.getBaseInfo("from")
+ "&cver=" + AppLoader.getBaseInfo("cver")
+ "&token=" + (token == null ? "" : token)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ public XExplorer getExplorer() {
void updateScriptEnvironment() {
AppLoader.setProperty("LANG", AppLoader.getLangName());
AppLoader.setProperty("SVER", AppLoader.getBaseInfo("sver"));
AppLoader.setProperty("JAR", AppLoader.getBaseInfo("jar"));
AppLoader.setProperty("JAR", System.getProperty("os.name").toLowerCase());
AppLoader.setProperty("FROM", AppLoader.getBaseInfo("from"));
AppLoader.setProperty("CVER", AppLoader.getBaseInfo("cver"));
AppLoader.setProperty("POLICY_URL", AppLoader.getBaseInfo("policyUrl"));
Expand Down
2 changes: 1 addition & 1 deletion extlib/xgui/src/main/java/org/mini/gui/GFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class GFrame extends GContainer {
protected String title;
protected byte[] title_arr;

protected byte[] close_arr = {(byte) 0xe2, (byte) 0x9d, (byte) 0x8e, 0};
protected byte[] close_arr = {(byte) 0xE2, (byte) 0x9C, (byte) 0x96, 0};
protected float[] close_boundle = new float[4];

protected GViewPort view = new GViewPort(form);
Expand Down
36 changes: 35 additions & 1 deletion extlib/xgui/src/main/java/org/mini/gui/GList.java
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,6 @@ public void mouseButtonEvent(int button, boolean pressed, int x, int y) {
super.mouseButtonEvent(button, pressed, x, y);
}


@Override
public boolean paint(long vg) {
drawNormal(vg, normalPanel.getX(), normalPanel.getY(), normalPanel.getW(), normalPanel.getH());
Expand Down Expand Up @@ -677,6 +676,41 @@ public void focusLost(GObject newgo) {
//因为本次无法获得新获得焦点的组件是谁,因此要把操作放在队列中,等本次渲染执行完后再执行
GForm.addCmd(cmd);
}

@Override
public void keyEventGlfw(int key, int scanCode, int action, int mods) {
if (parent.getCurrent() != GListPopWindow.this) return;
if (action == Glfw.GLFW_PRESS) {
if (key == Glfw.GLFW_KEY_ESCAPE) {
pulldown = false;
GList.this.changeCurPanel();
} else if (key == Glfw.GLFW_KEY_UP) {
int selectIndex = getSelectedIndex();
selectIndex -= 1;
if (selectIndex < 0) selectIndex = popView.getElementSize() - 1;
select(selectIndex);
setCurrent(getSelectedItem());
} else if (key == Glfw.GLFW_KEY_DOWN) {
int selectIndex = getSelectedIndex();
selectIndex += 1;
if (selectIndex >= popView.getElementSize()) selectIndex = 0;
select(selectIndex);
setCurrent(getSelectedItem());
} else if (action == Glfw.GLFW_PRESS) {
pulldown = false;
GList.this.changeCurPanel();

if (key == Glfw.GLFW_KEY_ENTER) {
GListItem li = getSelectedItem();
if (li != null) {
li.select();
}
}
}
}
super.keyEventGlfw(key, scanCode, action, mods);
}

}

;
Expand Down
7 changes: 4 additions & 3 deletions extlib/xgui/src/main/java/org/mini/gui/GListItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package org.mini.gui;

import org.mini.glfm.Glfm;
import org.mini.glfw.Glfw;
import org.mini.nanovg.Nanovg;

import static org.mini.glwrap.GLUtil.toCstyleBytes;
Expand Down Expand Up @@ -170,8 +171,8 @@ public boolean paint(long vg) {
float tw = w - (pad * 2);
float th = list.list_item_heigh - pad;

// nvgSave(vg);
// Nanovg.nvgScissor(vg, tx, ty, tw, th);
nvgSave(vg);
Nanovg.nvgIntersectScissor(vg, tx, ty, tw, th);


if (list.isSelected(getIndex())) {
Expand Down Expand Up @@ -205,7 +206,7 @@ public boolean paint(long vg) {
}
nvgFillColor(vg, c);
GToolkit.drawTextLine(vg, tx + ((img == null && preicon_arr == null) ? 0 : thumb) + pad, ty + thumb / 2, getText(), list.getFontSize(), c, NVG_ALIGN_LEFT | NVG_ALIGN_MIDDLE);
// Nanovg.nvgRestore(vg);
Nanovg.nvgRestore(vg);
return true;
}

Expand Down
1 change: 1 addition & 0 deletions extlib/xgui/src/main/java/org/mini/gui/GObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ abstract public class GObject implements GAttachable {
public static String ICON_CHECK = "\u2713";
public static String ICON_LOGIN = "\uE740";
public static String ICON_TRASH = "\uE729";
public static String ICON_CLOSE = "\u2716";
//
public static final int LEFT = 0;
public static final int TOP = 1;
Expand Down
12 changes: 7 additions & 5 deletions extlib/xgui/src/main/java/org/mini/gui/GTextBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ int getCaretIndexFromArea(int x, int y) {
}
int ci = detail[AREA_LINE_END_AT] + 1;
if (ci > textsb.length()) {
ci= textsb.length();
ci = textsb.length();
}
if (textsb.codePointAt(ci - 1) == '\n') {//取得离光标最近的字符位置,如果光标在行尾,则返回光标所在行尾字符位置
return detail[AREA_LINE_END_AT];
Expand Down Expand Up @@ -1008,6 +1008,7 @@ void drawTextBox(long vg, float x, float y, float w, float h) {

if (tbox.getCurrent() == this) {
boolean draw = false;
boolean jumpWhenReturn = false;
// int code = textsb.codePointAt(caretIndex);
// int codeNext = caretIndex + 1 >= textsb.length() ? 0 : textsb.codePointAt(caretIndex + 1);

Expand All @@ -1016,9 +1017,10 @@ void drawTextBox(long vg, float x, float y, float w, float h) {
draw = true;
} else if (caretIndex == char_endi + 1) {
int codePrev = caretIndex - 1 < 0 ? 0 : textsb.codePointAt(caretIndex - 1);
if (codePrev == '\n') {//如果前一个字符是换行符,则把光标放在下一行的开头
if (codePrev == '\n') {//如果光标index前一个字符是换行符,则把光标放在下一行的开头
caretx = dx + 1;
carety += lineH;
jumpWhenReturn = true;
} else {
caretx = dx + row_width;
if (caretx >= text_area[LEFT] + text_area[WIDTH]) {
Expand All @@ -1031,8 +1033,8 @@ void drawTextBox(long vg, float x, float y, float w, float h) {
draw = true;
}
if (draw) {
curCaretRow = curRow + topShowRow;
curCaretCol = caretIndex - char_starti;
curCaretRow = curRow + topShowRow + (jumpWhenReturn ? 1 : 0);
curCaretCol = jumpWhenReturn ? 0 : (caretIndex - char_starti);
GToolkit.drawCaret(vg, caretx - 1, carety, 2, lineH, false);
}
}
Expand Down Expand Up @@ -1087,7 +1089,7 @@ void drawTextBox(long vg, float x, float y, float w, float h) {
}
if (showCaretPos) {
String info = curCaretRow + ":" + curCaretCol;
GToolkit.drawTextLine(vg, getX() + getW() * .5f, getY() + getH() - lineH, info, 12f, getColor(), NVG_ALIGN_LEFT | NVG_ALIGN_MIDDLE);
GToolkit.drawTextLine(vg, getX() + getW() - 10f, getY() + getH() - lineH, info, 12f, GColorSelector.PURPLE_HALF, NVG_ALIGN_RIGHT | NVG_ALIGN_MIDDLE);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions extlib/xgui/src/main/resource/res/base.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cver=1.0.0
sver=2
jar=ios
from=apple
policyUrl=http://127.0.0.1:30005/account/policy
from=ysbit
policyUrl=https://p.ysbit.cn/account/policy
policyUrl_dev=http://127.0.0.1:30005/account/policy
9 changes: 8 additions & 1 deletion extlib/xgui/src/main/resource/res/ui/AppManager.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@
ret
eif
ret
ret
sub getPolicy() '获取策略
disUrl=getEnv("DISCOVERY_URL")
if(strlen(disUrl)>0)
ret
eif
policyUrl=getEnv("POLICY_URL")
if(strlen(policyUrl)>0)
url=policyUrl + "?ver=" + getEnv("CVER") + "&sver=" + getEnv("SVER")
Expand All @@ -33,12 +38,14 @@
ret
sub showDiscovery() '显示发现
getPolicy()
showSlot("SLOT_MGR", 3)
url=getEnv("DISCOVERY_URL")+"?ver="+ getEnv("SVER") +"&cver="+ getEnv("CVER") +"&cver="+ getEnv("CVER") +"&from="+ getEnv("FROM") +"&jar="+ getEnv("JAR") +"&lang="+ getEnv("LANG")
openPage(url,"")
ret
sub showMy() '显示我的
getPolicy()
showSlot("SLOT_MGR", 4)
str=getText("LOGIN_UID")
if(strlen(str)<>0)
Expand Down
3 changes: 3 additions & 0 deletions minijvm/c/utils/d_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
#elif __linux__
// linux
#define __JVM_OS_LINUX__ 1
#ifdef __ANDROID__
#define __JVM_OS_ANDROID__ 1
#endif
#elif defined(_POSIX_VERSION)
// POSIX
#define __JVM_OS_CYGWIN__ 1
Expand Down

0 comments on commit 3d02f46

Please sign in to comment.