Skip to content

Commit

Permalink
[fix]コメントや一部改行を削除
Browse files Browse the repository at this point in the history
  • Loading branch information
s29kt committed Sep 16, 2023
1 parent 0066313 commit f6c427e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 92 deletions.
54 changes: 4 additions & 50 deletions GalaFli/OverlayForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

namespace GalaFli
{

public partial class OverlayForm : Form
{

Expand All @@ -19,7 +18,6 @@ public partial class OverlayForm : Form
Statedata basisState = new Statedata();



//仮想キーコードを使うための宣言↓↓
// マウスイベント(mouse_eventの引数と同様のデータ)
[StructLayout(LayoutKind.Sequential)]
Expand Down Expand Up @@ -117,26 +115,20 @@ private extern static int MapVirtualKey(
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetForegroundWindow(IntPtr hWnd);


public Label lblMessage;


public OverlayForm(TenkeySettings a)
public OverlayForm(TenkeySettings setting)
{


TransparencyKey = Color.Gray;
StartPosition = FormStartPosition.Manual;

// 画面の幅と高さを取得
int screenWidth = Screen.PrimaryScreen.WorkingArea.Width;
int screenHeight = Screen.PrimaryScreen.WorkingArea.Height;

Width = 330;
Height = 240;



Location = new Point(screenWidth - this.Width - 25, screenHeight - this.Height - 25);

Console.WriteLine(screenWidth);
Expand All @@ -148,15 +140,11 @@ public OverlayForm(TenkeySettings a)
Console.WriteLine(this.Width);
Console.WriteLine(this.Height);



InitializeComponent();



T0.Visible = !a.isZeroUnion;
T000.Visible = !a.isZeroUnion;
T0_another.Visible = a.isZeroUnion;
T0.Visible = !setting.isZeroUnion;
T000.Visible = !setting.isZeroUnion;
T0_another.Visible = setting.isZeroUnion;
TopMost = true;

}
Expand Down Expand Up @@ -206,7 +194,6 @@ public void Json_Load(GalaFli.Data jsonDataTemp)
// エラーメッセージ表示やログ出力などのエラーハンドリングを行う
Debug.WriteLine("Form JSONファイルの読み込みエラー: " + ex.Message);
}

//初期値設定
basisState = jsonData.data[3];
currentState = basisState;
Expand Down Expand Up @@ -282,7 +269,6 @@ public void Send(Key key)
{
//かな状態の時は全角
case "kana_basis":

//全角状態にする
AddInput(KEYDOWN, "hiragana");
AddInput(KEYUP, "hiragana");
Expand All @@ -294,7 +280,6 @@ public void Send(Key key)
case "num_basis":
case "fn_basis":
case "special_basis":

//まず、全角状態にする
AddInput(KEYDOWN, "hiragana");
AddInput(KEYUP, "hiragana");
Expand All @@ -306,7 +291,6 @@ public void Send(Key key)
break;

case "cmd_basis":

//cmd_basisで送信処理まで来るのは送信ボタンのみ
//cmdList内に値が入っている場合 かつ 送信ボタンの場合
if (cmdList.Count > 0)
Expand All @@ -318,9 +302,7 @@ public void Send(Key key)
AddInput(KEYUP, cmdList[i]);
}
}

break;

//Error
default:
Console.WriteLine("Error → basisState.name = {0}", basisState.name);
Expand Down Expand Up @@ -358,7 +340,6 @@ public void Send(Key key)
}
}


//コマンドが入力状態の時(up)
if (cmdList.Count > 0)
{
Expand All @@ -381,8 +362,6 @@ public void Send(Key key)
cmdList.Clear();




//currentState(現在の画面)を basisState(デフォルトの画面)を上書き
currentState = basisState;

Expand Down Expand Up @@ -548,31 +527,6 @@ public void debug_post()

}

private void T_tab_Click(object sender, EventArgs e)
{

}

private void T_asterisk_another_Click(object sender, EventArgs e)
{

}

private void T_tab_another_Click(object sender, EventArgs e)
{

}

private void radioButton1_CheckedChanged(object sender, EventArgs e)
{

}

private void OverlayForm_Load(object sender, EventArgs e)
{

}

private void fnHint_Click(object sender, EventArgs e)
{

Expand Down
45 changes: 3 additions & 42 deletions GalaFli/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

namespace GalaFli
{


//jsonから受け取ったすべてのデータが入るクラス(構造体)
public class Data
{
Expand Down Expand Up @@ -43,7 +41,6 @@ public class Key
// デバイスIDとデバイス名を格納するクラス(構造体)
public class TenkeySettings
{

//どこでインスタンス化しても読み込めるようにここにDllImportが書いてあります
[DllImport("kernel32.dll", EntryPoint = "GetPrivateProfileStringW", CharSet = CharSet.Unicode, SetLastError = true)]
static extern uint GetPrivateProfileString(string lpAppName, string lpKeyName, string lpDefault, StringBuilder lpReturnedString, uint nSize, string lpFileName);
Expand Down Expand Up @@ -91,9 +88,6 @@ static void Main()
Application.SetCompatibleTextRenderingDefault(false);

TenkeySettings tenkeySettings = new TenkeySettings();



try
{
//ファイルパスの指定(自身で用意した場所のパスを書く)
Expand All @@ -107,8 +101,6 @@ static void Main()
var jsonDataTemp = JsonSerializer.Deserialize<Data>(json);




// 設定ファイルの読み込みが出来るかどうかで分岐
//読み込みが出来ない場合はSettingFormを起動する
//読み込みが出来た場合はOverlayFormを起動する
Expand Down Expand Up @@ -143,18 +135,12 @@ static void Main()
Application.Run(new input_Realtime(always_overlay));
});




inputThread.Start();

// Tasktray をメインスレッドで実行
Application.Run(new Tasktray());
}


}

catch (Exception ex)
{
// エラーメッセージ表示やログ出力などのエラーハンドリングを行う
Expand All @@ -178,28 +164,21 @@ public Tasktray()
this.contextMenu1 = new System.Windows.Forms.ContextMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();




// Create the NotifyIcon.
this.notifyIcon1 = new NotifyIcon();

// The Icon property sets the icon that will appear
// in the systray for this application.
notifyIcon1.Icon = new Icon("icon.ico");



// The Text property sets the text that will be displayed,
// in a tooltip, when the mouse hovers over the systray icon.
notifyIcon1.Visible = true;

notifyIcon1.Text = "Galafli";


ContextMenuStrip contextMenuStrip = new ContextMenuStrip();


// 設定
ToolStripMenuItem settingItem = new ToolStripMenuItem();
settingItem.Text = "&設定";
Expand All @@ -213,17 +192,10 @@ public Tasktray()
EixtItem.Click += EixtApp_Click;
contextMenuStrip.Items.Add(EixtItem);




notifyIcon1.ContextMenuStrip = contextMenuStrip;


this.WindowState = FormWindowState.Minimized;
this.ShowInTaskbar = false;



}

protected override void Dispose(bool disposing)
Expand Down Expand Up @@ -258,16 +230,7 @@ private void EixtApp_Click(object Sender, EventArgs e)

private void SettingForm_Click(object Sender, EventArgs e)
{
// @Himonooにフォーム起動のコード書いてもらう。
new SettingForm(notifyIcon1).ShowDialog();

}

private EventHandler debug_Click(OverlayForm a)
{
a.debug_post();
throw new NotImplementedException();

}
}

Expand All @@ -283,9 +246,9 @@ public class input_Realtime : Form
TenkeySettings tenkeySettings = new TenkeySettings();

OverlayForm overlayForm;
public input_Realtime(OverlayForm a)
public input_Realtime(OverlayForm getForm)
{
overlayForm = a;
overlayForm = getForm;

//ドライバと接続を試行し、結果によって処理を分岐
if (!InitializeDriver())
Expand Down Expand Up @@ -314,7 +277,7 @@ public input_Realtime(OverlayForm a)
{
//ここで入力を受け付ける
int device = InputInterceptor.Wait(context);
a.FormTopMost();
getForm.FormTopMost();
//入力されたキーコードやキーのステータスを取得
Stroke stroke = new Stroke();
InputInterceptor.Receive(context, device, ref stroke, 1);
Expand All @@ -328,7 +291,6 @@ public input_Realtime(OverlayForm a)
{
char currentChar;
int offset = 0;

do
{
currentChar = (char)Marshal.ReadByte(idBuffer, offset);
Expand Down Expand Up @@ -365,7 +327,6 @@ public input_Realtime(OverlayForm a)
{
InputInterceptor.Send(context, device, ref stroke, 1);
}

Marshal.FreeHGlobal(idBuffer);
}
}
Expand Down

0 comments on commit f6c427e

Please sign in to comment.